pax_global_header00006660000000000000000000000064146503734060014522gustar00rootroot0000000000000052 comment=b097779e6579ab939fe478d4555ed60a65bb0c64 golang-github-grpc-ecosystem-grpc-gateway-2.20.0/000077500000000000000000000000001465037340600216645ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.bazelci/000077500000000000000000000000001465037340600233535ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.bazelci/presubmit.yml000066400000000000000000000006541465037340600261150ustar00rootroot00000000000000--- platforms: ubuntu1804: build_flags: - "--build_tag_filters=-nolinux" build_targets: - "//..." test_flags: - "--features=race" - "--test_tag_filters=-nolinux" test_targets: - "//..." macos: build_flags: - "--build_tag_filters=-nomacos" build_targets: - "//..." test_flags: - "--features=race" - "--test_tag_filters=-nomacos" test_targets: - "//..." golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.bazelrc000066400000000000000000000001161465037340600233050ustar00rootroot00000000000000build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 build --test_output=errors golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.bazelversion000066400000000000000000000000061465037340600243640ustar00rootroot000000000000007.1.2 golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.devcontainer/000077500000000000000000000000001465037340600244235ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.devcontainer/devcontainer.json000066400000000000000000000011001465037340600277670ustar00rootroot00000000000000// For format details, see https://aka.ms/devcontainer.json. { "name": "Go", "build": { "dockerfile": "../.github/Dockerfile", "args": { "NODE_VERSION": "10" } }, "settings": { "editor.formatOnSave": true, "go.toolsManagement.checkForUpdates": "local", "go.useLanguageServer": true, "go.gopath": "/go", "go.goroot": "/usr/local/go", "bazel.buildifierExecutable": "/go/bin/buildifier", "bazel.buildifierFixOnFormat": true, "bazel.enableCodeLens": true, }, "extensions": [ "golang.Go", "bazelbuild.vscode-bazel", ], "remoteUser": "vscode" } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.git-blame-ignore-revs000066400000000000000000000001411465037340600257600ustar00rootroot00000000000000# .git-blame-ignore-revs # Formatted all protobuf files bc0110188a8ef8e232050c3d9b347198dc83536a golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/000077500000000000000000000000001465037340600232245ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/Dockerfile000066400000000000000000000046341465037340600252250ustar00rootroot00000000000000FROM golang:1.22.3 ENV NVM_DIR="/usr/local/share/nvm" ENV NVM_SYMLINK_CURRENT=true \ PATH=${NVM_DIR}/current/bin:${PATH} ARG VSCODE_SCRIPTS_VERSION="v0.245.2" ARG NODE_VERSION="10" # Run some common installation scripts for a nicer dev environment. In order: # Used to create non-root user and update system packages # https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/common.md # We use this to install Go tools used by gopls # https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/go.md # We use this to install Node # https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/node.md RUN apt-get update && \ wget "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${VSCODE_SCRIPTS_VERSION}/script-library/common-debian.sh" && \ chmod +x ./common-debian.sh && \ ./common-debian.sh false vscode automatic automatic true false && \ wget "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${VSCODE_SCRIPTS_VERSION}/script-library/go-debian.sh" && \ chmod +x ./go-debian.sh && \ ./go-debian.sh none /usr/local/go /go vscode false true && \ wget "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${VSCODE_SCRIPTS_VERSION}/script-library/node-debian.sh" && \ chmod +x ./node-debian.sh && \ ./node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" vscode true && \ rm common-debian.sh go-debian.sh node-debian.sh && \ DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ wget \ unzip \ openjdk-17-jre \ bzip2 \ patch && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* # Install swagger-codegen ENV SWAGGER_CODEGEN_VERSION=2.4.8 RUN wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ -O /usr/local/bin/swagger-codegen-cli.jar && \ echo '#!/bin/bash\njava -jar /usr/local/bin/swagger-codegen-cli.jar "$@"' > /usr/local/bin/swagger-codegen && \ chmod +x /usr/local/bin/swagger-codegen # Install Bazelisk as bazel to manage Bazel RUN go install github.com/bazelbuild/bazelisk@latest && \ mv $(which bazelisk) /usr/local/bin/bazel # Install buildifier for bazel formatting RUN go install github.com/bazelbuild/buildtools/buildifier@latest # Give vscode ownership of GOPATH RUN chown -R vscode: /go USER vscode golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/ISSUE_TEMPLATE.md000066400000000000000000000040451465037340600257340ustar00rootroot00000000000000# The gRPC-Gateway project is maintained by volunteers in their spare time. Please follow these troubleshooting steps before submitting an issue. - [ ] Check if your issue has already been reported (https://github.com/grpc-ecosystem/grpc-gateway/issues). - [ ] Update your protoc to the [latest version](https://github.com/google/protobuf/releases). - [ ] Update your copy of the `grpc-gateway` library to the latest version from github: ```sh go get github.com/grpc-ecosystem/grpc-gateway/v2@latest ``` - [ ] Delete the `protoc-gen-grpc-gateway` and `protoc-gen-openapiv2` binary from your `PATH`, and reinstall the latest versions: ```sh go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 ``` ## I still have a problem! Please consider reaching out for help on a chat forum, such as [Gophers Slack](https://invite.slack.golangbridge.org/) (channel #grpc-gateway). It's much easier to help with common debugging steps in a chat, and some of the maintainers are reading the channel regularly. If you submit an issue which is clearly an environment setup problem, or it's obvious you haven't tried seeking help somewhere else first, we may close your issue. ## I still have a problem! Please follow these steps to submit a bug report: ### Bug reports: Fill in the following sections with explanations of what's gone wrong. ### Steps you follow to reproduce the error: ```html ``` Your steps here. ### What did you expect to happen instead: ```html ``` Your answer here. ### What's your theory on why it isn't working: ```html ``` Your theory here. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/ISSUE_TEMPLATE/000077500000000000000000000000001465037340600254075ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/ISSUE_TEMPLATE/bug.md000066400000000000000000000006741465037340600265150ustar00rootroot00000000000000--- name: 🐛 Bug Report about: Submit a bug report to help us improve --- ## 🐛 Bug Report (A clear and concise description of what the bug is.) ## To Reproduce (Write your steps here:) 1. Step 1... 1. Step 2... 1. Step 3... ## Expected behavior (Write what you thought would happen.) ## Actual Behavior (Write what happened. Add screenshots, if applicable.) ## Your Environment (Environment name, version and operating system.) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/ISSUE_TEMPLATE/documentation.md000066400000000000000000000002411465037340600305770ustar00rootroot00000000000000--- name: 📚 Documentation about: Report an issue related to documentation --- ## 📚 Documentation (A clear and concise description of what the issue is.) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/ISSUE_TEMPLATE/feature.md000066400000000000000000000002321465037340600273610ustar00rootroot00000000000000--- name: 🚀 Feature about: Submit a proposal/request for a new feature --- ## 🚀 Feature (A clear and concise description of what the feature is.) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000015151465037340600270270ustar00rootroot00000000000000 #### References to other Issues or PRs #### Have you read the [Contributing Guidelines](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/CONTRIBUTING.md)? #### Brief description of what is fixed or changed #### Other comments golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/README_GITHUB.md000066400000000000000000000004061465037340600255450ustar00rootroot00000000000000### Whats up with the Dockerfile? The `Dockerfile` in this folder is used as the build environment when regenerating the files (see CONTRIBUTING.md). The canonical repository for this Dockerfile is `docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env`. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/dependabot.yml000066400000000000000000000011351465037340600260540ustar00rootroot00000000000000# To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 updates: - package-ecosystem: "bundler" # See documentation for possible values directory: "/docs" # Location of package manifests schedule: interval: "daily" - package-ecosystem: "github-actions" directory: "/" schedule: interval: daily golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/stale.yml000066400000000000000000000013011465037340600250520ustar00rootroot00000000000000# Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - help wanted - enhancement - security # Label to use when marking an issue as stale staleLabel: wontfix # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/workflows/000077500000000000000000000000001465037340600252615ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/workflows/ci.yml000066400000000000000000000134421465037340600264030ustar00rootroot00000000000000on: - pull_request permissions: contents: read name: CI jobs: build: strategy: matrix: go-version: [1.20.x, 1.21.x, 1.22.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: go-version: ${{ matrix.go-version }} - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - run: go build ./... test: runs-on: ubuntu-latest steps: - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: check-latest: true - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - run: go test ./... node_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 with: node-version: 10 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: check-latest: true - run: > cd examples/internal/browser && npm install gulp-cli && npm install && ./node_modules/.bin/gulp generate: container: image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.22 options: "--user root" credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 # Required with newer versions of Git # https://github.com/actions/checkout/issues/766 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - run: make install - run: make clean - run: make generate - run: go mod tidy - run: git diff --exit-code bazel: container: image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.22 options: "--user root" credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: /home/vscode/.cache/_grpc_gateway_bazel key: v1-bazel-cache-${{ hashFiles('repositories.bzl') }} restore-keys: v1-bazel-cache- # Required with newer versions of Git # https://github.com/actions/checkout/issues/766 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Configure bazel run: | # put .bazelrc in $HOME so that it's read before project's .bazelrc cat > /home/vscode/.bazelrc << EOF startup --output_base=/home/vscode/.cache/_grpc_gateway_bazel build --@io_bazel_rules_go//go/config:race # Workaround https://github.com/bazelbuild/bazel/issues/3645 # See https://docs.bazel.build/versions/0.23.0/command-line-reference.html build --local_ram_resources=7168 # Github runners have 7G of memory build --local_cpu_resources=2 # Github runners have 2 vCPU EOF - name: Check that Bazel BUILD files are up-to-date run: bazel run //:gazelle && git diff --exit-code - name: Check that repositories.bzl is up-to-date run: | bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories && git diff --exit-code - name: Check formatting of Bazel BUILD files run: bazel run //:buildifier && git diff --exit-code - name: Run tests with Bazel run: bazel test //... gorelease: runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: go-version: 1.22 check-latest: true - run: go run golang.org/x/exp/cmd/gorelease@latest -base=v2.19.1 proto_lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: check-latest: true - run: make install - run: PATH=$PATH:~/go/bin buf build - run: PATH=$PATH:~/go/bin buf lint - run: PATH=$PATH:~/go/bin buf format -w && git diff --exit-code - run: PATH=$PATH:~/go/bin buf breaking --path protoc-gen-openapiv2/ --against 'https://github.com/grpc-ecosystem/grpc-gateway.git#branch=main' lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: go-version: 1.22 check-latest: true - uses: dominikh/staticcheck-action@fe1dd0c3658873b46f8c9bb3291096a617310ca6 # v1.3.1 with: install-go: false fuzz: runs-on: ubuntu-latest steps: - name: Build Fuzzers id: build uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master with: oss-fuzz-project-name: "grpc-gateway" dry-run: false language: go - name: Run Fuzzers uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master with: oss-fuzz-project-name: "grpc-gateway" fuzz-seconds: 600 dry-run: false language: go - name: Upload Crash uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts path: ./out/artifacts golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/workflows/release.yml000066400000000000000000000040571465037340600274320ustar00rootroot00000000000000on: push: tags: - v2.[0-9]+.[0-9]+ # For testing the workflow before pushing a tag # This will run goreleaser with --snapshot and test the # SLSA generator. workflow_dispatch: permissions: contents: read name: release jobs: goreleaser: outputs: hashes: ${{ steps.hash.outputs.hashes }} runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: fetch-depth: 0 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5 with: check-latest: true - name: Generate goreleaser args id: args run: | set -euo pipefail args='release --clean' if [[ "$GITHUB_REF" != refs/tags/* ]]; then args+=' --snapshot' fi echo "args=$args" >> $GITHUB_OUTPUT - uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5 id: run-goreleaser with: args: ${{ steps.args.outputs.args }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Generate subject id: hash env: ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}" run: | set -euo pipefail checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path') echo "hashes=$(cat $checksum_file | base64 -w0)" >> $GITHUB_OUTPUT provenance: needs: [goreleaser] permissions: actions: read # To read the workflow path. id-token: write # To sign the provenance. contents: write # To add assets to a release. uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0 with: compile-generator: true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163 base64-subjects: "${{ needs.goreleaser.outputs.hashes }}" upload-assets: ${{ github.event_name == 'push' }} # upload to a new release when pushing via tag golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.github/workflows/renovate.yml000066400000000000000000000062051465037340600276320ustar00rootroot00000000000000on: push: branches: - renovate/* permissions: contents: read name: renovate jobs: update_repositoriesbzl: container: image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.22 options: "--user root" credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: fetch-depth: 0 token: ${{ secrets.GH_PUSH_TOKEN }} - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: /home/vscode/.cache/_grpc_gateway_bazel key: v1-bazel-cache-${{ hashFiles('repositories.bzl') }} restore-keys: v1-bazel-cache- - name: Configure bazel run: | # put .bazelrc in $HOME so that it's read before project's .bazelrc cat > /home/vscode/.bazelrc << EOF startup --output_base /home/vscode/.cache/_grpc_gateway_bazel build --@io_bazel_rules_go//go/config:race # Workaround https://github.com/bazelbuild/bazel/issues/3645 # See https://docs.bazel.build/versions/0.23.0/command-line-reference.html build --local_ram_resources=7168 # Github runners have 7G of memory build --local_cpu_resources=2 # Github runners have 2 vCPU EOF - run: bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories # Required with newer versions of Git # https://github.com/actions/checkout/issues/766 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - run: | git add . if output=$(git status --porcelain) && [ ! -z "$output" ]; then git config user.name "Renovate Bot" git config user.email "bot@renovateapp.com" git commit --amend --no-edit git push --force-with-lease origin ${{ github.ref_name }} fi regenerate: container: image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.22 options: "--user root" credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest needs: # Run after update_repositoriesbzl to avoid # git conflicts - update_repositoriesbzl steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: fetch-depth: 0 token: ${{ secrets.GH_PUSH_TOKEN }} # Required with newer versions of Git # https://github.com/actions/checkout/issues/766 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - run: make install - run: make clean - run: make generate - run: go mod tidy - run: | git add . if output=$(git status --porcelain) && [ ! -z "$output" ]; then git config user.name "Renovate Bot" git config user.email "bot@renovateapp.com" git commit --amend --no-edit git push --force-with-lease origin ${{ github.ref_name }} fi golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.gitignore000066400000000000000000000002421465037340600236520ustar00rootroot00000000000000_output/ .idea # Bazel. bazel-bin bazel-genfiles bazel-grpc-gateway bazel-out bazel-testlogs # Go vendor directory vendor # Generated travis files .travis.yml golang-github-grpc-ecosystem-grpc-gateway-2.20.0/.goreleaser.yml000066400000000000000000000011661465037340600246210ustar00rootroot00000000000000builds: - main: ./protoc-gen-grpc-gateway/main.go id: protoc-gen-grpc-gateway binary: protoc-gen-grpc-gateway env: - CGO_ENABLED=0 goos: - linux - darwin - windows goarch: - amd64 - arm64 - main: ./protoc-gen-openapiv2/main.go id: protoc-gen-openapiv2 binary: protoc-gen-openapiv2 env: - CGO_ENABLED=0 goos: - linux - darwin - windows goarch: - amd64 - arm64 archives: - name_template: '{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{if eq .Arch "amd64"}}x86_64{{else}}{{ .Arch }}{{end}}' format: binary dist: _output golang-github-grpc-ecosystem-grpc-gateway-2.20.0/ADOPTERS.md000066400000000000000000000031131465037340600234250ustar00rootroot00000000000000# Adopters This is a list of organizations that have spoken publicly about their adoption or production users that have added themselves (in alphabetical order): - [Ad Hoc](http://adhocteam.us/) uses the gRPC-Gateway to serve millions of API requests per day. - [Chef](https://www.chef.io/) uses the gRPC-Gateway to provide the user-facing API of [Chef Automate](https://automate.chef.io/). Furthermore, the generated OpenAPI data serves as the basis for its [API documentation](https://automate.chef.io/docs/api/). The code is Open Source, [see `github.com/chef/automate`](https://github.com/chef/automate). - [Conduit](https://github.com/ConduitIO/conduit), a data streaming tool written in Go, uses the gRPC-Gateway since its very beginning to provide an HTTP API in addition to its gRPC API. This makes it easier to integrate with Conduit, and the generated OpenAPI data is used in the documentation. - [PITS Global Data Recovery Services](https://www.pitsdatarecovery.net/) uses the gRPC-Gateway to generate efficient reverse-proxy servers for internal needs. - [Scaleway](https://www.scaleway.com/en/) uses the gRPC-Gateway since 2018 to serve millions of API requests per day [1]. - [SpiceDB](https://github.com/authzed/spicedb) uses the gRPC-Gateway to handle requests for security-critical permissions checks in environments where gRPC is unavailable. If you have adopted the gRPC-Gateway and would like to be included in this list, feel free to submit a PR. [1]: [The odyssey of an HTTP request in Scaleway](https://www.youtube.com/watch?v=eLxD-zIUraE&feature=youtu.be&t=480). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/BUILD.bazel000066400000000000000000000054631465037340600235520ustar00rootroot00000000000000load("@bazel_gazelle//:def.bzl", "gazelle") load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "PROTO_RUNTIME_DEPS", "WELL_KNOWN_TYPES_APIV2") exports_files(["LICENSE"]) buildifier( name = "buildifier", ) buildifier( name = "buildifier_check", mode = "check", ) # gazelle:exclude _output # gazelle:prefix github.com/grpc-ecosystem/grpc-gateway/v2 # gazelle:go_proto_compilers //:go_apiv2 # gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc # gazelle:go_naming_convention import_alias # gazelle:resolve proto proto google/api/annotations.proto @googleapis//google/api:annotations_proto # gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto_googleapis_api//annotations # gazelle:resolve proto proto google/api/http.proto @googleapis//google/api:http_proto # gazelle:resolve proto go google/api/http.proto @org_golang_google_genproto_googleapis_api//annotations # gazelle:resolve proto proto google/api/field_behavior.proto @googleapis//google/api:field_behavior_proto # gazelle:resolve proto go google/api/field_behavior.proto @org_golang_google_genproto_googleapis_api//annotations # gazelle:resolve proto proto google/api/httpbody.proto @googleapis//google/api:httpbody_proto # gazelle:resolve proto go google/api/httpbody.proto @org_golang_google_genproto_googleapis_api//httpbody # gazelle:resolve proto proto google/api/visibility.proto @googleapis//google/api:visibility_proto # gazelle:resolve proto go google/api/visibility.proto @org_golang_google_genproto_googleapis_api//visibility # gazelle:resolve proto proto google/rpc/status.proto @googleapis//google/rpc:status_proto # gazelle:resolve proto go google/rpc/status.proto @org_golang_google_genproto_googleapis_rpc//status gazelle(name = "gazelle") package_group( name = "generators", packages = [ "//protoc-gen-grpc-gateway/...", "//protoc-gen-openapiv2/...", ], ) go_proto_compiler( name = "go_apiv2", options = [ "paths=source_relative", ], plugin = "@org_golang_google_protobuf//cmd/protoc-gen-go", suffix = ".pb.go", visibility = ["//visibility:public"], deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2, ) go_proto_compiler( name = "go_grpc", options = [ "paths=source_relative", "require_unimplemented_servers=false", ], plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc", suffix = "_grpc.pb.go", visibility = ["//visibility:public"], deps = PROTO_RUNTIME_DEPS + [ "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//status:go_default_library", ], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/CONTRIBUTING.md000066400000000000000000000053001465037340600241130ustar00rootroot00000000000000# How to contribute ## Code reviews All submissions, including submissions by project members, require review. ## I want to regenerate the files after making changes ### Using Docker It should be as simple as this (run from the root of the repository): ```bash docker run -v $(pwd):/grpc-gateway -w /grpc-gateway --rm ghcr.io/grpc-ecosystem/grpc-gateway/build-env:1.22 \ /bin/bash -c 'make install && \ make clean && \ make generate' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ ghcr.io/grpc-ecosystem/grpc-gateway/build-env:1.22 -c '\ bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories && \ bazel run :gazelle && \ bazel run :buildifier' ``` You may need to authenticate with GitHub to pull `docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env`. You can do this by following the steps on the [GitHub Package docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry). ### Using Visual Studio Code dev containers This repo contains a `devcontainer.json` configuration that sets up the build environment in a container using [VS Code dev containers](https://code.visualstudio.com/docs/remote/containers). If you're using the dev container, you can run the commands directly in your terminal: ```sh $ make install && make clean && make generate ``` ```sh $ bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories && \ bazel run :gazelle && \ bazel run :buildifier ``` Note that the above-listed docker commands will not work in the dev container, since volume mounts from nested docker container is not possible. If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. ## Making a release To make a release, follow these steps: 1. Decide on a release version. The `gorelease` job can recommend whether the new release should be a patch or minor release. 1. Tag the release on `main`. 1. The release can be created using the command line, or also through GitHub's [releases UI](https://github.com/grpc-ecosystem/grpc-gateway/releases/new). 1. If you create a release using the web UI you can publish it as a draft and have it reviewed by another maintainer. 1. Update the release description. Try to include some of the highlights of this release, ideally with links to the PRs and crediting the contributors. 1. Update the gorelease job in .github/ci.yaml to point to the new release version. 1. Sit back and pat yourself on the back for a job well done :clap:. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/LICENSE000066400000000000000000000027471465037340600227030ustar00rootroot00000000000000Copyright (c) 2015, Gengo, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Gengo, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/MODULE.bazel000066400000000000000000000006171465037340600236740ustar00rootroot00000000000000############################################################################### # Bazel now uses Bzlmod by default to manage external dependencies. # Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. # # For more details, please check https://github.com/bazelbuild/bazel/issues/18958 ############################################################################### golang-github-grpc-ecosystem-grpc-gateway-2.20.0/MODULE.bazel.lock000066400000000000000000004333341465037340600246310ustar00rootroot00000000000000{ "lockFileVersion": 6, "moduleFileHash": "0e3e315145ac7ee7a4e0ac825e1c5e03c068ec1254dd42c3caaecb27e921dc4d", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" ], "cmdModuleOverrides": {}, "allowedYankedVersions": [], "envVarAllowedYankedVersions": "", "ignoreDevDependency": false, "directDependenciesMode": "WARNING", "compatibilityMode": "ERROR" }, "localOverrideHashes": { "bazel_tools": "1ae69322ac3823527337acf02016e8ee95813d8d356f47060255b8956fa642f0" }, "moduleDepGraph": { "": { "name": "", "version": "", "key": "", "repoName": "", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" } }, "bazel_tools@_": { "name": "bazel_tools", "version": "", "key": "bazel_tools@_", "repoName": "bazel_tools", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "@local_config_cc_toolchains//:all", "@local_config_sh//:local_sh_toolchain" ], "extensionUsages": [ { "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", "extensionName": "cc_configure_extension", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 18, "column": 29 }, "imports": { "local_config_cc": "local_config_cc", "local_config_cc_toolchains": "local_config_cc_toolchains" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@bazel_tools//tools/osx:xcode_configure.bzl", "extensionName": "xcode_configure_extension", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 22, "column": 32 }, "imports": { "local_config_xcode": "local_config_xcode" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@rules_java//java:extensions.bzl", "extensionName": "toolchains", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 25, "column": 32 }, "imports": { "local_jdk": "local_jdk", "remote_java_tools": "remote_java_tools", "remote_java_tools_linux": "remote_java_tools_linux", "remote_java_tools_windows": "remote_java_tools_windows", "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64", "remote_java_tools_darwin_arm64": "remote_java_tools_darwin_arm64" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@bazel_tools//tools/sh:sh_configure.bzl", "extensionName": "sh_configure_extension", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 36, "column": 39 }, "imports": { "local_config_sh": "local_config_sh" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@bazel_tools//tools/test:extensions.bzl", "extensionName": "remote_coverage_tools_extension", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 40, "column": 48 }, "imports": { "remote_coverage_tools": "remote_coverage_tools" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@bazel_tools//tools/android:android_extensions.bzl", "extensionName": "remote_android_tools_extensions", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 43, "column": 42 }, "imports": { "android_gmaven_r8": "android_gmaven_r8", "android_tools": "android_tools" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", "extensionName": "buildozer_binary", "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", "line": 47, "column": 33 }, "imports": { "buildozer_binary": "buildozer_binary" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "rules_cc": "rules_cc@0.0.9", "rules_java": "rules_java@7.4.0", "rules_license": "rules_license@0.0.7", "rules_proto": "rules_proto@5.3.0-21.7", "rules_python": "rules_python@0.22.1", "buildozer": "buildozer@6.4.0.2", "platforms": "platforms@0.0.7", "com_google_protobuf": "protobuf@21.7", "zlib": "zlib@1.3", "build_bazel_apple_support": "apple_support@1.5.0", "local_config_platform": "local_config_platform@_" } }, "local_config_platform@_": { "name": "local_config_platform", "version": "", "key": "local_config_platform@_", "repoName": "local_config_platform", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_" } }, "rules_cc@0.0.9": { "name": "rules_cc", "version": "0.0.9", "key": "rules_cc@0.0.9", "repoName": "rules_cc", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "@local_config_cc_toolchains//:all" ], "extensionUsages": [ { "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", "extensionName": "cc_configure_extension", "usingModule": "rules_cc@0.0.9", "location": { "file": "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel", "line": 9, "column": 29 }, "imports": { "local_config_cc_toolchains": "local_config_cc_toolchains" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" ], "integrity": "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8=", "strip_prefix": "rules_cc-0.0.9", "remote_patches": { "https://bcr.bazel.build/modules/rules_cc/0.0.9/patches/module_dot_bazel_version.patch": "sha256-mM+qzOI0SgAdaJBlWOSMwMPKpaA9b7R37Hj/tp5bb4g=" }, "remote_patch_strip": 0 } } }, "rules_java@7.4.0": { "name": "rules_java", "version": "7.4.0", "key": "rules_java@7.4.0", "repoName": "rules_java", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "//toolchains:all", "@local_jdk//:runtime_toolchain_definition", "@local_jdk//:bootstrap_runtime_toolchain_definition", "@remotejdk11_linux_toolchain_config_repo//:all", "@remotejdk11_linux_aarch64_toolchain_config_repo//:all", "@remotejdk11_linux_ppc64le_toolchain_config_repo//:all", "@remotejdk11_linux_s390x_toolchain_config_repo//:all", "@remotejdk11_macos_toolchain_config_repo//:all", "@remotejdk11_macos_aarch64_toolchain_config_repo//:all", "@remotejdk11_win_toolchain_config_repo//:all", "@remotejdk11_win_arm64_toolchain_config_repo//:all", "@remotejdk17_linux_toolchain_config_repo//:all", "@remotejdk17_linux_aarch64_toolchain_config_repo//:all", "@remotejdk17_linux_ppc64le_toolchain_config_repo//:all", "@remotejdk17_linux_s390x_toolchain_config_repo//:all", "@remotejdk17_macos_toolchain_config_repo//:all", "@remotejdk17_macos_aarch64_toolchain_config_repo//:all", "@remotejdk17_win_toolchain_config_repo//:all", "@remotejdk17_win_arm64_toolchain_config_repo//:all", "@remotejdk21_linux_toolchain_config_repo//:all", "@remotejdk21_linux_aarch64_toolchain_config_repo//:all", "@remotejdk21_macos_toolchain_config_repo//:all", "@remotejdk21_macos_aarch64_toolchain_config_repo//:all", "@remotejdk21_win_toolchain_config_repo//:all" ], "extensionUsages": [ { "extensionBzlFile": "@rules_java//java:extensions.bzl", "extensionName": "toolchains", "usingModule": "rules_java@7.4.0", "location": { "file": "https://bcr.bazel.build/modules/rules_java/7.4.0/MODULE.bazel", "line": 19, "column": 27 }, "imports": { "remote_java_tools": "remote_java_tools", "remote_java_tools_linux": "remote_java_tools_linux", "remote_java_tools_windows": "remote_java_tools_windows", "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64", "remote_java_tools_darwin_arm64": "remote_java_tools_darwin_arm64", "local_jdk": "local_jdk", "remotejdk11_linux_toolchain_config_repo": "remotejdk11_linux_toolchain_config_repo", "remotejdk11_linux_aarch64_toolchain_config_repo": "remotejdk11_linux_aarch64_toolchain_config_repo", "remotejdk11_linux_ppc64le_toolchain_config_repo": "remotejdk11_linux_ppc64le_toolchain_config_repo", "remotejdk11_linux_s390x_toolchain_config_repo": "remotejdk11_linux_s390x_toolchain_config_repo", "remotejdk11_macos_toolchain_config_repo": "remotejdk11_macos_toolchain_config_repo", "remotejdk11_macos_aarch64_toolchain_config_repo": "remotejdk11_macos_aarch64_toolchain_config_repo", "remotejdk11_win_toolchain_config_repo": "remotejdk11_win_toolchain_config_repo", "remotejdk11_win_arm64_toolchain_config_repo": "remotejdk11_win_arm64_toolchain_config_repo", "remotejdk17_linux_toolchain_config_repo": "remotejdk17_linux_toolchain_config_repo", "remotejdk17_linux_aarch64_toolchain_config_repo": "remotejdk17_linux_aarch64_toolchain_config_repo", "remotejdk17_linux_ppc64le_toolchain_config_repo": "remotejdk17_linux_ppc64le_toolchain_config_repo", "remotejdk17_linux_s390x_toolchain_config_repo": "remotejdk17_linux_s390x_toolchain_config_repo", "remotejdk17_macos_toolchain_config_repo": "remotejdk17_macos_toolchain_config_repo", "remotejdk17_macos_aarch64_toolchain_config_repo": "remotejdk17_macos_aarch64_toolchain_config_repo", "remotejdk17_win_toolchain_config_repo": "remotejdk17_win_toolchain_config_repo", "remotejdk17_win_arm64_toolchain_config_repo": "remotejdk17_win_arm64_toolchain_config_repo", "remotejdk21_linux_toolchain_config_repo": "remotejdk21_linux_toolchain_config_repo", "remotejdk21_linux_aarch64_toolchain_config_repo": "remotejdk21_linux_aarch64_toolchain_config_repo", "remotejdk21_macos_toolchain_config_repo": "remotejdk21_macos_toolchain_config_repo", "remotejdk21_macos_aarch64_toolchain_config_repo": "remotejdk21_macos_aarch64_toolchain_config_repo", "remotejdk21_win_toolchain_config_repo": "remotejdk21_win_toolchain_config_repo" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "platforms": "platforms@0.0.7", "rules_cc": "rules_cc@0.0.9", "bazel_skylib": "bazel_skylib@1.3.0", "rules_proto": "rules_proto@5.3.0-21.7", "rules_license": "rules_license@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz" ], "integrity": "sha256-l27wi0nJKXQfIBeQ5Z44B8cq2B9CjIvJU82+/1/tFes=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 } } }, "rules_license@0.0.7": { "name": "rules_license", "version": "0.0.7", "key": "rules_license@0.0.7", "repoName": "rules_license", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz" ], "integrity": "sha256-RTHezLkTY5ww5cdRKgVNXYdWmNrrddjPkPKEN1/nw2A=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 } } }, "rules_proto@5.3.0-21.7": { "name": "rules_proto", "version": "5.3.0-21.7", "key": "rules_proto@5.3.0-21.7", "repoName": "rules_proto", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "com_google_protobuf": "protobuf@21.7", "rules_cc": "rules_cc@0.0.9", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz" ], "integrity": "sha256-3D+yBqLLNEG0heseQjFlsjEjWh6psDG0Qzz3vB+kYN0=", "strip_prefix": "rules_proto-5.3.0-21.7", "remote_patches": {}, "remote_patch_strip": 0 } } }, "rules_python@0.22.1": { "name": "rules_python", "version": "0.22.1", "key": "rules_python@0.22.1", "repoName": "rules_python", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "@bazel_tools//tools/python:autodetecting_toolchain" ], "extensionUsages": [ { "extensionBzlFile": "@rules_python//python/extensions/private:internal_deps.bzl", "extensionName": "internal_deps", "usingModule": "rules_python@0.22.1", "location": { "file": "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel", "line": 14, "column": 30 }, "imports": { "pypi__build": "pypi__build", "pypi__click": "pypi__click", "pypi__colorama": "pypi__colorama", "pypi__importlib_metadata": "pypi__importlib_metadata", "pypi__installer": "pypi__installer", "pypi__more_itertools": "pypi__more_itertools", "pypi__packaging": "pypi__packaging", "pypi__pep517": "pypi__pep517", "pypi__pip": "pypi__pip", "pypi__pip_tools": "pypi__pip_tools", "pypi__setuptools": "pypi__setuptools", "pypi__tomli": "pypi__tomli", "pypi__wheel": "pypi__wheel", "pypi__zipp": "pypi__zipp", "pypi__coverage_cp310_aarch64-apple-darwin": "pypi__coverage_cp310_aarch64-apple-darwin", "pypi__coverage_cp310_aarch64-unknown-linux-gnu": "pypi__coverage_cp310_aarch64-unknown-linux-gnu", "pypi__coverage_cp310_x86_64-apple-darwin": "pypi__coverage_cp310_x86_64-apple-darwin", "pypi__coverage_cp310_x86_64-unknown-linux-gnu": "pypi__coverage_cp310_x86_64-unknown-linux-gnu", "pypi__coverage_cp311_aarch64-unknown-linux-gnu": "pypi__coverage_cp311_aarch64-unknown-linux-gnu", "pypi__coverage_cp311_x86_64-apple-darwin": "pypi__coverage_cp311_x86_64-apple-darwin", "pypi__coverage_cp311_x86_64-unknown-linux-gnu": "pypi__coverage_cp311_x86_64-unknown-linux-gnu", "pypi__coverage_cp38_aarch64-apple-darwin": "pypi__coverage_cp38_aarch64-apple-darwin", "pypi__coverage_cp38_aarch64-unknown-linux-gnu": "pypi__coverage_cp38_aarch64-unknown-linux-gnu", "pypi__coverage_cp38_x86_64-apple-darwin": "pypi__coverage_cp38_x86_64-apple-darwin", "pypi__coverage_cp38_x86_64-unknown-linux-gnu": "pypi__coverage_cp38_x86_64-unknown-linux-gnu", "pypi__coverage_cp39_aarch64-apple-darwin": "pypi__coverage_cp39_aarch64-apple-darwin", "pypi__coverage_cp39_aarch64-unknown-linux-gnu": "pypi__coverage_cp39_aarch64-unknown-linux-gnu", "pypi__coverage_cp39_x86_64-apple-darwin": "pypi__coverage_cp39_x86_64-apple-darwin", "pypi__coverage_cp39_x86_64-unknown-linux-gnu": "pypi__coverage_cp39_x86_64-unknown-linux-gnu" }, "devImports": [], "tags": [ { "tagName": "install", "attributeValues": {}, "devDependency": false, "location": { "file": "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel", "line": 15, "column": 22 } } ], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@rules_python//python/extensions:python.bzl", "extensionName": "python", "usingModule": "rules_python@0.22.1", "location": { "file": "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel", "line": 50, "column": 23 }, "imports": { "pythons_hub": "pythons_hub" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "platforms": "platforms@0.0.7", "bazel_skylib": "bazel_skylib@1.3.0", "rules_proto": "rules_proto@5.3.0-21.7", "com_google_protobuf": "protobuf@21.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_python/releases/download/0.22.1/rules_python-0.22.1.tar.gz" ], "integrity": "sha256-pWQP3dS+sD6MH95e1xYMC6a9R359BIZhwwwGk2om/WM=", "strip_prefix": "rules_python-0.22.1", "remote_patches": { "https://bcr.bazel.build/modules/rules_python/0.22.1/patches/module_dot_bazel_version.patch": "sha256-3+VLDH9gYDzNI4eOW7mABC/LKxh1xqF6NhacLbNTucs=" }, "remote_patch_strip": 1 } } }, "buildozer@6.4.0.2": { "name": "buildozer", "version": "6.4.0.2", "key": "buildozer@6.4.0.2", "repoName": "buildozer", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [ { "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", "extensionName": "buildozer_binary", "usingModule": "buildozer@6.4.0.2", "location": { "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", "line": 7, "column": 33 }, "imports": { "buildozer_binary": "buildozer_binary" }, "devImports": [], "tags": [ { "tagName": "buildozer", "attributeValues": { "sha256": { "darwin-amd64": "d29e347ecd6b5673d72cb1a8de05bf1b06178dd229ff5eb67fad5100c840cc8e", "darwin-arm64": "9b9e71bdbec5e7223871e913b65d12f6d8fa026684daf991f00e52ed36a6978d", "linux-amd64": "8dfd6345da4e9042daa738d7fdf34f699c5dfce4632f7207956fceedd8494119", "linux-arm64": "6559558fded658c8fa7432a9d011f7c4dcbac6b738feae73d2d5c352e5f605fa", "windows-amd64": "e7f05bf847f7c3689dd28926460ce6e1097ae97380ac8e6ae7147b7b706ba19b" }, "version": "6.4.0" }, "devDependency": false, "location": { "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", "line": 8, "column": 27 } } ], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/fmeum/buildozer/releases/download/v6.4.0.2/buildozer-v6.4.0.2.tar.gz" ], "integrity": "sha256-k7tFKQMR2AygxpmZfH0yEPnQmF3efFgD9rBPkj+Yz/8=", "strip_prefix": "buildozer-6.4.0.2", "remote_patches": { "https://bcr.bazel.build/modules/buildozer/6.4.0.2/patches/module_dot_bazel_version.patch": "sha256-gKANF2HMilj7bWmuXs4lbBIAAansuWC4IhWGB/CerjU=" }, "remote_patch_strip": 1 } } }, "platforms@0.0.7": { "name": "platforms", "version": "0.0.7", "key": "platforms@0.0.7", "repoName": "platforms", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "rules_license": "rules_license@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz" ], "integrity": "sha256-OlYcmee9vpFzqmU/1Xn+hJ8djWc5V4CrR3Cx84FDHVE=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 } } }, "protobuf@21.7": { "name": "protobuf", "version": "21.7", "key": "protobuf@21.7", "repoName": "protobuf", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [ { "extensionBzlFile": "@rules_jvm_external//:extensions.bzl", "extensionName": "maven", "usingModule": "protobuf@21.7", "location": { "file": "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel", "line": 22, "column": 22 }, "imports": { "maven": "maven" }, "devImports": [], "tags": [ { "tagName": "install", "attributeValues": { "name": "maven", "artifacts": [ "com.google.code.findbugs:jsr305:3.0.2", "com.google.code.gson:gson:2.8.9", "com.google.errorprone:error_prone_annotations:2.3.2", "com.google.j2objc:j2objc-annotations:1.3", "com.google.guava:guava:31.1-jre", "com.google.guava:guava-testlib:31.1-jre", "com.google.truth:truth:1.1.2", "junit:junit:4.13.2", "org.mockito:mockito-core:4.3.1" ] }, "devDependency": false, "location": { "file": "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel", "line": 24, "column": 14 } } ], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "rules_python": "rules_python@0.22.1", "rules_cc": "rules_cc@0.0.9", "rules_proto": "rules_proto@5.3.0-21.7", "rules_java": "rules_java@7.4.0", "rules_pkg": "rules_pkg@0.7.0", "com_google_abseil": "abseil-cpp@20211102.0", "zlib": "zlib@1.3", "upb": "upb@0.0.0-20220923-a547704", "rules_jvm_external": "rules_jvm_external@4.4.2", "com_google_googletest": "googletest@1.11.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-all-21.7.zip" ], "integrity": "sha256-VJOiH17T/FAuZv7GuUScBqVRztYwAvpIkDxA36jeeko=", "strip_prefix": "protobuf-21.7", "remote_patches": { "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_module_dot_bazel.patch": "sha256-q3V2+eq0v2XF0z8z+V+QF4cynD6JvHI1y3kI/+rzl5s=", "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_module_dot_bazel_for_examples.patch": "sha256-O7YP6s3lo/1opUiO0jqXYORNHdZ/2q3hjz1QGy8QdIU=", "https://bcr.bazel.build/modules/protobuf/21.7/patches/relative_repo_names.patch": "sha256-RK9RjW8T5UJNG7flIrnFiNE9vKwWB+8uWWtJqXYT0w4=", "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_missing_files.patch": "sha256-Hyne4DG2u5bXcWHNxNMirA2QFAe/2Cl8oMm1XJdkQIY=" }, "remote_patch_strip": 1 } } }, "zlib@1.3": { "name": "zlib", "version": "1.3", "key": "zlib@1.3", "repoName": "zlib", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "platforms": "platforms@0.0.7", "rules_cc": "rules_cc@0.0.9", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" ], "integrity": "sha256-/wukwpIBPbwnUws6geH5qBPNOd4Byl4Pi/NVcC76WT4=", "strip_prefix": "zlib-1.3", "remote_patches": { "https://bcr.bazel.build/modules/zlib/1.3/patches/add_build_file.patch": "sha256-Ei+FYaaOo7A3jTKunMEodTI0Uw5NXQyZEcboMC8JskY=", "https://bcr.bazel.build/modules/zlib/1.3/patches/module_dot_bazel.patch": "sha256-fPWLM+2xaF/kuy+kZc1YTfW6hNjrkG400Ho7gckuyJk=" }, "remote_patch_strip": 0 } } }, "apple_support@1.5.0": { "name": "apple_support", "version": "1.5.0", "key": "apple_support@1.5.0", "repoName": "build_bazel_apple_support", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "@local_config_apple_cc_toolchains//:all" ], "extensionUsages": [ { "extensionBzlFile": "@build_bazel_apple_support//crosstool:setup.bzl", "extensionName": "apple_cc_configure_extension", "usingModule": "apple_support@1.5.0", "location": { "file": "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel", "line": 17, "column": 35 }, "imports": { "local_config_apple_cc": "local_config_apple_cc", "local_config_apple_cc_toolchains": "local_config_apple_cc_toolchains" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/apple_support/releases/download/1.5.0/apple_support.1.5.0.tar.gz" ], "integrity": "sha256-miM41vja0yRPgj8txghKA+TQ+7J8qJLclw5okNW0gYQ=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 } } }, "bazel_skylib@1.3.0": { "name": "bazel_skylib", "version": "1.3.0", "key": "bazel_skylib@1.3.0", "repoName": "bazel_skylib", "executionPlatformsToRegister": [], "toolchainsToRegister": [ "//toolchains/unittest:cmd_toolchain", "//toolchains/unittest:bash_toolchain" ], "extensionUsages": [], "deps": { "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz" ], "integrity": "sha256-dNVE2W9KW7Yw1GXKi7z+Ix41lOWq5X4e2/F6brPKJQY=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 } } }, "rules_pkg@0.7.0": { "name": "rules_pkg", "version": "0.7.0", "key": "rules_pkg@0.7.0", "repoName": "rules_pkg", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "rules_python": "rules_python@0.22.1", "bazel_skylib": "bazel_skylib@1.3.0", "rules_license": "rules_license@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz" ], "integrity": "sha256-iimOgydi7aGDBZfWT+fbWBeKqEzVkm121bdE1lWJQcI=", "strip_prefix": "", "remote_patches": { "https://bcr.bazel.build/modules/rules_pkg/0.7.0/patches/module_dot_bazel.patch": "sha256-4OaEPZwYF6iC71ZTDg6MJ7LLqX7ZA0/kK4mT+4xKqiE=" }, "remote_patch_strip": 0 } } }, "abseil-cpp@20211102.0": { "name": "abseil-cpp", "version": "20211102.0", "key": "abseil-cpp@20211102.0", "repoName": "abseil-cpp", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "rules_cc": "rules_cc@0.0.9", "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz" ], "integrity": "sha256-3PcbnLqNwMqZQMSzFqDHlr6Pq0KwcLtrfKtitI8OZsQ=", "strip_prefix": "abseil-cpp-20211102.0", "remote_patches": { "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/patches/module_dot_bazel.patch": "sha256-4izqopgGCey4jVZzl/w3M2GVPNohjh2B5TmbThZNvPY=" }, "remote_patch_strip": 0 } } }, "upb@0.0.0-20220923-a547704": { "name": "upb", "version": "0.0.0-20220923-a547704", "key": "upb@0.0.0-20220923-a547704", "repoName": "upb", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "rules_proto": "rules_proto@5.3.0-21.7", "com_google_protobuf": "protobuf@21.7", "com_google_absl": "abseil-cpp@20211102.0", "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/protocolbuffers/upb/archive/a5477045acaa34586420942098f5fecd3570f577.tar.gz" ], "integrity": "sha256-z39x6v+QskwaKLSWRan/A6mmwecTQpHOcJActj5zZLU=", "strip_prefix": "upb-a5477045acaa34586420942098f5fecd3570f577", "remote_patches": { "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/patches/module_dot_bazel.patch": "sha256-wH4mNS6ZYy+8uC0HoAft/c7SDsq2Kxf+J8dUakXhaB0=" }, "remote_patch_strip": 0 } } }, "rules_jvm_external@4.4.2": { "name": "rules_jvm_external", "version": "4.4.2", "key": "rules_jvm_external@4.4.2", "repoName": "rules_jvm_external", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [ { "extensionBzlFile": "@rules_jvm_external//:non-module-deps.bzl", "extensionName": "non_module_deps", "usingModule": "rules_jvm_external@4.4.2", "location": { "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", "line": 9, "column": 32 }, "imports": { "io_bazel_rules_kotlin": "io_bazel_rules_kotlin" }, "devImports": [], "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true }, { "extensionBzlFile": "@rules_jvm_external//:extensions.bzl", "extensionName": "maven", "usingModule": "rules_jvm_external@4.4.2", "location": { "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", "line": 16, "column": 22 }, "imports": { "rules_jvm_external_deps": "rules_jvm_external_deps" }, "devImports": [], "tags": [ { "tagName": "install", "attributeValues": { "name": "rules_jvm_external_deps", "artifacts": [ "com.google.cloud:google-cloud-core:1.93.10", "com.google.cloud:google-cloud-storage:1.113.4", "com.google.code.gson:gson:2.9.0", "org.apache.maven:maven-artifact:3.8.6", "software.amazon.awssdk:s3:2.17.183" ], "lock_file": "@rules_jvm_external//:rules_jvm_external_deps_install.json" }, "devDependency": false, "location": { "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", "line": 18, "column": 14 } } ], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "io_bazel_stardoc": "stardoc@0.5.1", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/4.4.2.zip" ], "integrity": "sha256-c1YC9QgT6y6pPKP15DsZWb2AshO4NqB6YqKddXZwt3s=", "strip_prefix": "rules_jvm_external-4.4.2", "remote_patches": {}, "remote_patch_strip": 0 } } }, "googletest@1.11.0": { "name": "googletest", "version": "1.11.0", "key": "googletest@1.11.0", "repoName": "googletest", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "com_google_absl": "abseil-cpp@20211102.0", "platforms": "platforms@0.0.7", "rules_cc": "rules_cc@0.0.9", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz" ], "integrity": "sha256-tIcL8SH/d5W6INILzdhie44Ijy0dqymaAxwQNO3ck9U=", "strip_prefix": "googletest-release-1.11.0", "remote_patches": { "https://bcr.bazel.build/modules/googletest/1.11.0/patches/module_dot_bazel.patch": "sha256-HuahEdI/n8KCI071sN3CEziX+7qP/Ec77IWayYunLP0=" }, "remote_patch_strip": 0 } } }, "stardoc@0.5.1": { "name": "stardoc", "version": "0.5.1", "key": "stardoc@0.5.1", "repoName": "stardoc", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { "bazel_skylib": "bazel_skylib@1.3.0", "rules_java": "rules_java@7.4.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "urls": [ "https://github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz" ], "integrity": "sha256-qoFNrgrEALurLoiB+ZFcb0fElmS/CHxAmhX5BDjSwj4=", "strip_prefix": "", "remote_patches": { "https://bcr.bazel.build/modules/stardoc/0.5.1/patches/module_dot_bazel.patch": "sha256-UAULCuTpJE7SG0YrR9XLjMfxMRmbP+za3uW9ONZ5rjI=" }, "remote_patch_strip": 0 } } } }, "moduleExtensions": { "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { "bzlTransitiveDigest": "pMLFCYaRPkgXPQ8vtuNkMfiHfPmRBy6QJfnid4sWfv0=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_apple_cc": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", "ruleClassName": "_apple_cc_autoconf", "attributes": {} }, "local_config_apple_cc_toolchains": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", "ruleClassName": "_apple_cc_autoconf_toolchains", "attributes": {} } }, "recordedRepoMappingEntries": [ [ "apple_support~", "bazel_tools", "bazel_tools" ] ] } }, "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { "bzlTransitiveDigest": "PHpT2yqMGms2U4L3E/aZ+WcQalmZWm+ILdP3yiLsDhA=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_cc": { "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", "ruleClassName": "cc_autoconf", "attributes": {} }, "local_config_cc_toolchains": { "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", "ruleClassName": "cc_autoconf_toolchains", "attributes": {} } }, "recordedRepoMappingEntries": [ [ "bazel_tools", "bazel_tools", "bazel_tools" ] ] } }, "@@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { "general": { "bzlTransitiveDigest": "Qh2bWTU6QW6wkrd87qrU4YeY+SG37Nvw3A0PR4Y0L2Y=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_xcode": { "bzlFile": "@@bazel_tools//tools/osx:xcode_configure.bzl", "ruleClassName": "xcode_autoconf", "attributes": { "xcode_locator": "@bazel_tools//tools/osx:xcode_locator.m", "remote_xcode": "" } } }, "recordedRepoMappingEntries": [] } }, "@@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { "general": { "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_sh": { "bzlFile": "@@bazel_tools//tools/sh:sh_configure.bzl", "ruleClassName": "sh_config", "attributes": {} } }, "recordedRepoMappingEntries": [] } }, "@@rules_java~//java:extensions.bzl%toolchains": { "general": { "bzlTransitiveDigest": "0N5b5J9fUzo0sgvH4F3kIEaeXunz4Wy2/UtSFV/eXUY=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "remotejdk21_linux_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\n" } }, "remotejdk17_linux_s390x_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\n" } }, "remotejdk17_macos_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\n" } }, "remotejdk21_macos_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\n" } }, "remotejdk17_linux_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\n" } }, "remotejdk21_macos_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", "sha256": "e8260516de8b60661422a725f1df2c36ef888f6fb35393566b00e7325db3d04e", "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz" ] } }, "remotejdk17_linux_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\n" } }, "remotejdk17_macos_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "314b04568ec0ae9b36ba03c9cbd42adc9e1265f74678923b19297d66eb84dcca", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz" ] } }, "remote_java_tools_windows": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "sha256": "fe2f88169696d6c6fc6e90ba61bb46be7d0ae3693cbafdf336041bf56679e8d1", "urls": [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_windows-v13.4.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_windows-v13.4.zip" ] } }, "remotejdk11_win": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "43408193ce2fa0862819495b5ae8541085b95660153f2adcf91a52d3a1710e83", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-win_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip", "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip" ] } }, "remotejdk11_win_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\n" } }, "remotejdk11_linux_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "54174439f2b3fddd11f1048c397fe7bb45d4c9d66d452d6889b013d04d21c4de", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz" ] } }, "remotejdk17_linux": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "b9482f2304a1a68a614dfacddcf29569a72f0fac32e6c74f83dc1b9a157b8340", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz" ] } }, "remotejdk11_linux_s390x_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\n" } }, "remotejdk11_linux_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\n" } }, "remotejdk11_macos": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "bcaab11cfe586fae7583c6d9d311c64384354fb2638eb9a012eca4c3f1a1d9fd", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz" ] } }, "remotejdk11_win_arm64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "b8a28e6e767d90acf793ea6f5bed0bb595ba0ba5ebdf8b99f395266161e53ec2", "strip_prefix": "jdk-11.0.13+8", "urls": [ "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip" ] } }, "remotejdk17_macos": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "640453e8afe8ffe0fb4dceb4535fb50db9c283c64665eebb0ba68b19e65f4b1f", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz" ] } }, "remotejdk21_macos": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", "sha256": "3ad8fe288eb57d975c2786ae453a036aa46e47ab2ac3d81538ebae2a54d3c025", "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz" ] } }, "remotejdk21_macos_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\n" } }, "remotejdk17_macos_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\n" } }, "remotejdk17_win": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "192f2afca57701de6ec496234f7e45d971bf623ff66b8ee4a5c81582054e5637", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip" ] } }, "remotejdk11_macos_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\n" } }, "remotejdk11_linux_ppc64le_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\n" } }, "remotejdk21_linux": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", "sha256": "5ad730fbee6bb49bfff10bf39e84392e728d89103d3474a7e5def0fd134b300a", "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz" ] } }, "remote_java_tools_linux": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "sha256": "ba10f09a138cf185d04cbc807d67a3da42ab13d618c5d1ce20d776e199c33a39", "urls": [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_linux-v13.4.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_linux-v13.4.zip" ] } }, "remotejdk21_win": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", "sha256": "f7cc15ca17295e69c907402dfe8db240db446e75d3b150da7bf67243cded93de", "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-win_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip", "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip" ] } }, "remotejdk21_linux_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", "sha256": "ce7df1af5d44a9f455617c4b8891443fbe3e4b269c777d8b82ed66f77167cfe0", "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64", "urls": [ "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz" ] } }, "remotejdk11_linux_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\n" } }, "remotejdk11_linux_s390x": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b", "strip_prefix": "jdk-11.0.15+10", "urls": [ "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz" ] } }, "remotejdk17_linux_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "6531cef61e416d5a7b691555c8cf2bdff689201b8a001ff45ab6740062b44313", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz" ] } }, "remotejdk17_win_arm64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\n" } }, "remotejdk11_linux": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a34b404f87a08a61148b38e1416d837189e1df7a040d949e743633daf4695a3c", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_x64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz" ] } }, "remotejdk11_macos_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\n" } }, "remotejdk17_linux_ppc64le_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\n" } }, "remotejdk17_win_arm64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "6802c99eae0d788e21f52d03cab2e2b3bf42bc334ca03cbf19f71eb70ee19f85", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip", "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip" ] } }, "remote_java_tools_darwin_arm64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "sha256": "076a7e198ad077f8c7d997986ef5102427fae6bbfce7a7852d2e080ed8767528", "urls": [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_arm64-v13.4.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_arm64-v13.4.zip" ] } }, "remotejdk17_linux_ppc64le": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "00a4c07603d0218cd678461b5b3b7e25b3253102da4022d31fc35907f21a2efd", "strip_prefix": "jdk-17.0.8.1+1", "urls": [ "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz", "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz" ] } }, "remotejdk21_linux_aarch64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\n" } }, "remotejdk11_win_arm64_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\n" } }, "local_jdk": { "bzlFile": "@@rules_java~//toolchains:local_java_repository.bzl", "ruleClassName": "_local_java_repository_rule", "attributes": { "java_home": "", "version": "", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = {RUNTIME_VERSION},\n)\n" } }, "remote_java_tools_darwin_x86_64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "sha256": "4523aec4d09c587091a2dae6f5c9bc6922c220f3b6030e5aba9c8f015913cc65", "urls": [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_x86_64-v13.4.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_x86_64-v13.4.zip" ] } }, "remote_java_tools": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "sha256": "e025fd260ac39b47c111f5212d64ec0d00d85dec16e49368aae82fc626a940cf", "urls": [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools-v13.4.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools-v13.4.zip" ] } }, "remotejdk17_linux_s390x": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "ffacba69c6843d7ca70d572489d6cc7ab7ae52c60f0852cedf4cf0d248b6fc37", "strip_prefix": "jdk-17.0.8.1+1", "urls": [ "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz", "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz" ] } }, "remotejdk17_win_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\n" } }, "remotejdk11_linux_ppc64le": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a8fba686f6eb8ae1d1a9566821dbd5a85a1108b96ad857fdbac5c1e4649fc56f", "strip_prefix": "jdk-11.0.15+10", "urls": [ "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz" ] } }, "remotejdk11_macos_aarch64": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "7632bc29f8a4b7d492b93f3bc75a7b61630894db85d136456035ab2a24d38885", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_aarch64", "urls": [ "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz", "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz" ] } }, "remotejdk21_win_toolchain_config_repo": { "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\n" } } }, "recordedRepoMappingEntries": [ [ "rules_java~", "bazel_tools", "bazel_tools" ], [ "rules_java~", "remote_java_tools", "rules_java~~toolchains~remote_java_tools" ] ] } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/Makefile000066400000000000000000000233411465037340600233270ustar00rootroot00000000000000# This is a Makefile which maintains files automatically generated but to be # shipped together with other files. # You don't have to rebuild these targets by yourself unless you develop # gRPC-Gateway itself. EXAMPLE_CLIENT_DIR=examples/internal/clients ECHO_EXAMPLE_SPEC=examples/internal/proto/examplepb/echo_service.swagger.json ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/client.go \ $(EXAMPLE_CLIENT_DIR)/echo/response.go \ $(EXAMPLE_CLIENT_DIR)/echo/configuration.go \ $(EXAMPLE_CLIENT_DIR)/echo/api_echo_service.go \ $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_simple_message.go \ $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_embedded.go ABE_EXAMPLE_SPEC=examples/internal/proto/examplepb/a_bit_of_everything.swagger.json ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/model_a_bit_of_everything_nested.go \ $(EXAMPLE_CLIENT_DIR)/abe/api_a_bit_of_everything_service.go \ $(EXAMPLE_CLIENT_DIR)/abe/client.go \ $(EXAMPLE_CLIENT_DIR)/abe/api_camel_case_service_name.go \ $(EXAMPLE_CLIENT_DIR)/abe/configuration.go \ $(EXAMPLE_CLIENT_DIR)/abe/api_echo_rpc.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_a_bit_of_everything.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_a_bit_of_everything_repeated.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_body.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_numeric_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_update_v2_request.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_message_path_enum_nested_path_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_nested_deep_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_pathenum_path_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_protobuf_field_mask.go \ $(EXAMPLE_CLIENT_DIR)/abe/response.go UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/internal/proto/examplepb/unannotated_echo_service.swagger.json UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/client.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/response.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/configuration.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/model_examplepb_unannotated_simple_message.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_unannotated_echo_service.go RESPONSE_BODY_EXAMPLE_SPEC=examples/internal/proto/examplepb/response_body_service.swagger.json RESPONSE_BODY_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/responsebody/client.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/response.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/configuration.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_body_out.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_body_out_response.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_strings.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_response_body_out.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_response_body_out_response.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/model_response_response_type.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/api_response_body_service.go GENERATE_UNBOUND_METHODS_EXAMPLE_SPEC=examples/internal/proto/examplepb/generate_unbound_methods.swagger.json GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/generateunboundmethods/client.go \ $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/response.go \ $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/configuration.go \ $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/model_examplepb_generate_unbound_methods_simple_message.go \ $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/api_generate_unbound_methods.go EXAMPLE_CLIENT_SRCS=$(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS) SWAGGER_CODEGEN=swagger-codegen $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ -l go -o examples/internal/clients/echo --additional-properties packageName=echo @rm -f $(EXAMPLE_CLIENT_DIR)/echo/README.md \ $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh $(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ -l go -o examples/internal/clients/abe --additional-properties packageName=abe @rm -f $(EXAMPLE_CLIENT_DIR)/abe/README.md \ $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh $(UNANNOTATED_ECHO_EXAMPLE_SRCS): $(UNANNOTATED_ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(UNANNOTATED_ECHO_EXAMPLE_SPEC) \ -l go -o examples/internal/clients/unannotatedecho --additional-properties packageName=unannotatedecho @rm -f $(EXAMPLE_CLIENT_DIR)/unannotatedecho/README.md \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/git_push.sh $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(RESPONSE_BODY_EXAMPLE_SPEC) \ -l go -o examples/internal/clients/responsebody --additional-properties packageName=responsebody @rm -f $(EXAMPLE_CLIENT_DIR)/responsebody/README.md \ $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS): $(GENERATE_UNBOUND_METHODS_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(GENERATE_UNBOUND_METHODS_EXAMPLE_SPEC) \ -l go -o examples/internal/clients/generateunboundmethods --additional-properties packageName=generateunboundmethods @rm -f $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/README.md \ $(EXAMPLE_CLIENT_DIR)/generateunboundmethods/git_push.sh install: go install github.com/bufbuild/buf/cmd/buf@v1.14.0 go install \ ./protoc-gen-openapiv2 \ ./protoc-gen-grpc-gateway proto: # These generation steps are run in order so that later steps can # overwrite files produced by previous steps, if necessary. buf generate # Remove generated gateway in runtime tests, causes import cycle rm ./runtime/internal/examplepb/non_standard_names.pb.gw.go # Remove generated_input.proto files, bazel genrule relies on these # *not* being generated (to avoid conflicts). rm ./examples/internal/proto/examplepb/generated_input.pb.go rm ./examples/internal/proto/examplepb/generated_input_grpc.pb.go rm ./examples/internal/proto/examplepb/generated_input.pb.gw.go buf generate \ --template ./examples/internal/proto/examplepb/openapi_merge.buf.gen.yaml \ --path ./examples/internal/proto/examplepb/openapi_merge_a.proto \ --path ./examples/internal/proto/examplepb/openapi_merge_b.proto buf generate \ --template ./examples/internal/proto/examplepb/standalone_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/unannotated_echo_service.proto mv examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go examples/internal/proto/standalone/ buf generate \ --template ./examples/internal/proto/examplepb/unannotated_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/unannotated_echo_service.proto buf generate \ --template ./examples/internal/proto/examplepb/generate_unbound_methods.buf.gen.yaml \ --path examples/internal/proto/examplepb/generate_unbound_methods.proto buf generate \ --template ./examples/internal/proto/examplepb/use_go_template.buf.gen.yaml \ --path examples/internal/proto/examplepb/use_go_template.proto buf generate \ --template ./examples/internal/proto/examplepb/ignore_comment.buf.gen.yaml \ --path examples/internal/proto/examplepb/ignore_comment.proto buf generate \ --template ./examples/internal/proto/examplepb/remove_internal_comment.buf.gen.yaml \ --path examples/internal/proto/examplepb/remove_internal_comment.proto buf generate \ --template ./examples/internal/proto/examplepb/visibility_rule_preview_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/visibility_rule_echo_service.proto mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_preview_echo_service.swagger.json buf generate \ --template ./examples/internal/proto/examplepb/visibility_rule_internal_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/visibility_rule_echo_service.proto mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_internal_echo_service.swagger.json buf generate \ --template ./examples/internal/proto/examplepb/visibility_rule_none_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/visibility_rule_echo_service.proto mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_none_echo_service.swagger.json buf generate \ --template ./examples/internal/proto/examplepb/visibility_rule_preview_and_internal_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/visibility_rule_echo_service.proto mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_preview_and_internal_echo_service.swagger.json buf generate \ --template ./examples/internal/proto/examplepb/visibility_rule_enums_as_ints_echo_service.buf.gen.yaml \ --path examples/internal/proto/examplepb/visibility_rule_echo_service.proto mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_enums_as_ints_echo_service.swagger.json buf generate \ --template examples/internal/proto/examplepb/enum_with_single_value.buf.gen.yaml \ --path examples/internal/proto/examplepb/enum_with_single_value.proto generate: proto $(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS) test: proto go test -short -race ./... go test -race ./examples/internal/integration -args -network=unix -endpoint=test.sock clean: find . -type f -name '*.pb.go' -delete find . -type f -name '*.swagger.json' -delete find . -type f -name '*.pb.gw.go' -delete rm -f $(EXAMPLE_CLIENT_SRCS) .PHONY: generate test clean proto install golang-github-grpc-ecosystem-grpc-gateway-2.20.0/README.md000066400000000000000000000523351465037340600231530ustar00rootroot00000000000000

gRPC-Gateway

gRPC to JSON proxy generator following the gRPC HTTP spec

## About The gRPC-Gateway is a plugin of the Google protocol buffers compiler [protoc](https://github.com/protocolbuffers/protobuf). It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) annotations in your service definitions. This helps you provide your APIs in both gRPC and RESTful style at the same time.
## Docs You can read our docs at: - https://grpc-ecosystem.github.io/grpc-gateway/ ## Testimonials > We use the gRPC-Gateway to serve millions of API requests per day, > and have been since 2018 and through all of that, > we have never had any issues with it. > > _- William Mill, [Ad Hoc](http://adhocteam.us/)_ ## Background gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. However, you might still want to provide a traditional RESTful JSON API as well. Reasons can range from maintaining backward-compatibility, supporting languages or clients that are not well supported by gRPC, to simply maintaining the aesthetics and tooling involved with a RESTful JSON architecture. This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. ## Installation ### Compile from source The following instructions assume you are using [Go Modules](https://go.dev/wiki/Modules) for dependency management. Use a [tool dependency](https://go.dev/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module) to track the versions of the following executable packages: ```go // +build tools package tools import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) ``` Run `go mod tidy` to resolve the versions. Install by running ```sh $ go install \ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ google.golang.org/protobuf/cmd/protoc-gen-go \ google.golang.org/grpc/cmd/protoc-gen-go-grpc ``` This will place four binaries in your `$GOBIN`; - `protoc-gen-grpc-gateway` - `protoc-gen-openapiv2` - `protoc-gen-go` - `protoc-gen-go-grpc` Make sure that your `$GOBIN` is in your `$PATH`. ### Download the binaries You may alternatively download the binaries from the [GitHub releases page](https://github.com/grpc-ecosystem/grpc-gateway/releases/latest). We generate [SLSA3 signatures](slsa.dev) using the OpenSSF's [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) during the release process. To verify a release binary: 1. Install the verification tool from [slsa-framework/slsa-verifier#installation](https://github.com/slsa-framework/slsa-verifier#installation). 2. Download the provenance file `attestation.intoto.jsonl` from the [GitHub releases page](https://github.com/grpc-ecosystem/grpc-gateway/releases/latest). 3. Run the verifier: ```shell slsa-verifier -artifact-path -provenance attestation.intoto.jsonl -source github.com/grpc-ecosystem/grpc-gateway -tag ``` Alternatively, see the section on remotely managed plugin versions below. ## Usage ### 1.Define your [gRPC](https://grpc.io/docs/) service using protocol buffers `your_service.proto`: ```protobuf syntax = "proto3"; package your.service.v1; option go_package = "github.com/yourorg/yourprotos/gen/go/your/service/v1"; message StringMessage { string value = 1; } service YourService { rpc Echo(StringMessage) returns (StringMessage) {} } ``` ### 2. Generate gRPC stubs This step generates the gRPC stubs that you can use to implement the service and consume from clients: Here's an example `buf.gen.yaml` you can use to generate the stubs with [buf](https://github.com/bufbuild/buf): ```yaml version: v1 plugins: - plugin: go out: gen/go opt: - paths=source_relative - plugin: go-grpc out: gen/go opt: - paths=source_relative ``` With this file in place, you can generate your files using `buf generate`. > For a complete example of using `buf generate` to generate protobuf stubs, see > [the boilerplate repo](https://github.com/johanbrandhorst/grpc-gateway-boilerplate). > For more information on generating the stubs with buf, see > [the official documentation](https://docs.buf.build/generate-usage). If you are using `protoc` to generate stubs, here's an example of what a command might look like: ```sh protoc -I . \ --go_out ./gen/go/ --go_opt paths=source_relative \ --go-grpc_out ./gen/go/ --go-grpc_opt paths=source_relative \ your/service/v1/your_service.proto ``` ### 3. Implement your service in gRPC as usual. ### 4. Generate reverse-proxy using `protoc-gen-grpc-gateway` At this point, you have 3 options: - no further modifications, use the default mapping to HTTP semantics (method, path, etc.) - this will work on any `.proto` file, but will not allow setting HTTP paths, request parameters or similar - additional `.proto` modifications to use a custom mapping - relies on parameters in the `.proto` file to set custom HTTP mappings - no `.proto` modifications, but use an external configuration file - relies on an external configuration file to set custom HTTP mappings - mostly useful when the source proto file isn't under your control #### 1. Using the default mapping This requires no additional modification to the `.proto` file but does require enabling a specific option when executing the plugin. The `generate_unbound_methods` should be enabled. Here's what a `buf.gen.yaml` file might look like with this option enabled: ```yaml version: v1 plugins: - plugin: go out: gen/go opt: - paths=source_relative - plugin: go-grpc out: gen/go opt: - paths=source_relative - plugin: grpc-gateway out: gen/go opt: - paths=source_relative - generate_unbound_methods=true ``` With `protoc` (just the grpc-gateway stubs): ```sh protoc -I . --grpc-gateway_out ./gen/go \ --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt generate_unbound_methods=true \ your/service/v1/your_service.proto ``` #### 2. With custom annotations Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) annotation to your .proto file `your_service.proto`: ```diff syntax = "proto3"; package your.service.v1; option go_package = "github.com/yourorg/yourprotos/gen/go/your/service/v1"; + +import "google/api/annotations.proto"; + message StringMessage { string value = 1; } service YourService { - rpc Echo(StringMessage) returns (StringMessage) {} + rpc Echo(StringMessage) returns (StringMessage) { + option (google.api.http) = { + post: "/v1/example/echo" + body: "*" + }; + } } ``` > You will need to provide the required third party protobuf files to the protobuf compiler. > If you are using [buf](https://github.com/bufbuild/buf), this dependency can > be added to the `deps` array in your `buf.yaml` under the name > `buf.build/googleapis/googleapis`: > > ```yaml > version: v1 > name: buf.build/yourorg/myprotos > deps: > - buf.build/googleapis/googleapis > ``` > > Always run `buf mod update` after adding a dependency to your `buf.yaml`. See [a_bit_of_everything.proto](examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples of more annotations you can add to customize gateway behavior and generated OpenAPI output. Here's what a `buf.gen.yaml` file might look like: ```yaml version: v1 plugins: - plugin: go out: gen/go opt: - paths=source_relative - plugin: go-grpc out: gen/go opt: - paths=source_relative - plugin: grpc-gateway out: gen/go opt: - paths=source_relative ``` If you are using `protoc` to generate stubs, you need to ensure the required dependencies are available to the compiler at compile time. These can be found by manually cloning and copying the relevant files from the [googleapis repository](https://github.com/googleapis/googleapis), and providing them to `protoc` when running. The files you will need are: ``` google/api/annotations.proto google/api/field_behavior.proto google/api/http.proto google/api/httpbody.proto ``` Here's what a `protoc` execution might look like: ```sh protoc -I . --grpc-gateway_out ./gen/go \ --grpc-gateway_opt paths=source_relative \ your/service/v1/your_service.proto ``` #### 3. External configuration If you do not want to (or cannot) modify the proto file for use with gRPC-Gateway you can alternatively use an external [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/grpc_api_configuration/) for more information. This is best combined with the `standalone=true` option to generate a file that can live in its own package, separate from the files generated by the source protobuf file. Here's what a `buf.gen.yaml` file might look like with this option enabled: ```yaml version: v1 plugins: - plugin: go out: gen/go opt: - paths=source_relative - plugin: go-grpc out: gen/go opt: - paths=source_relative - plugin: grpc-gateway out: gen/go opt: - paths=source_relative - grpc_api_configuration=path/to/config.yaml - standalone=true ``` With `protoc` (just the grpc-gateway stubs): ```sh protoc -I . --grpc-gateway_out ./gen/go \ --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt grpc_api_configuration=path/to/config.yaml \ --grpc-gateway_opt standalone=true \ your/service/v1/your_service.proto ``` ### 5. Write an entrypoint for the HTTP reverse-proxy server ```go package main import ( "context" "flag" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" gw "github.com/yourorg/yourrepo/proto/gen/go/your/service/v1/your_service" // Update ) var ( // command-line options: // gRPC server endpoint grpcServerEndpoint = flag.String("grpc-server-endpoint", "localhost:9090", "gRPC server endpoint") ) func run() error { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() // Register gRPC server endpoint // Note: Make sure the gRPC server is running properly and accessible mux := runtime.NewServeMux() opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) if err != nil { return err } // Start HTTP server (and proxy calls to gRPC server endpoint) return http.ListenAndServe(":8081", mux) } func main() { flag.Parse() if err := run(); err != nil { grpclog.Fatal(err) } } ``` ### 6. (Optional) Generate OpenAPI definitions using `protoc-gen-openapiv2` Here's what a `buf.gen.yaml` file might look like: ```yaml version: v1 plugins: - plugin: go out: gen/go opt: - paths=source_relative - plugin: go-grpc out: gen/go opt: - paths=source_relative - plugin: grpc-gateway out: gen/go opt: - paths=source_relative - plugin: openapiv2 out: gen/openapiv2 ``` To use the custom protobuf annotations supported by `protoc-gen-openapiv2`, we need another dependency added to our protobuf generation step. If you are using `buf`, you can add the `buf.build/grpc-ecosystem/grpc-gateway` dependency to your `deps` array: ```yaml version: v1 name: buf.build/yourorg/myprotos deps: - buf.build/googleapis/googleapis - buf.build/grpc-ecosystem/grpc-gateway ``` With `protoc` (just the swagger file): ```sh protoc -I . --openapiv2_out ./gen/openapiv2 \ your/service/v1/your_service.proto ``` If you are using `protoc` to generate stubs, you will need to copy the protobuf files from the `protoc-gen-openapiv2/options` directory of this repository, and providing them to `protoc` when running. Note that this plugin also supports generating OpenAPI definitions for unannotated methods; use the `generate_unbound_methods` option to enable this. It is possible with the HTTP mapping for a gRPC service method to create duplicate mappings with the only difference being constraints on the path parameter. `/v1/{name=projects/*}` and `/v1/{name=organizations/*}` both become `/v1/{name}`. When this occurs the plugin will rename the path parameter with a "\_1" (or "\_2" etc) suffix to differentiate the different operations. So in the above example, the 2nd path would become `/v1/{name_1=organizations/*}`. This can also cause OpenAPI clients to URL encode the "/" that is part of the path parameter as that is what OpenAPI defines in the specification. To allow gRPC gateway to accept the URL encoded slash and still route the request, use the UnescapingModeAllCharacters or UnescapingModeLegacy (which is the default currently though may change in future versions). See [Customizing Your Gateway](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_your_gateway/) for more information. ## Usage with remote plugins As an alternative to all of the above, you can use `buf` with [remote plugins](https://docs.buf.build/configuration/v1/buf-gen-yaml#name-or-remote) to manage plugin versions and generation. An example `buf.gen.yaml` using remote plugin generation looks like this: ```yaml version: v1 plugins: - plugin: buf.build/protocolbuffers/go:v1.31.0 out: gen/go opt: - paths=source_relative - plugin: buf.build/grpc/go:v1.3.0 out: gen/go opt: - paths=source_relative - plugin: buf.build/grpc-ecosystem/gateway:v2.16.2 out: gen/go opt: - paths=source_relative - plugin: buf.build/grpc-ecosystem/openapiv2:v2.16.2 out: gen/openapiv2 ``` This requires no local installation of any plugins. Be careful to use the same version of the generator as the runtime library, i.e. if using `v2.16.2`, run ```shell $ go get github.com/grpc-ecosystem/grpc-gateway/v2@v2.16.2 ``` To get the same version of the runtime in your `go.mod`. Note that usage of remote plugins is incompatible with usage of external configuration files like [grpc_api_configuration](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/grpc_api_configuration/#using-an-external-configuration-file). ## Video intro This GopherCon UK 2019 presentation from our maintainer [@JohanBrandhorst](https://github.com/johanbrandhorst) provides a good intro to using the gRPC-Gateway. It uses the following boilerplate repo as a base: https://github.com/johanbrandhorst/grpc-gateway-boilerplate.
## Parameters and flags When using `buf` to generate stubs, flags and parameters are passed through the `opt` field in your `buf.gen.yaml` file, for example: ```yaml version: v1 plugins: - plugin: grpc-gateway out: gen/go opt: - paths=source_relative - grpc_api_configuration=path/to/config.yaml - standalone=true ``` During code generation with `protoc`, flags to gRPC-Gateway tools must be passed through `protoc` using one of 2 patterns: - as part of the `--_out` `protoc` parameter: `--_out=:` ```sh --grpc-gateway_out=repeated_path_param_separator=ssv:. --openapiv2_out=repeated_path_param_separator=ssv:. ``` - using additional `--_opt` parameters: `--_opt=[,]*` ```sh --grpc-gateway_opt repeated_path_param_separator=ssv --openapiv2_opt repeated_path_param_separator=ssv ``` ## More examples More examples are available under the `examples` directory. - `proto/examplepb/echo_service.proto`, `proto/examplepb/a_bit_of_everything.proto`, `proto/examplepb/unannotated_echo_service.proto`: service definition - `proto/examplepb/echo_service.pb.go`, `proto/examplepb/a_bit_of_everything.pb.go`, `proto/examplepb/unannotated_echo_service.pb.go`: [generated] stub of the service - `proto/examplepb/echo_service.pb.gw.go`, `proto/examplepb/a_bit_of_everything.pb.gw.go`, `proto/examplepb/uannotated_echo_service.pb.gw.go`: [generated] reverse proxy for the service - `proto/examplepb/unannotated_echo_service.yaml`: gRPC API Configuration for `unannotated_echo_service.proto` - `server/main.go`: service implementation - `main.go`: entrypoint of the generated reverse proxy To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-Gateway, and a gRPC server, see [this example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://web.archive.org/web/20201112010739/https://coreos.com/blog/grpc-protobufs-swagger.html)). [This example by neiro.ai](https://github.com/mynalabsai/grpc_gateway_media_example) (and its accompanying [blog post](https://medium.com/neiro-ai/grpc-gateway-for-media-api-by-neiro-9033caab12c8)) shows how mediafiles using `multipart/form-data` can be integrated into rpc messages using a middleware. ## Features ### Supported - Generating JSON API handlers. - Method parameters in the request body. - Method parameters in the request path. - Method parameters in the query string. - Enum fields in the path parameter (including repeated enum fields). - Mapping streaming APIs to newline-delimited JSON streams. - Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) - Optionally emitting API definitions for [OpenAPI (Swagger) v2](https://swagger.io/docs/specification/2-0/basic-structure/). - Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests) through inbound HTTP `Grpc-Timeout` header. - Partial support for [gRPC API Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) files as an alternative to annotation. - Automatically translating PATCH requests into Field Mask gRPC requests. See [the docs](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/patch_feature/) for more information. ### No plan to support But patches are welcome. - Method parameters in HTTP headers. - Handling trailer metadata. - Encoding request/response body in XML. - True bi-directional streaming. ## Mapping gRPC to HTTP - [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/runtime/errors.go#L15). - HTTP request source IP is added as `X-Forwarded-For` gRPC request header. - HTTP request host is added as `X-Forwarded-Host` gRPC request header. - HTTP `Authorization` header is added as `authorization` gRPC request header. - Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml)) are prefixed with `grpcgateway-` and added with their values to gRPC request header. - HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`). - While configurable, the default {un,}marshaling uses [protojson](https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson). - The path template used to map gRPC service methods to HTTP endpoints supports the [google.api.http](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) path template syntax. For example, `/api/v1/{name=projects/*/topics/*}` or `/prefix/{path=organizations/**}`. ## Contribution See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/main/CONTRIBUTING.md). ## License gRPC-Gateway is licensed under the BSD 3-Clause License. See [LICENSE](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE) for more details. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/WORKSPACE000066400000000000000000000074741465037340600231610ustar00rootroot00000000000000workspace(name = "grpc_ecosystem_grpc_gateway") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "com_google_googletest", sha256 = "1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4", strip_prefix = "googletest-1.14.0", urls = ["https://github.com/google/googletest/archive/v1.14.0.zip"], ) # Define before rules_proto, otherwise we receive the version of com_google_protobuf from there http_archive( name = "com_google_protobuf", sha256 = "4fc5ff1b2c339fb86cd3a25f0b5311478ab081e65ad258c6789359cd84d421f8", strip_prefix = "protobuf-26.1", urls = ["https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz"], ) http_archive( name = "googleapis", sha256 = "180b98abd48ba6f047e590a3d4a684aecbeb6f43e59262437d0ed5d22b42f7f9", strip_prefix = "googleapis-61a066c96af685a0190603e0c1e09ac1adb25ef0", urls = [ "https://github.com/googleapis/googleapis/archive/61a066c96af685a0190603e0c1e09ac1adb25ef0.zip", ], ) load("@googleapis//:repository_rules.bzl", "switched_rules_by_language") switched_rules_by_language( name = "com_google_googleapis_imports", ) http_archive( name = "bazel_skylib", sha256 = "9f38886a40548c6e96c106b752f242130ee11aaa068a56ba7e56f4511f33e4f2", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz", ], ) load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() http_archive( name = "rules_proto", sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", strip_prefix = "rules_proto-5.3.0-21.7", urls = [ "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", ], ) load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() http_archive( name = "io_bazel_rules_go", sha256 = "f74c98d6df55217a36859c74b460e774abc0410a47cc100d822be34d5f990f16", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.47.1/rules_go-v0.47.1.zip", "https://github.com/bazelbuild/rules_go/releases/download/v0.47.1/rules_go-v0.47.1.zip", ], ) load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(version = "1.20.6") http_archive( name = "bazel_gazelle", sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz", "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz", ], ) load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") # Use gazelle to declare Go dependencies in Bazel. # gazelle:repository_macro repositories.bzl%go_repositories load("//:repositories.bzl", "go_repositories") go_repositories() # This must be invoked after our explicit dependencies # See https://github.com/bazelbuild/bazel-gazelle/issues/1115. gazelle_dependencies() load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() http_archive( name = "com_github_bazelbuild_buildtools", sha256 = "60a9025072ae237f325d0e7b661e1685f34922c29883888c2d06f5789462b939", strip_prefix = "buildtools-7.1.1", urls = ["https://github.com/bazelbuild/buildtools/archive/v7.1.1.tar.gz"], ) load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") buildifier_dependencies() golang-github-grpc-ecosystem-grpc-gateway-2.20.0/bin/000077500000000000000000000000001465037340600224345ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/bin/.gitignore000066400000000000000000000001221465037340600244170ustar00rootroot00000000000000/protoc-gen-go /protoc-gen-go-grpc /protoc-gen-grpc-gateway /protoc-gen-openapiv2 golang-github-grpc-ecosystem-grpc-gateway-2.20.0/buf.gen.yaml000066400000000000000000000007461465037340600241030ustar00rootroot00000000000000version: v1 plugins: - plugin: buf.build/protocolbuffers/go:v1.28.1 revision: 4 out: . opt: - paths=source_relative - plugin: buf.build/grpc/go:v1.2.0 revision: 4 out: . opt: - paths=source_relative - require_unimplemented_servers=false - plugin: grpc-gateway out: . opt: - paths=source_relative - allow_repeated_fields_in_body=true - plugin: openapiv2 out: . opt: - allow_repeated_fields_in_body=true golang-github-grpc-ecosystem-grpc-gateway-2.20.0/buf.lock000066400000000000000000000002471465037340600233150ustar00rootroot00000000000000# Generated by buf. DO NOT EDIT. version: v1 deps: - remote: buf.build owner: googleapis repository: googleapis commit: 62f35d8aed1149c291d606d958a7ce32 golang-github-grpc-ecosystem-grpc-gateway-2.20.0/buf.yaml000066400000000000000000000253301465037340600233270ustar00rootroot00000000000000version: v1 name: buf.build/grpc-ecosystem/grpc-gateway deps: - buf.build/googleapis/googleapis breaking: use: - FILE lint: use: - DEFAULT ignore_only: DIRECTORY_SAME_PACKAGE: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/use_go_template.proto - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto ENUM_VALUE_PREFIX: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/pathenum/path_enum.proto - protoc-gen-openapiv2/options/openapiv2.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/proto3.proto ENUM_ZERO_VALUE_SUFFIX: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/pathenum/path_enum.proto - protoc-gen-openapiv2/options/openapiv2.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/proto3.proto FIELD_LOWER_SNAKE_CASE: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/non_standard_names.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/non_standard_names.proto PACKAGE_DIRECTORY_MATCH: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/use_go_template.proto - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto - examples/internal/proto/oneofenum/oneof_enum.proto - examples/internal/proto/pathenum/path_enum.proto - examples/internal/proto/sub/message.proto - examples/internal/proto/sub2/message.proto - internal/descriptor/apiconfig/apiconfig.proto - internal/descriptor/openapiconfig/openapiconfig.proto - protoc-gen-openapiv2/options/annotations.proto - protoc-gen-openapiv2/options/openapiv2.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/non_standard_names.proto - runtime/internal/examplepb/proto2.proto - runtime/internal/examplepb/proto3.proto PACKAGE_SAME_GO_PACKAGE: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/use_go_template.proto - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/non_standard_names.proto - runtime/internal/examplepb/proto2.proto - runtime/internal/examplepb/proto3.proto PACKAGE_VERSION_SUFFIX: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/enum_with_single_value.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/use_go_template.proto - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto - examples/internal/proto/oneofenum/oneof_enum.proto - examples/internal/proto/pathenum/path_enum.proto - examples/internal/proto/sub/message.proto - examples/internal/proto/sub2/message.proto - internal/descriptor/apiconfig/apiconfig.proto - internal/descriptor/openapiconfig/openapiconfig.proto - protoc-gen-openapiv2/options/annotations.proto - protoc-gen-openapiv2/options/openapiv2.proto - runtime/internal/examplepb/example.proto - runtime/internal/examplepb/non_standard_names.proto - runtime/internal/examplepb/proto2.proto - runtime/internal/examplepb/proto3.proto RPC_REQUEST_RESPONSE_UNIQUE: - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/wrappers.proto RPC_REQUEST_STANDARD_NAME: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/wrappers.proto - runtime/internal/examplepb/non_standard_names.proto RPC_RESPONSE_STANDARD_NAME: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/echo_service.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/generate_unbound_methods.proto - examples/internal/proto/examplepb/generated_input.proto - examples/internal/proto/examplepb/non_standard_names.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto - examples/internal/proto/examplepb/response_body_service.proto - examples/internal/proto/examplepb/stream.proto - examples/internal/proto/examplepb/unannotated_echo_service.proto - examples/internal/proto/examplepb/visibility_rule_echo_service.proto - examples/internal/proto/examplepb/use_go_template.proto - examples/internal/proto/examplepb/ignore_comment.proto - examples/internal/proto/examplepb/remove_internal_comment.proto - examples/internal/proto/examplepb/wrappers.proto - runtime/internal/examplepb/non_standard_names.proto SERVICE_PASCAL_CASE: - examples/internal/proto/examplepb/a_bit_of_everything.proto SERVICE_SUFFIX: - examples/internal/helloworld/helloworld.proto - examples/internal/proto/examplepb/a_bit_of_everything.proto - examples/internal/proto/examplepb/flow_combination.proto - examples/internal/proto/examplepb/openapi_merge_a.proto - examples/internal/proto/examplepb/openapi_merge_b.proto allow_comment_ignores: true # Note: the build configuration goes last in this # files so we can append excludes at push time. build: excludes: - bazel-grpc-gateway golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/000077500000000000000000000000001465037340600226145ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/.gitignore000066400000000000000000000000741465037340600246050ustar00rootroot00000000000000*.gem .bundle .ruby-version .jekyll-cache .sass-cache _site golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/Gemfile000066400000000000000000000006731465037340600241150ustar00rootroot00000000000000source "https://rubygems.org" gem "just-the-docs" group :jekyll_plugins do gem "github-pages" # GitHub Pages gem "jekyll-optional-front-matter" # GitHub Pages gem "jekyll-default-layout" # GitHub Pages gem "jekyll-titles-from-headings" # GitHub Pages gem "jekyll-readme-index" # GitHub Pages gem "jekyll-relative-links" # GitHub Pages gem 'jekyll-include-cache' # GitHub Pages end golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/Gemfile.lock000066400000000000000000000170071465037340600250430ustar00rootroot00000000000000GEM remote: https://rubygems.org/ specs: activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.11.1) colorator (1.1.0) commonmarker (0.17.13) ruby-enum (~> 0.5) concurrent-ruby (1.2.3) dnsruby (1.70.0) simpleidn (~> 0.2.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.8.1) faraday (2.7.10) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) ffi (1.16.3) forwardable-extended (2.6.0) gemoji (3.0.1) github-pages (222) github-pages-health-check (= 1.17.9) jekyll (= 3.9.0) jekyll-avatar (= 0.7.0) jekyll-coffeescript (= 1.1.1) jekyll-commonmark-ghpages (= 0.1.6) jekyll-default-layout (= 0.1.4) jekyll-feed (= 0.15.1) jekyll-gist (= 1.5.0) jekyll-github-metadata (= 2.13.0) jekyll-mentions (= 1.6.0) jekyll-optional-front-matter (= 0.3.2) jekyll-paginate (= 1.1.0) jekyll-readme-index (= 0.3.0) jekyll-redirect-from (= 0.16.0) jekyll-relative-links (= 0.6.1) jekyll-remote-theme (= 0.4.3) jekyll-sass-converter (= 1.5.2) jekyll-seo-tag (= 2.7.1) jekyll-sitemap (= 1.4.0) jekyll-swiss (= 1.0.0) jekyll-theme-architect (= 0.2.0) jekyll-theme-cayman (= 0.2.0) jekyll-theme-dinky (= 0.2.0) jekyll-theme-hacker (= 0.2.0) jekyll-theme-leap-day (= 0.2.0) jekyll-theme-merlot (= 0.2.0) jekyll-theme-midnight (= 0.2.0) jekyll-theme-minimal (= 0.2.0) jekyll-theme-modernist (= 0.2.0) jekyll-theme-primer (= 0.6.0) jekyll-theme-slate (= 0.2.0) jekyll-theme-tactile (= 0.2.0) jekyll-theme-time-machine (= 0.2.0) jekyll-titles-from-headings (= 0.5.3) jemoji (= 0.12.0) kramdown (= 2.3.1) kramdown-parser-gfm (= 1.1.0) liquid (= 4.0.3) mercenary (~> 0.3) minima (= 2.5.1) nokogiri (>= 1.12.5, < 2.0) rouge (= 3.26.0) terminal-table (~> 1.4) github-pages-health-check (1.17.9) addressable (~> 2.3) dnsruby (~> 1.60) octokit (~> 4.0) public_suffix (>= 3.0, < 5.0) typhoeus (~> 1.3) html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) i18n (0.9.5) concurrent-ruby (~> 1.0) jekyll (3.9.0) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 0.7) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 2.0) kramdown (>= 1.17, < 3) liquid (~> 4.0) mercenary (~> 0.3.3) pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) jekyll-avatar (0.7.0) jekyll (>= 3.0, < 5.0) jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) jekyll-commonmark (1.3.1) commonmarker (~> 0.14) jekyll (>= 3.7, < 5.0) jekyll-commonmark-ghpages (0.1.6) commonmarker (~> 0.17.6) jekyll-commonmark (~> 1.2) rouge (>= 2.0, < 4.0) jekyll-default-layout (0.1.4) jekyll (~> 3.0) jekyll-feed (0.15.1) jekyll (>= 3.7, < 5.0) jekyll-gist (1.5.0) octokit (~> 4.2) jekyll-github-metadata (2.13.0) jekyll (>= 3.4, < 5.0) octokit (~> 4.0, != 4.4.0) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) jekyll-mentions (1.6.0) html-pipeline (~> 2.3) jekyll (>= 3.7, < 5.0) jekyll-optional-front-matter (0.3.2) jekyll (>= 3.0, < 5.0) jekyll-paginate (1.1.0) jekyll-readme-index (0.3.0) jekyll (>= 3.0, < 5.0) jekyll-redirect-from (0.16.0) jekyll (>= 3.3, < 5.0) jekyll-relative-links (0.6.1) jekyll (>= 3.3, < 5.0) jekyll-remote-theme (0.4.3) addressable (~> 2.0) jekyll (>= 3.5, < 5.0) jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) rubyzip (>= 1.3.0, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) jekyll-seo-tag (2.7.1) jekyll (>= 3.8, < 5.0) jekyll-sitemap (1.4.0) jekyll (>= 3.7, < 5.0) jekyll-swiss (1.0.0) jekyll-theme-architect (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-cayman (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-dinky (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-hacker (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-leap-day (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-merlot (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-midnight (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-minimal (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-modernist (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-primer (0.6.0) jekyll (> 3.5, < 5.0) jekyll-github-metadata (~> 2.9) jekyll-seo-tag (~> 2.0) jekyll-theme-slate (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-tactile (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-theme-time-machine (0.2.0) jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) jekyll-titles-from-headings (0.5.3) jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) jemoji (0.12.0) gemoji (~> 3.0) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) just-the-docs (0.8.2) jekyll (>= 3.8.5) jekyll-include-cache jekyll-seo-tag (>= 2.0) rake (>= 12.3.1) kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liquid (4.0.3) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) mini_portile2 (2.8.6) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.19.0) nokogiri (1.16.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.7) racc (1.7.3) rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.6) rouge (3.26.0) ruby-enum (0.9.0) i18n ruby2_keywords (0.0.5) rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) simpleidn (0.2.1) unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (1.2.11) thread_safe (~> 0.1) unf (0.1.4) unf_ext unf_ext (0.0.8.2) unicode-display_width (1.8.0) zeitwerk (2.6.11) PLATFORMS ruby DEPENDENCIES github-pages jekyll-default-layout jekyll-include-cache jekyll-optional-front-matter jekyll-readme-index jekyll-relative-links jekyll-titles-from-headings just-the-docs BUNDLED WITH 2.1.4 golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/_config.yml000066400000000000000000000076141465037340600247530ustar00rootroot00000000000000# Site settings # These are used to personalize your new site. If you look in the HTML files, # you will see them accessed via {{ site.title }}, {{ site.github_repo }}, and so on. # You can create any custom variable you would like, and they will be accessible # in the templates via {{ site.myvariable }}. title: gRPC-Gateway description: gRPC-Gateway Documentation Website baseurl: "/grpc-gateway" # the subpath of your site, e.g. /blog url: "https://grpc-ecosystem.github.io" # the base hostname & protocol for your site, e.g. http://example.com repository: grpc-ecosystem/grpc-gateway remote_theme: pmarsceill/just-the-docs@v0.6.2 permalink: pretty exclude: ["run.sh"] # Set a path/url to a logo that will be displayed instead of the title #logo: "/assets/images/grpc-gateway.png" # Enable or disable the site search # Supports true (default) or false search_enabled: true search: # Split pages into sections that can be searched individually # Supports 1 - 6, default: 2 heading_level: 2 # Maximum amount of previews per search result # Default: 3 previews: 2 # Maximum amount of words to display before a matched word in the preview # Default: 5 preview_words_before: 3 # Maximum amount of words to display after a matched word in the preview # Default: 10 preview_words_after: 3 # Set the search token separator # Default: /[\s\-/]+/ # Example: enable support for hyphenated search words tokenizer_separator: /[\s/]+/ # Display the relative url in search results # Supports true (default) or false rel_url: true # Enable or disable the search button that appears in the bottom right corner of every page # Supports true or false (default) button: false # Enable or disable heading anchors heading_anchors: true # Aux links for the upper right navigation aux_links: "gRPC-Gateway on GitHub": - "https://github.com/grpc-ecosystem/grpc-gateway" # Makes Aux links open in a new tab. Default is false aux_links_new_tab: false # Sort order for navigation links # nav_sort: case_insensitive # default, equivalent to nil nav_sort: case_sensitive # Capital letters sorted before lowercase # Footer content # appears at the bottom of every page's main content # Back to top link back_to_top: true back_to_top_text: "Back to top" footer_content: 'Copyright © the gRPC-Gateway Authors. Distributed by a BSD 3-Clause License.' # Footer last edited timestamp last_edit_timestamp: true # show or hide edit time - page must have `last_modified_date` defined in the frontmatter last_edit_time_format: "%b %e %Y at %I:%M %p" # uses ruby's time format: https://ruby-doc.org/stdlib-2.7.0/libdoc/time/rdoc/Time.html # Footer "Edit this page on GitHub" link text gh_edit_link: true # show or hide edit this page link gh_edit_link_text: "Edit this page on GitHub" gh_edit_repository: "https://github.com/grpc-ecosystem/grpc-gateway" # the github URL for your repo gh_edit_branch: "main" # the branch that your docs is served from gh_edit_source: docs # the source that your files originate from gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately # Color scheme currently only supports "dark", "light"/nil (default), or a custom scheme that you define color_scheme: nil # Disqus Comments # disqus: # Leave shortname blank to disable comments site-wide. # Enable comments for any post by adding `comments: true` to that post's YAML Front Matter. # shortname: # Google Analytics Tracking # e.g, UA-1234567-89 # ga_tracking: # ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings (true/nil by default) plugins: - jekyll-seo-tag - jekyll-include-cache kramdown: syntax_highlighter_opts: block: line_numbers: false compress_html: clippings: all comments: all endings: all startings: [] blanklines: false profile: false # ignore: # envs: all golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/_layouts/000077500000000000000000000000001465037340600244535ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/_layouts/default.html000066400000000000000000000212701465037340600267670ustar00rootroot00000000000000--- layout: table_wrappers --- {% include head.html %} Link Search Menu Expand Document
{% if site.search_enabled != false %} {% endif %} {% if site.aux_links %} {% endif %}
{% unless page.url == "/" %} {% if page.parent %} {% endif %} {% endunless %}
{% if site.heading_anchors != false %} {% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %} {% else %} {{ content }} {% endif %} {% if page.has_children == true and page.has_toc != false %}

Table of contents

    {%- assign children_list = pages_list | where: "parent", page.title | where: "grand_parent", page.parent -%} {% for child in children_list %}
  • {{ child.title }}{% if child.summary %} - {{ child.summary }}{% endif %}
  • {% endfor %}
{% endif %} {% if site.footer_content != nil or site.last_edit_timestamp or site.gh_edit_link %}
{% if site.back_to_top %}

{{ site.back_to_top_text }}

{% endif %} {% if site.footer_content != nil %}

{{ site.footer_content }}

{% endif %} {% if site.last_edit_timestamp or site.gh_edit_link %}
{% if site.last_edit_timestamp and site.last_edit_time_format and page.last_modified_date %}

Page last modified: {{ page.last_modified_date | date: site.last_edit_time_format }}.

{% endif %} {% if site.gh_edit_link and site.gh_edit_link_text and site.gh_edit_repository and site.gh_edit_branch and site.gh_edit_view_mode %}

{{ site.gh_edit_link_text }}

{% endif %}
{% endif %} {% if site.disqus.shortname %} {% include comments.html %} {% endif %}
{% endif %}
{% if site.search_enabled != false %} {% if site.search.button %} {% endif %}
{% endif %}
golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/assets/000077500000000000000000000000001465037340600241165ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/assets/images/000077500000000000000000000000001465037340600253635ustar00rootroot00000000000000architecture_introduction_diagram.svg000066400000000000000000001347471465037340600350140ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/assets/imagesgolang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/assets/images/gotemplates/000077500000000000000000000000001465037340600277075ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/assets/images/gotemplates/postman.png000066400000000000000000001447631465037340600321150ustar00rootroot00000000000000PNG  IHDRTS'sRGBgAMA a pHYsodɈIDATx^@G* ,(c%QczL13FSMIo[1DDAEDD X@oUr׽ٽ-sfv-QY*Q%1BDDDDDDDd&TĀ P!"""""""2CP9ڵ;){+."""""""<-TjΏ`eS) DDDDDDDt߱PWYH bU>(lZ¢+ JbÍPi:iش kqз >[5EX6{sp}d9V}Zcc%-^q,LJڝ#soa|&""""""M%[:aX6 dB=󡺢deG>(Nuq-Xh# (u(g+WP 8Z^:o9n]c (ːjX9j4X0BDDDDDDtd _` ; B}8n¢u(5ҎaqUd1z􀥕ȅ*=RCi7Y\قcQa/,ԟ+>[G`V5R6"NFDDDDDDDwWq#/Rc`Ѱ.LU _yQ|MylڍJbQrh ?˜(0cNˎ >xa _C,|8 =>9l5kp,#EI( lgh 8 J } w\[uImX vnFo15հr؍Ia*)yxEyΉfpN)e?2t^%aJGJByZ2و讫| [~ދ~E ;Ą'kV,j]v(d ƍkt9 ! "*E`׿#g*F??{X4z voCkX!>&b;X6 X.9VՅPrFr7h%17:NdPU38I u#_oy1n0ȅ_7PRZT A~PE|mWaJ&Tu%K- 䤻ɿlR-e2֯Ƣx*Gp)b)ü0(x!"""""""zT]@y, YOpmol[C@RC~-@7 pm(۟-/-ۂ)$lۆm'ě3bl={a0p}FZ(nZzPe"=P0"puaurڲ=,A?!V¢Vp? Q{ 1 [`MuDa^j؈di N-~^Y'asaf5 kgOiOCvSϧYP<"""""""ZCbNs S,k~s- &b}ƻx*q5f-N{L E㝮ba a*MiDDDDDDDt7T2Be;F?#=Hyg#V?=C) Q۾f`@_"""""""1r|st#d1؋,dC &}$wҠ:J~"""""""߱OUPe#j͏]8Mжu>c3d+$""""""*UF~x1>LÀ  """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L B-PM|2 q Tfii5jVZJiT`JAAU& DDDDDDDD2Jk׮UT)7rT^"""""""zh\~] 8::*) (|bÒ{RCi-,,1""""""""-?DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀm%'bI,2/n'} D(J^2>sS2ǧ!s3q XZT;)"""""""u%##[, :Ė>- 'C]|~T}DDDDDDDTnC@E 'ODcB1ʢKK^1²y)VRtC|#5 nMGxJ̠rx@Sef4mWL +Y7h iK>$x.FJ-GRhfӓ0}&@ex9DDDDDDDt36bۊ b⎮$ts16hu]]!.qJW1X3G .Lf=D LLF-Tcf/=E!s=Dv-i4jbuBjC#ri8_V&@oJg}NZKDDDDDDDWTLt[Z^LPd<1b̸ېn4 >cUj&f)M5|4JӤg1Jus<@fc,3*L|A9 ԶQ V3Lӭ7&-q˷Vj2^Jvv6իWV YYaZJ4AR jbzd)KmCfO^$>V2 iT ;no-Va$]D&yD5p1&VTj5DDDDDDD .ITZ>C))"Ief"14Xzz -o>R)(0m>iЦPJq*caqQANL+2NDDDDDDDRo;g DX>c4p5ׇnIvyݍ,L0J}bKewG<|2(DDDDDDDt{0BDDDDDDDd&TĀ P!"""""""2SKKK)|b,JdZ5jׯ_WR\R,NI1B-PM|2^ ,,,`oo/ bϝTP!""""""""C|(-P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L 1DZx\;ک͂mWUr;18,>|RF1ݢ?9ݞ +k=4HVa@qhw;{xF$7!wbۘ[XĝVC*Q}XU뫲r%F1T*0sB/) Ǹ@R$sڵk:Ĩ#(W`ߊxg'%o'5#)%)x]-_rgJRlcdg)Tpm8ꁧ@P&X3_e>o#;0BaOO 󫏱L& ɯz?vJ8ԆT[YĔ[CGA};/V/=sql,a%ZYڠYÊ?DJ8y 1g;ol4Z8l`m8:֒֏ٛVkݾnVi4~< sgc R:ai wT^[آ3}=Y$+Qa0>wq{'#L6s>^ruBϧߔ`{Ų)$UZ*d`2 B0hA>8 ]',^a؄6"4T:vM7>{Jau8\L4&a?l]|S8Nwt6AH3X ҂>vY\wj_ j\qzr-93'tCG|1gA09Sq-fYe ujw6¯99Š~ԻؐLc!$*[Ipld>5e"5'6/=r[#`emrZĘA6-,cv[ Z8{B:m7bZ952R^=X WP<s++Xו[xԲ ks7&Wm9:u^|^[cO~b{)geSI\pLuz/^-N>F3 k|}{zpL3ÿٍ&"+k4) FFFK?5~0*Xt)-cZ?:5~'OJ {nt #z vi1V r\[O3&. K~7Fkj' }ir4sމ=+f"+ب+X^9ǼxMsLUxk׫Tx|_AsQ{3T Χ]@W!M .2vbK ~}@`Ϣ0TS2qLO((vu%10cЗ(LV[}dWzߕc"Q>DŽ42J(nf`0J2CuΔM |ʸPBXM^"=a%ܒBޅ+ܐ* >@ܡ|2 ouGK穏nER3C>W9W.))Q_Za%taTkװcM?[tg{zMLjAUwOo5i}%c%䩥wğS_\KW[X\zcS_V'GV+S_Vۨx A)D*CCWF %;X؇` &Ky:\sN7ׅСz~iF#^=3U]u3zl{F8RG~+|m۪'|#}Ǘ=CYYH^lu3橯8N=-%C1q>;W~a/;jzG8poQ曪=*>/xwPO-VF1wڷ;~ʹu,~mW/{]8~#bǏ(dv7xtzA=;D n1f޹C޼}_I#RǼc!Uz_=dqA+_>h ·`yw%lR}^U/ϫy&tPlΫ꾯=nÿ\ oHYDܿ!8><]L%ly)!OC/,O+q;DafEe%;fU{tVH<=mF?](Pc9n[S.{L=z]$g33ϫ kI=U'wuQs׮eƫ&3WttX7fH8nW%ΩcUT2L=zlxq՗km{!9$ozFzm|JǑzdXv.SPg1f2}M4Tf=-1Nc=n;Vw=cE=9S5Ks=~6Q_{p ̺o/f"֧e%=)\?S{KL/ t&.Kؿi^waLB}OIR9;U 52} jԿ)k;sG;]saգ:i|pgʤPO{r 7u_R2qLS?6zp}N)޹]+o0\rzbVpPK7q_~[(GY5eDz-M/D\KV>p!~لTn-փzMZDn#Gm[Bѩnn)}LuAb; :GGTȼ"/ä!`2nj!8tT\노*cmk-zVe=mŦ]0_\?ޝ9zGeY*O'?G0w n\)16[31m؊h;Nvb|a/|12VGq[YH(~}|C%H.@]cZ!-IǏI3@8fL}#TO;F0LH/6SFMjoixz+fGס\[YWGRqy Kߕޗ15L+:>2:R>==n\zØ{8mz#^i=\}Pݥ~%g+SZU:m凢td'_u7&@o:mw濈_AXo B92YLv6>?N.Z݆`u&7 Ʈ_G̡#0Tny_|OVhP:8w6q ⾫J1zG^FGvC3_a%p)bNƠJ8MV±V3{M{Iljc*[4{Uxޗw>o߅pзp?_? Ǔxi1c+Sa7Z1 h}wmRaHlXt'.ݧ)X"by5ZΖwo|'\+[ky5h.7A8E{&aP=(ƪ =|TxMRx=Fz.p]mAu~3B%Z* pKbfJ^H $4ncڦ?Vvoe%!* | ?9cS٥{1f>5uAoV&o'Z?rtB<oݺs DI(dvF'T6pQ2'88*f)9GEWF 1Ҍ4e-#u!huo Jx i'"Kc  0|NF qSL|j&<|s&V{ :>͉I_8r rkv?ݘ",{q^٠p|*Ib">wFHRBq  店ssy˥ |]4uC8M0ms4>V~*C>_"rL}Hq%G nWmo7駷y}xU:9>cV}xe89Q?SF% ~; ։.awfx+l}iq׺iRAb;˿ Iq)Lb^cs隚Oo lǕkBۦT9_STKXjSǑ6PxlѶygb%wl&`1Yn~'i'cѸ6hf|êH}yӭQOaPnر jXz6t2 mpmMgx-=~ 1yX~ƛ з?^8+,'^8PWaxj؍ feϙ I M˖*2 ): G>/#" PfD@gTΐg7;vjZL@ο1s`V6 =,1K[>">m6E!."[gU SrYbSGDر}:=aZ%C@N&~#_ tQ= Oޛn ! GzڰRu],Hmmirϛdc^o0tKlW}H;/&,_\-T d:# >sЯ'~*ٸt={ބ;tzrAמk<>?JR뜶/1P&q,0aۏbUߺH]32+c@OlUq;LNJ{@z zLͬF=ri_)u/cqjGt ~/]<GuMڥ 28{Z\==!Up&ia9Lَgؚ'O7|0=DOòM@Y-B<v ^paL ,X׆%7\–FHwL[ qqފފyΔ{M .C0z>)g 6ЉJ6P7$N\T?m\*}@{X*>*&4Cp8LVރG)SKkWf*Ա+kk~ለڍP/txo^۵by?U@:nu59[2>xRu9zC7pAFJD(_hw*mކnAL&)]~Q$搯'g [`u[mЩnXfnbR?+TJl7O`Bb"ueN.~O؉MZ\]VBU q2pn;Wk*ODYyIih@8!};\Ƽw7b3s@ r& :+1l^ |Fȓ}䏖{ JI erd *=qp%+,Q>|1D T!n$q%4nQ1$C,Pˡ0 ;| iD)`mXZұm6Wh"K&Ea{8|Zǡ&+"/5g>iB] ݓf4ʿov+38A1}RW aÀI)Axąڡq:tWهo)+& OE`wVK@`150NW="$.]}mҾS ߡ2RT+I:ݐBew*}xTdeaA>9e5 -ۊѿxJ4vDg"U.`V@_׫3=Ѯ?}i:Юaզ!Vy3L4}Z.sMw1j=c|}IJKkk2Lk Xo_yo$ wcU!tGOT>YQ֏akPv]Un]N@{v;up]P5ߏƅϣ}K_ЮƦ'&|fwxÿL2X|,~=cϫX[5pyȦ?_[Pٿ(e^ӼP}scшo M[<6o|ֿ9N8v{\_ ϧZnGAB!4+ zŢs_ # }R>hشad M78Ώ)~(HloLVaڿEϓ\s׶˛'#__FC~_ߏw ^+z[<&bh9?} s={{4\z*ucLeyy]brøut6ƏLjjyc?Oi++q*+*Rk<6}_§.1b:cG_`2K)u7\N~4|۔_pfܷoc?ay( Kg|$೑~9m+?؀iD-ϓ|LU:ڛゑSE8Rq₱js1֮c!?i 3^c .yǕ颊'aC)֓:>ߒ'=>]<&ۡKkQ1 ۔,~tlyU\A]i'%6EtmU:o<+N᝹}yX=[>OZsa`L<5&~1<§Pv=^/?C5skCJ'6?쪫GZ'^?+UeDtO_A-TؔQ}Qd!~1,;%O=и?oN r^yQj壆2#׆on&]^8{yΣ%N>>o)v-_!mrD%+Ҥ\V~r4eTRzL-Ӝ4}u׬d|tY _zuQ#5&nLIy US&1/zOmN2menmVFQ$[[+ {ݰbQ>Ѥ#$ z2#.v\>qfJ/GLSF%4v_Au\ _`ϣ[KI>ȅ0SD ǓqMm~-]&4qeTpye0LSmwVz/*{7Rz a4O9ef,=XfeLKSglaxJṂǥoSm_wo>]9{ sknh)Elt: '̈́ͧјWyeTʔdAtq>eT t $9ODeB\ӔQt3`jfNi^1Abq9,rڿaZǑDeK?]\luTk\C_r(IcN um=xh}1^uH+RċJ3 "Txq11(S%FӴG؞7W}hsJ`i}ʨ>qhip&&`ktteTd0IFWHW5JӔCnjYBbe(i%S4'M07MR*ḤjhSSK94Jl3oc$zyUK`[|zY82Z!2ydte"&JW5LӖEl*h,<&r˔J/GO;(0_og0MIZFcFo+ Bn]p='LF,UFe5T~cP4 ٌ7 #~VFM+teTKʫ4 i $?2C)⸖A^i^AI/ɐt(gXݠLNӉ0ft_ ܪ'u\L,U.e(*GP*]OP +iJ1W?ttaPGoy !+zJrJ#SFK3\VN/M0ίa2`^J\rA9*Go2Yb8MUѯjFNnH ׾^.>KWDt/OBp(*oBVr=sGTy}YS.?&7z1>W:[uCg+cTޅDDTIlj>_kA?x-LR&"T'Yc}yA5CĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""3ݗkƎ¨'8JDDDDDDDtgXʸiW`{ Mr+|عvBk2F}vЪL<S@}sQj"\AI\ѿ5QkuuRon\:gêDʋ?~O?%!qvAq_buXWoWGx޽=TuAVǕaUƉ6滫02]~ pbjܵIZ X;{F=8AT/^ xK̟!G=imkxo&kA _(C&1]`P2Q5w~7܋Ҵ7Ru)lދ!vU{8_1tVM7vTP*r/n4I< D l_O";*įAޜ\;w k~/␫,`a!|DDDDDDDBB 6U>]+*2Sgm*QJؗnTU |XԪ+8e_V$BۉI}E[q T2-#~VG|{VQe """"""zUy@%cw).~bsz"poa&Р kN?[bgc{2Ż~{6Q*vno(XbzllߝBuJiZ#}gBiVhc*Zȯa'[[\!%JWqBޱp|3LRXK4oI܎urfa[`/eaxnlolMlҲ$5 hFJ*у* J<&~oMcDHc=Xh) =Ы2F.LIωTOZ_kkkL@O+eR!?m/V|Zǎh͢2 <ջ=_ģaS#'KyT,>O@3C]f8{SEy6LBHcqCn a΢^4?!j%аWz5DDDDDDD d Y1ІA,<ЫHK8 %P ]m*z C/W8Qa[L{JXh[;#/xtD$][^VS8 [v^[v,Ujة܂^mWڐNz |"Ug[%""""""Um@J^cCIʘj6GKm! h=sJE+sjkUQ.@X;╯>DŽzQm/ψA0wqG!àP}c_-^e9e_HPiy SJ"uA:"V/S?@a+DDDDDDDtJk&nli0IGnQEQ, kV_Zڶ.i0p/Յ Muހ %aWZY\%>=Y.(cмA /4?jYՏ޻]߳\&$rI"[42o}~|*ucR%lAp򁈈!W&}5OB _hN/ы?=zD@xq"Y6V&icptلd;[ ,lQ;y00Rqb@7-v$@-]kgSo Ik9IQ";'p>;ӕǤZ7+-+!",>gq~/p:?TGUاz /AY]*kxtL,k>hS ¢PNťο'6F#q蜰HB&RSSzh֭?c7 8"EXP}y(.-IR'Uqzz4gmX_^%xe]vmqyG?W.-X߄ =?ɏ#%\˿]>RvcKd.Khn@{18q&D+Ta_‘.Q] DDDDDDD(3*Wp6- iB$0c?2JPKrK`_~=5-OТa X\{ {D;jPfs*mPLmD9$$[RNm-s'#::ZéWPj:YB ;!l_,N梮/eg#_hPBӺ7#6J pd¹khu2KX:zC8#)$*ey"jó ;Ïରl A!M0E(R$8fEY!LmJI98|Nlκ2=nCiT᦭`;w@c1x](`ͺ0ּuVz9]SLmӾjI ogxl'8+; )6m'Y*a}~9F'mC6mG`֏_a?v=hVX)GtA> <+8Pz_'AkFek` _IS,8J.Jgv( l+XϾ2 MU~v2앟0mW7-SWVh3.o vkʧߧRYBcp9XVa uhA^itGVa=(*BE\`q>%Y++1b0EGց^~:hDzhի+R2&X ӅAI2?| |7|4)iJ1OǜDDDDDDD 렾J|VMCԗ۠*$xNNEl HE덧#L"""""""'*A cѽuCԶ!V5ak?xv&qփL!""""""]nG (:-Vtn""""""ͽP!"""""""O.?DDDDDDDDTĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd&Td(dgg+cDDDDDDDD'''e *5B`9s 7n|"ۉ ""{-T%{уI<;A|#"sADDw[E"FJĀ P!"""""""2*DDDDDDDDfb@L """"""""31BDDDDDDDd;P9?>_|%BQX>[gBlIULHݲP#[;΄τW+U^o>O~چrDDtXx)hܸ1,-+wI݂K|qYO_3ݲ)z,z7V&K !e@/ʕ+_-,, \LY(Zz%vY[ò`^{b劍ز3a8t2jKԀw.UXz#D . jX]DJYXLQ|\o3"Ut$5Q.4o`gQ`UpŰv@EkTw&KJNk"kPaE}/OEز27`ok³߲;NWU}mW^N2k~P&Q'"5F-trq`FD.m ;XXw(NCDDnS@%Aқy7!6p{EA/a<"v*͏G|P:gIf[! +ђqC(e<^~1x)?~3P"2n{*ޝ1ӇyAJQw=GS\$Ŷ|JG(SUfsumG{ D-RNU@pRF 1"")RInNp Tۢ{ڡKp뇪 39V\@晪yJav,6l'wŨƵr"cnS3VR4 *=z?(]TCtn!z8{I]JpNAmirN%)-t  W4j"}5wu =O_&u._F|ËoCJu04jйHML>o0N+VSJV@r{U+K^6zˏF/iH.P4ac!*݀ |P(D 2Ba?rX4o. \ëuoaE˔ޜ7| M(]-'2f>ziP|a+`cµ*:n!zhN{%b'L\K2BH 1Rm=_VCypOW,[ ._|\rPEb˰rR$][tܘr]// ૹBYCb`Ʋ Z{A]?l1ƽI#O\a?̝I':2""YU zS{I]KMGRR:Y~f(sv%(ZƏ`(o7Wpo>}1yڳnL{Co,ƅU9,ӊY-umҶ>5vxndWjd,$ ;6{݇*UtoRV RpŲ. b ᝛p)zW-\3ի3m rvst>44>%'ĺj|ˏP1adVh$yHCV]11P.{DDTE,el4nfDwruη TlYѹYx_I&qAH:OzC>"{JE"FJ>v{!6Ʒtq_5JDDDDt0BDDtC~VpJp7k< } A+| bSy"""" z*Dw7"2DDt*DDDDDDDDU""""""""31BDDDDDDDd&TĀ P!"""""""2SM&"""""""z *7B3gH8~<߈f&ދn)Ȁ =C?''xOFDkm݋ """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@L """"zn|$}زp6sB-PKΆ#,,,QƦUWR-⡟'''%n'R-jl%+Lh€{ yk,lD`)R&!g|vt]Fp4ú54ki4rz:cҫC|4Iu {7mCtRJK[7p#MTw8 O42^wYCYO@FI۔޲?^ 4 y: ֿ`H0"g"%jN< ]و5\3R,RgCgD:e\?r݋>(\r5k4#ك|u,JA*ӈ=1^V-No AЩ0Լq$~Qpx7^rAz\@~X }&@Lćwli ߏ^h\ ޲JYni*ĭAmh .7` m/5Qn{& $¢pNs.M Mm:KYP-VRe0  J҅XJD^h^1wwi~n P|Ш$̹fttE9R]GOax/jkFӽ̎_z׳;*UqS=" % CC!uY8OJ=Aָ o"6v/.Q 8eVل]؇IjMjnkc-ȄLn W,zp:KŶ,zHJUX?l=tkWX6oCC8yn_ڣcvY؟²ue\{Wb0Dĥ'46ܦdY7}9'2dȌGX ՚$\[\،c.J 5pxwV(L?Ѣ;jRYH9,En}"-/d &?6sRC0 :)tw2Wn!7Q(SZ'j "'/׀{ch{NŚ˱qNG"![BMR~~+HB⿫RC'/;W?,\5 #,, aGE>Up-*ڻ˗oĖ6& 6Z6f.ނU+`S.AuX]LGq-TzNy\bhN`? 8YT-HSƬYЧ'ZK|_{ b07g1Yp4_Nނ ⋃QI=0~,z9 lvBqXQyƽcnTe(e/-diѥv6"V&i*8_D[qL%uJlJi3"sت@tW׶| +*.TBya٠AGPstuǵaU(d*@u'B!6!ZtV5B9AɳȂ=D$HA!;O'[ځmHc=(l;>xgUp7Rsq`!X ^@4mJ;`[O0Ky~Se bŞB= '*MExZ=72|s,\GEy9m8Qi?=wyr6ܔS酆`ˆD-/bBo6Õh Q^s{ v%A{-y>ԡ~']2Mml's"z(1BTT(flW{n3q(!GئZvg4F/*nTC_8 vNM 3G{46۠$yg˖Y+m.蕩:F+ȓfCl\<{<|k>I9영?v"3$S8SjGI%#hlnѯV L ._?žV|s=U ow#=y6 0,E\mZT}ܽK콷T}$"}7l,+}\M#ԭboyb-]DeU)9ErhA>7FSbSw&vKN ]_f㳹Tw f`oX22X *DU>FMD_w6yۦ?Wc+Y}K$ tT|-: ljڡjf=SqcW8'> _6\Ŀ\p_Gb͵rm ?R 6>kiFu?]Ŀ+锞KD4Ië(6mnJ{jRU*[dSޜGH{]ϴ] [ʸbx|?ߝQUS-=(P!2_/d3j[j4\ u؜`WRj*2_#ę\y96f#z(٠-D)lн#2vF. @ϖW)"7oir 1{r\5P۴+ョtt5SB E\`U#;.ء?&CR~ Nθ עTf.?!+?% *DfiM,ңTq*v3bSJɥp9=jإqx{@M(u*݈ꣾEN>)-WuBG->i7v$QJZ1 sr?\Y"·4!˸|N8D+QϹW'E" X!>GI8W`W4 ƢV!H]kNNNDj7}e(.Jwi\ΗqGߴf_/dxQ{n$l$E(V*ͽZɹzBZ. 9м#ҵbBḬ̈gaio/ "X7Ҏ +x:Y[/;oSE-=P!2Kcn1X>w6f@tAZ|'Jϱ`m*jo2z .ġu 1W3wbl*9bcO. qUAnp:x .>ڕKtI3~V2,NbB1߱!æ`t[!wamΟrwÐMخC矄..ބ-I~))jw)к-+bpĝ).mn~l׹+΅apd 7{e4 jCP]ś-s?C;q}߮anRnJ@ \υ:Ƽ_vBLG:v!>Myb5  ?myjƒKe.$rE(˔zYwO|DP R~J уC<ſD;99))Dt;oDTYfVѽzh1Btgo?R,h >D*DDt1BTT,8""sADDw[E">CL """"""""31BDDDDDDDd&TĀ P!"""""""2SŹ; Ge*1"""""""2VZƍҒ=$ DTux9x "{#%DDDDDDDDfb@L """"""""31BDDDDDDDd&TĀ P!"""""""2*DDDDDDDDfb@*) g/ĖT#$u ^.ͨTlY8˹sJIݲc j2^Jvv67n KJ]Tgq0$qi8[X XF+Y%1|ԝ*)IDf0|Z>A +C ?%Q"(XTIxuY n1ְaXff`-F4]CgLzu=Uw6D' }<2ID_~D#uU:aw C{e+Wf͚PRʗs); 1&*ƁK.^OEtZj)|˂wta֠i : C 8^^AgaXw%?_?>zxwli ߏ^h\ ޲JYni*ĭAmh .7` m/5Qn{& $¢pNs.MTZM'{) WR"Fa@!]Ipk~_ ի7.ϭáDw9׌hW>@h3) %s^a-|w+%c;ؠV@w@nq+y*bW`g-XNYD|( QRb"ˮEQ.["56s^Z*)5M2wcNmti礴1 pl~CBwG)}妯ysWTIZ <N^д2wbnblԄd;+$ k.9t2jqXRU 0vDs_[VaMdY7t΋]QNs;dZl wҵhMpx V\MA[au1eP ֔' W]XN#j*wu}H<_-6زj%l FaB0rмM(kA` }}\eQJ}ENS]OWa6hdJwR v,e'@/n{nulB-TJKű\4nM\l?}^Ys0++6i]z=4WߛYܮ "(X8#g°->: s=ʟLլL"/FyN٢ysO~]N̻B9}_ ꂒ]tfGa!P1ۈ+㝗{^b q N}*huټlРT9Z *G [TP:+w ؜kkcYd 倈4RsSf`֬cp6V&KN|јx~gU8L6T\~~z@4mJ;`[OYYRĦ.cB%`Cb-tE>kbO!ڎ6>*\)Xz oeXċ2%`׵{Bf:FUƵqZZ腁/VgVlQq6㐵-l=/.Ѡin56/vHU~p$l7x#~ e` +$kižC HO(;k7Vx0k+1D0?T…j,;oog%>R6#{ōDܩУ}3H-mj y8+N+,oV6Ri ?ґyD T)O"Yg<"2N(t7GTFI.(| BɈ{UO~5xt[h(9.){N6ĀPO|%=Ư;:;f HʔTOHrN o/%Uٳ1[oXXY&B ŏ礹u>G)cP%=68ɺ_ ꢑ2*rbv=X]xIlP˳Z; +S>{gCJjnv HY T6v+S|ѽMdeh1)q5MNC5 G,kN6y|[p^r%H.]yAڱT =8 r=E Wil ߡh&o(< _,;يOSOj^ .b-a%5CJf==6ʬdV3t~9.f\I@zz1ie'FpǥѺzpͩ&E [XxϪAC)8G w =nS@ESc;~k~}_;6MA(u\H ź_`0hĉ0wu57ٴCӦE+.H:hߴ)Τ'ʕ$!pΝ<%pv<)#spA+g*Ο/Aj|[݃OX]UkNrT|> 6FA3w *7ZWYٹ,–,=[ceo6k1ڮW=@F+ #J½nʨ@wf[1=:*T6qJMIFNZٟ#8(*d4w1zfIEVoX#BA,Rs6PދB 匆 luu )Do}/>_|3a'I.R8~{ΰe_lNdKSrqAML:ʏꡮaAaGza='Ε:>lШCDPQ"#?ؿkeFbևb(o'"7g>p6r~ iѬ rOLAdeڨݱ%\N"L>ҳϡI3!'æj3@y&P!ޝ$tW^B_HLnma=+; nm#J21x{Fv M߅qr{Fs#TV\HcRSlވ}皠XhhyenG5q>ӳsqfҭjKMsC5q&.M\᥼颱+d@v 4T~怔zBSO=I6J}=ͽк9AvfDWc!VMNEȆ d.n j6W2%=ZlڲqaٲƌzVI5saN;.:W|`X"sQsMYa8.r`T;'93k;N(y@DDDDDDDw_h~]ѿ5QkuuRon\:gêDf3TlvܗXn֭/WuwGx޽=TuAVǕDDDDDDD*WwWC~GQWc=HJbnރ08Bm87_b? ?1L]wG(5z7^k5S/ !̘.0(B(;?UiZKk)}PۺK6ʼnSVЪPL4˹$ K5?-N l {go tqxDZwZyJc/> vɅ`I~ ~?K݆*2h$uVCu<"קcJ^U/!Bo5u!;Z9TЛh* c2p@Ϋ_ßv#O_ 4 gJn(ͶnE|%(e*+bJ8߿PLep%3?d̦3|]VlLE"&VV7F U*dl?_Tvp􆟋@.VM@֜tXt9=- G_MC&/[+w'PiRƈif@gb8~Z&#Wm݋:h:]D͈W>fnQO/ +p􇯗2NDDDDDDDU* Jǎ/Môi}Iq,+98zZ)98j|c>ך+hTOۋ߭Fǎh.2VktM}/Q%Q=Y!{t{ |XGLAN0D)e&"τ8sUK~-zv)DDDDDDDUj*Y)HQ ͡ XxW/Op& &w O'ضCKmĢ /xtDoOcs))xYлfGn壊FB6Bݵ """"""""UPR=>iR2&Z+⿮R{Cp|4Zp`Fm츀NBʳI$΁x1ޓl 5<#ateuҰy@ܨDɥ?41DYGgtvQƉ܆Қɦ?}G6zR H< @"`(tZ+eހU-m[ӴAy#"앫Q8tz<""""""Wաkrd] CΞ=&`b%jYՏ޻4t1߱x^He;xi_tM FLA{µy!6=Kb;#qk__<օd,X%-Fi|@ښ9xS9ϧo4e/ykΟ(^?~ a]nĞr퉧T\ޟÆ zj[}|:úGS)GiňM%Oǫ=p.>xEl{xZ ktDDDDDDDDÙJCBRji @Sg%PrR T ⩋~cƢ8Cq./w->yYJTS? {*(/|ˈ7tZ|G.O?$K7`o| ;ùHҵ"pp^uӥ;eDDDDDDDDTnCiJsk{>>_r֬ i͛~MQ i_W:N2Swtڧ}3Զ%vۻ{_?D&󌈀(q 1iclL|MS6/y}^__gg bAIAAD̃Ag8 G1 ~s9B}Flf|ff1mmK `La<uSk4".+coUJpl9my(^p:bʆ8Y@> *\+Mή}/vZ@=绲l3 oxs-75R}o*_|o%36.CDDDDDDDAP\F='wy1" ߱0P`;,U0Ƙ1[)y5Rr=3]xɓQOo-#OImMnQ)"f"""""""z ˏlRD>{ R_;-A J0[*o hVQ"w\JVfWA4ukwIgzw.F!""""""GP>|_Sg3CqK6B4)CL1p`l5ϼYL!""""""1<*j@K? S]?~71$5  ''BDDDDDDD4L<.?DDDDDDDD*DDDDDDDDZb@HK i""""""""-1BDDDDDDD%TĀ P!"""""""*DDDDDDDDZb@HK i""""""""-1BDDDDDDD%TĀ P!"""""""*DDDDDDDDZb@HK i""""""""-1BDDDDDDD%TĀ P!"""""""*DDDDDDDDZb@HK TVV. bԨQ'Cuu5 hxb>&x\b=P$AG="26p|L48&"")!"""""""*DDDDDDDDZb@HK i""""""""-1BDDDDDDD%TĀ ~܀Jufl8 i "r.'iP]G/2UBDDDDڻ[k5@""'ި}/P(dܥ0wV6AXGf5U*(} ĀʮtaދiM /m}X3Ol>>a `or<"z.i/NGBE&&0|<"WyehoGE^ sD(tIZ Rp*[n0L*U, zk W!yt{ WXZSƶm_Di-?}}ǻ/`B&G1c-}6IDd(SWBfY"{x? Ӝ0~}SYʟi_ASmޓ'u0o}CDD4tS 數I9j(y vw`8ɓ;]~>ı v>D>HLNAVQ#\}QkC-]ERD~s ztQ\sBx@- F:ھi;feF+MO1oʟV_Kw067qvڑǺAC x!OTcDX|g/ $JY5=%ǝ:ZrQ |Bb^+'{z, v* r/JBJVZJ΃-E8/ EK@rJ.qG# Fw4l=h@Ysjۍ0]HƖ$1Y:V\:IBݥhOZ}qIHLN%$̹Ko6C R#7G'~8{ 2Dn'^mU#v4 QysUsbއsJJKBݙ˷]]YU߹׾ nyݥ/bO%Lu4wDDD@;(1_૓yi3B&(ՅhUBi +&I*R&#굣V1t+D_d^ \ [}1osw^A:(_D^M\ H?%XC2ɭ6kܭA]Xv[mz011Z7QL#8}BIan+O׬"% ѹM002P*>2 6 uҔ^znU ;n'vކ!Ἧ-Ry%Vo \`aDDD#  Vz2;ȼv]֭^׿bچldgW*e'6n{sDX0~Rϟ,i~|bbۯ_[s=ո& DxSȇ}@aZ`~=!4x;*HbKXj^rZND?)UP WC`A>Mlܰߜ 6|@ !obzXTl&CfF&TbN/^^T'IO,.|pL]4DZӱ<& F{Qװ{Z3Y>cޛu9E:LE(=T*z7T"zEnB}ҽi7 ˫uӤU.=6(cPѪVU|ӊܣ#Eߎv$JPsuU^K8)T# {q4"0I`DB.%!:j~)_~'QZ[qWIu'P"-[(3]EP}N?\@Hsv, TS(s" "7o KUV 5G?Ohf"r|Ru$GT_lU'I:5n~/:.79$)ze9fsg炮Cϩ&C j2&:RH :)0QLXTc*=]5P& IȔTAd;>LÚ9z TY hDHA^wSljvrboΨB;χSY?| 7K|C {%nCT?&G*FrN>``gS_I#f6~43Zojz,uB-̵xTs[Gee;"=(2HOq11cF+tDxw*]uUG_:U*-8xN4x` ?ip;99ݻRu'^ G_>ZYiwG#T-(BP'S0DGVJYueP:f;f%8ѻGK"zh-8xT'N><`:I1U/B'bxlDc!ߗIѶWԠTXZuW[Fm]-6vJUtTCUtXC(:]IJmpjKX7%_[(\7DDDOPAlhGIlٱQQ;c|\oڏ[aۖH,S>"$n&udz8aƒg6#0A L8s95W?aGr, H)s|>t+>/1u N[[+^?Lr/H(CGLk/|븠`9;`(D!#Kf"^Qp#ag8%)7N3Y#(8C1;sQQعC8f?ҡX/[>U%$.(U=H:Wсp-/<~X> (F-OX1#~nh~i0 \}A.-`.`~A4SG Uj Ѐ#o4?x;9:&~Xa& uZֿs`S剩3 $<,i{+ғu`m( Ak NF/Jx 1vO{!';hv!*Zap;b@Vׂ$LL0gy0žx퍍)_|)§ouUCRfՇB>: &20XH} a? u4Dcc;.!P]Ezh& 3#w`yM>MrGCedf#N2(vg܄pSzS2"p,AdQA,6oެڎ讞D{#x~w㓏Qm`Em~-7u/}x/@d!xҲR#տg$RDDDDDa@/F@}J}C(A_l6` ۆ-;FtD۶~?#lݖ"9 nEDME,`c"~Veoګ_…g5wei Bl9abԦco>'W&aڥa&U- }[LX{g}m Ƀҹb%iS߷p?>C*uu#C]I]ݠ QG_T^G{:WXd=Bj\?i Ɉ/0fo}a$f|l}۶|fc vki >¶~mhXzZYPuRg5k;bg|e,* X,拖4H-DmdĝDЉ3,-uPhxHw[8`hXΛe4+GMiߗz+]~9U–(+KQ?{6n7_t[3@me $z< jWbWS}v gó)'/m_!}= }^!"""",TE=BB~ IȬV͢ jt`lܻ@4[sX%5bKe&jVIEiênAA8ogTKlč뗑+AZPUUucQfN .#_Qu=Ge=0UIk39pQg3q3+U$j=dD_NEGzuѠ c(iJMQVo);>0S8y*gҳQ0ξ~p=/"'&"%F~t f\H:8WpNsfþƩ k<gpJXV\>11)YEk+] {v)'*ܵDeI7Mc5>6Ņ  TUKsI8)8rP*aKC|Ҹmko{EIH) W4 Q%& S0a\F7J&CJJ /d!zlycWB&\ TVVJ$BYV[noo/Oa c1J4ިԽ_쁵oE i'4eDO DDD#@<*4Jav5^6 n35. }k݈8sPdz0BDD4r1B#H4$?c޺`jqBYzBhqLDD4r1B#Hu}Y.|ց5\&N Xh㘈hb@FP/Ĉ?DDD#@<LDDDDDDD%TĀ P!"""""""ҀqPz^DDDDDDDӀO!"""""""z=c tt3,|L%Dc""kz""""""""-1BDDDDDDD%TĀ P!"""""""*DDDDDDDDZb@HK i""""""""-1BDDDK(?TDnގ_#5r3/HDDͨ}/P(dEYqHɼ6@ ji,Y7ODÓV0wV؋ \/BGyJp!x` {,@N?Ҥؕ{KVS&޾ հ~Ɖ Պval; :(k.">.k V/z0;b&٪WPEDD@ 455F.-ԅ/U0A+q B-么7MMMODÓV&"xdL{y;~9^]6G,L8 >H:Wсp-/<~X>AP+F-OX1#~nh~i0 \}A.-`.qVXw){H)$$kw smd=a,DaXJHęs_ 0/M!ǝT-A-zqSˠ/RAs0}z=4mAq%Tq'-pg,~8ۢͅ8_)2W"=Zīᮝ_'3g,jMTw Oٻyn%& ;sJ$[ЏLآ߀qp\Ŗd|+`zY ,.DLm!xgPR ŝt}DŽ̹\TyLN9P{*.%"11o-*w~x7;J8cl׊3,=g8J[MRDܿ#.6\ԏC|??](Ԏ|[ӶC(k%JEd!DGl%t ص1XB f rͶ6PDZpїr?͑DqƢ@ipi$Zn1`aNn`ٚ utxIqo|0ŻVIgam\tkW'yl ~t!{EIo%hO÷;pw*J̝l8v8L]=+鱸Pom/sakqB:PZ?x|M c KS}qunXf^Z2FI8+BY,|+WKU gh6*R/ fq5ȊOC *y7unf{  s7>6.?)QL)9я!3,uYЇBwœ`Vp{O0g~:{^Y%oaz,v\P'vU I :wyWmc!Z^o}S?lmI 2k]0mE8|n>2tN-mB۵OpjzNCVB/GjCIf(8*_Y3U];6j j뚁wPQZ`XIf8<I8pVGRm[ĖmU/ UeU+,l5܅8)kEpw hm]aЅ!o3>ߟ˕-E= gЌf M.)~OM²K^V{/¦M^6ͶyoAJ/?vc'|qT.Nr,N%Z?v',9*2p7 w_1vUhm^n0ЊVC?E O< *BMcv&]7@mX#oT#ض#aĮ` ׯ^*&xIE⎗OOy zPVmmuR-lਡ0<,aѩW1tVi=ՠI .^Yu) ;He[9Τ+ED<5g6 dzp(d`/> +8DAGv_k&&Z`/σ2G )P/XPlqmfj v6͟-GTVZbV#/W|\p^z$Xs^W&tgg񣭹pJ^>/7pJ?  WXܨDb~rQ)G&j1~뤇^nhbGMpA,CaTH<dD x8ZPG9GC3> NҞ j+Q2+6B us^a=ܼ&-@a렡Zy9::O]5վ|_X wTR~+q jBA |OqwuG% JSuRkkB6ؿTu)YHS{gim!]^^~h>p]Q^+FӉ1ҀJ]j$~ߴUUUzf:(/( Wp ej?( &ILȗjK}sJM{M M|s8bXe#n\\iiŕmbԻPiDC[K2\|wZ##:k-MMH?/NGՍF4Ua|E"nx;;o LaWT._F8W)ςv%{{+!z6JJj{Bp(1-7uJ `T7Q(,+c7rB*4v3 O# SSQX)\wz ̨.&M])"i4f໌khW%?%\5JUKKe&*UfI^nQ,C =Y硁'PFKeM 򑚔)'^yT_W I L )U:)'MSK4ظw҄/@۸sRwea;9s\&a{bf@F.ؑ14o=Q^*++P(4 w!+ލا^fD}󦽽\Afk;t 1nN |)>jp|Jo]ƮӰpxOZvmE6+ tg~m>*o =>6-EԳMXVD'۱KCa.v%k{*1o!hƳXح_Q NGą|Tt``n. HNYsq)ȼ^#(hu ´s1I}Ŋ]zGAㆤOm-p"u)AmhǮ꘻5.N/| N|ЦŴWJDn>ݻH]MK#M/f9o>P!9m{Tn&Q&FE8%+j׻(!Y䅛{JG&&>w-LQ]͚"h$O8QK~["b~n\eM::[Rc` kXP\ ؿ8rn)Ac!U{?>Rq}4vŴ \uRwZ"Jq8K#&²4iJ;^`tg)>6wߡKϿ=!_k:gҔ]4"7P=?σ_=9?@y_}åC=fDDDa@F$H0q-h($fXi!K~~NDD1B#O`i$`>&xk4Gs.yYİlFf@llFۂmỴ9gvu|a^B둏ݩ8t>wu^TOķ;Ir鵕}zc;pV[)FfyHAφ~g|`To_Ш. ,qydEkgw[ZtҨ~\Rɇ;յ-zpe{٩#GhvhiΞ=͛7Awu:;̚`>=o/FEW ^nW)[Qo^#>zjxlvz=[z}+譿0;}وR~K<>}䛶?JUc{2~hýO۾:ex/ \k,sj"=i/j-k5o&]J8M}C_3nOOkJL~fo{^6g6K.xY7َ)?~~O;};QEE3;̂2/G_6lO{fc\wjß~Sg3yn~h6Fu?te*.Oj;Luk/?no}Z~׆ߦӺko?ߥ{Ⱦu+=5o]S֎p>oA0E#J٘`}BoݩYjSMӟQ}[OL}<{viGu^c|WU )ݝ(!p:%w^W{Qy-Iҡ|JR[3=Gݒݛ>}'[oGwEKk{v_~ǟ֏lwԒwsնzMz׻a?wz~j}AxIflx{BoRrFց^-ڱ&-[mGm0 8ϥ@1=5mݛUZ5)SB?xf~Q:wѕmɻ:xee&*kKuu|N}o-/o?}χJ~<}zkW3G~9ў[j]o#OxDx_?\Q?;\NJipUy{ZJ;pZ٘2/j _?UL]?+_FU3k"Yj-Yk۝knY/~(TfcOpLBozu7|*?_TWN 8ϵ@1E s_[wWr~4:+zI#a@=ԽK]t?lڮkޭL-ク{J;m<[ޟG=7 y\}/d>`~ Z٘`ׇJ7 2;Tj{A?Lbϋz"ˮWM>oQ?mc+^[7x]/LPx,yǻڴ {o!)^@?R kGlLp\ 43l~|G.G?KPyy^}wϾg(=mxojoɔx+<SKUo;F_[O~Yw/L Wn^zuo[:M#~|'R7l#{cKhtsrQoz(Xק{T??N߸~q~{Ytl`dde=i?{.mj-͛[l {:WB#lܩofO#~HިE42{ǶnzcwA_GkҟWzRu۽xb-zvJ[WiSoP__m1}~_O|x O~hezϟG7ugz:^oޥ3[~]zMn&1 :)}^q@߫jgCfut}MJnFLWݤn-E,Zn}@ĝ[+t˝ .{^ډ7wju5tl3fjC~J}ۛkls3oG?{<;0[r=os}vƷmRu jTZ^wwܧ/6[kC]tu{>GzCVpֽ>g{>?|uZv~k+)USBp'R0fAfھb 7s6yɻwOV@^OO4e5k6tI?Jw顮'5py Zջjit.y@ `2ك`3 66b# `3 66b# `3 ###/,'8iW7] 6P*hb+(aY'oX Lټ.\tt 6^zIO" Xꪫoop 6ͣoyO;`>[7KWl܀sNٔpG/>{1??]BNulT/衡]ziѢEAY|rͦtCqoYe$_y}uz+^(l^hwh&pe21b+.]`ht\LĊ 49fc7Čj6GGG5<<1پz-mDc|&ohIsögвT^^2|-MQhͥ33`>pd4crw h<jf6b# `3 6l566Q kuvLƶgٮпy *7Utu3z3߱=!i_:/:-zUnOy=S`v9)iAmB_6u7jĄ-M*++…sgGfXx֯#}uGf7ߨGӹޡ^L\h#g~xT?J0aCBz6mڕ%;GۙO;`9l^jhq^jrwCKސK]-Yzq:;f8Y`VϾģw׷7j^J;t}LקvV{}z-3ؗ=Uw'._ۯϛA`Z>6'T;lLUW]sYQE7CzrHX/U v]pwC/&-f~߿#J..U+>Gz.65= .ofEЦժ(1B; j L飛ok֗:1wG[OaG b-xݮ~~l+IEuFtpOZ?NNLuQ]{w=~~͔];/) OO?ߝGSf]r?#}uJ_igN5k{݋kGu Zve:gxEz{_6eǦ6kL {wR gڵ;}Τy5,{&;:c};~yVyU&Q9O~n}D\N fNur}භfjPW:AƏQXiKJwByF;5{?|֢݀T 2k凛2 v^z]-mG5&tx=y(7L){tQ=~c;gУӿ4FuG?ދyǟ< w<Κu|ZȣawZZl`OoZy]y3}د}V'o'u7_[wVSn-'R[*c2ڼa׹tBEp0ͪ`sv-f=27?yuTN& :W&z_Ca %+|6%tmMtδyi}kL_6;P==/|ߩ}&cgou=Ǽ ZħW5\ kk֎6~YGqeBnƫ}]#g5J㔾unwU}R_%*~nڰLJ3t~XbfuUZ) {OF2"mxQu8V}JJ8q_UEn>o)5 v>v٦7*4|.U6H8߲km?$+9ffc? z!@p`2tӠQtqt}W_j݋LVVv5,$fwF͙v\/ @;o!_| }T2{YW֖%Tal٨K33y;.PUvڵպ_DU2%)}Y;o/#/LW.gmo3W_MvT.G5h/>qR6Yƣ7|DmGuJ{R[)9Sn֬˔0n˔X6!un/V 6Pn9ˋ}J+|^ [W}>j[_6g{vpkA㼾.;ߒ'P˜v+hu|eЗMy^"<λy_TgNfsԺ[:j;4ԍv%uޕvߨE[Wv{?bm)- =6ڝoJg9<|Дqˀ]7կߦ~emͶkÓjuktg? X̺/*64k 8JY @_Ө}iuj6`>g>U~3dB7\ټzW,~E,,SYδק\WlI}qo'K{T^TU$jݲ?x^ZId>:MPq~;ofbf}읫UoKlJO-w~DTئk4LZ?Q7ar+Q;iZw|~Y׬V>}\F %Sp5R eoTډа^SrTQZ5oT❹Aҗ|u +_: el oZmz2㚕0ͫ!}tףyO'X'u~&dV Nާc_'~oIJvN5؍^|d@wrY̑6.uhǹ6m?ɜ4>6L aCe4$a)Z|9͎Q]s <{Gt yiĥSqK8G?&T;GFņjJ$ժF' pE yٌ/yڼ4SMٔYwnnTEzt(5`4# `.`L8 0 ;Մ ž0_M8GK׬"Kw̾2;&@ AiCf@lm R,l>xV;p%졒͔Ff@llFf@llFf@llFf@llFf@llFf@llFf@llFf@llkצ]i]Sj(lDy8t;ݺMZOy=52_TzWfݢ:u }S_dݸբMξy{L+: vgji;d3wB\c01y˝sR=[KEg`1&Sby̙/lLYJ?q;Gl:ն֔c9Xף/HOB}+ڵ#pta{Ϊ@hu ԙ@eMר=t73nқӤL\-+XņfuܛP/mHy]V縸<9qYlތdNfea+*ً],"YYRgd sH'.,<7۵#k}NYFuN_ ։bx 4u*o ُ0LS91F盽/`Z?rQmbFU=Ԩ rEo*/=٣UuZ=T~(IninA3͎;1Θw1pA];XU+Ŷ<Z~m{u[Yx^O857j}lYf>za?'O}_0.6~-6>stl4] ;m*l~h[dyVtx{3eX*h@Ǘh;V;Ǭ3}vH $de&ՠ)N.iXӨ iYPjYU2ҹ'1LٷRރjސ u)`muƟIzێJIo}^2{8v̮{qf.dYϧ2ٖF;3=]|,L02gJug8n N?Vپ' (*Er&Ñ؄e,֚uq{Q';1ꌬY^5^nIǠQw1Fo9޹@(u,]KWj10לjKqox|9^n`m\9랕[sG} ks3f܎u8f?k6m5y'd7|+gfeDYl>԰7p8:b&HQwM7pu Μ4.hj2HMvSx޶\Al7plKVyI9˫Od l.g58 I}먳PɸyeڄA u;Vʦ2մK/*ݞV3:?M>{;vd>w'w I^1awxeSieyCf  -byxowVP gûfRgr;qRS2]pk?ntlBt>ܿ fM`=Z6. 67L)ݺ Ɣ>bovwaQy/W(,xkpd,MKTko ]&&KkRۺjśc$)0&P,|gRUNK9lP&pTt'I֐ur6ҔS_L}:, DV1w^nɏ)~"57=s{"?l b?w\$ K(ݚ9ǽ4)@WJ`6ZhGk AhI`,IX1AY2Y$ЗȜ eλl)ТJ8@c]lȔeo2@dViʔ1,,,5~1%br$}7=>f W$pinM.@/D 5μΩdʪ[kJHFp(5e{r e Hw`䂎&ȑVk@x tϊ@{9:rdլwk|g5'b y67W;6r[n)eBJbk0Y1}ɜiذ7T/yL.W;\>;2K(Oωgc'?F˷Ov{m`9b?v? ~S?vγm{:֖QT:iLn 㞳jr/#8:sG e t7oQL}ϣ:`2rcH 1 L6YY~;^q3]4ϺGYǐ)`/)cڻݺ-&iǬQb&ɂNIwLI9vPyU(]se4f@ll6gwuF]jѦSoi}C2qש:fjzDŽq&Of[Ykd>=0c#zl\N:}>SϽ}1Qw/l + tU&=Nta&Թg pe9VV۾'sԺ=t3 2sfѷ'-kG82ه;T&[,1ff2 ད,H732_8OL2[+K+2G7β pv$U5մj@=O3.Kߗ-]2Zs2Ps2@#YY:5kUZUKmoDWh̸tֶf;Z9;8c??7C;XtLJ>_gY,3?2g}_`\2bUdWgWs˯bF5(>>Nͺ:}}9V}ub}f.\fzٴZiL^$6g" hk*O dUӁj`7&0= =&L&wγ] p+s|joחLslqkLP*~A=i5xAިJ]bJؗ ss)JmoϺA[Ѯv{ Nl|K~3Aٞp`GU;=َw<獕kqu2󾡧ӟfsnԾN $H,֚uն;͔uTɬ&R۱ʨV&ժzϽ`Üek56>cjOh_P[nғ= ol*u]CuVMߗujwn䬯YuGh߬lJnoT)ǡ^flg~cpUTlY u;NـwpQpqZ7wRkG8 vbFJIjԭao@m>tUL/ 0U;ʦʸǕY789jVgZSzMjJFOHM:dt9~dL{5&f9Xd@zeLv#9[ݼtk0/*jW6vkц^}e=~ J4uv=[KSAPci;Braѳ˗s{M#x5;֗&TWF:.ӝ'}cj )=);6^p`k\p*hW2mW=_q3z̦_/3Μ3gS'\ƀZҔl?S7]?m\7/~n.,]%:fiʬ[xB–0zm2xSj:OuE2Sffduw}THxLhؾ4A;n%JS߳6\l{-9`¥ 9r6#FS#-[*/.OY}P]z֥߮o=:sO9{lj :QU0ۀz,e_gDkTuڟ\N/0sY,@$l˳x2:iov# +.ǣ[bH SJC%)v`Z022ؘFGG5<<1+Lm#2AgAst@<2ALkǵ?fjrLmҡe\eeeZ0*,9e%:]fK sUHyrN6a9e%n2=%Z$ReJŔP~0QFPe4ӆ`3 66b# `3 66b# `3 66b# `3 66b# mzCio&unq!Bvһm02/޶6})O]yʄym.Jnl566Q kuv1%(l[b7_nݦݶgU߻TקLyVw"4U@wmkצ=i3:>k:E\jюgQ۳#3MBҝwhZuȻ/y۞=CnSyyʴpaYl"fs϶H ~p8v0ΚԺ%frs+h6'J\~@S,foy(/AWYkK_Y Ne;6ٺ޴)5M,Ky2!<7m 0&Tg3}/u=`d){؛peo̶뱯4Y. egT74d5WYldhNh_Q y˶ δH6v$EņAPu-.q?h1SfݎP jJ&TvK+7M|;2&| twD`9?wcUv9Krlgrk(.9}A6-GdA'ls/_Ff:mORZ[3ci^_0lVӁ_JT:k-5T#}z$߮8zێN:;Uf@ot$mfοi~nXdֹQ+m?fO6Kپ Jş8eoBo%Y09?=%a;Ϻ 22-]Ov14M0] ?mg=u͐1MXdjk#uIdYOFv9۽r㏅FiS;nl\e5w$\fifsARF>;չ'T3]]~ZӎK+ippeVɬ>ZSWoM7Af\Jδo~tkRܵ7LkͺjG'E<> d+-5I{׹LaOZ;Sv &(rzϽ[7Y_e`5N^DƹϪ*iJ '`)]㬃|?;'ڜﷷKG6u 4fn9o}塧/ծQNoMu{t;{Oլq.H FC9_uDQ˞ ?VMŪZa3?7)կ:wq ϿyD<{f zKO7s d{GSge,#Zsp󽳮6z2 65V!/8 �e1҄0?pSq;e'ޣ:\eLy y{7RS QuI; (3t.ȵy` f_d5m}}/l{Oh~w6\Ȫ%*6LYFÖ{ 54e{AUU5Xcnk7 ?˹>u{ f%w&0^VU *01 !^q~yOz~ƻWZU Z;s3`v O)ᆀ̏O6 MEFZBkͰ)9QUW N;ZBkoڿ嶬FV 趜F;p6rd {Ynpξ}"P n0fu~Vi7n3)Oa{͟Ehs~d61'4}+V5jXW6 h)Mip F)?M2s 4v ÿFBuz[o23Bm޸wB"*64k_^{Mzq-%'һY}>!ZvUVV 0@fð2p^wVK7oX-;N:PZMxμ':޼J 4/׾&uq.^ )m;Ӷ; l3eu8k: Sҹ `7lTקΏ,;f) x ׮M=eM99wuo`ږP,{ᇻgϬ7m  ݱSjMsMq;}E3yUժ 4tn@_ J֭;{)=ժ jOkw)wLζge.V1c ɼQ&WMk=ߝa79+/)t:swk\eσk@\7f{}K9lY?HN&պ"eMsO(/ՙAhRӪvxyv=y\ο->N#]z@ņNj8YCOZUKm$\[8xQ9󽞰S閪 g5yçO8瑬Uc 9Y27S'ɼ<\=߭vb 7*s4g}ծ57'.tI>1t5z-ғ=]U5nΜwϟڝ뽀]8JVMMF&5 `! %16uF@S?ГTkԪ%ʊ5G}+Vp=n̗[9;fs -Vd͍/ܽ& pgzϽ`lS5dz^CsRXb_Dׯ?tCpO鿠!];~&y p3LPgP)75u=Z=iGMH}JYsRӨ}sI^v^v!W$fLB7J \()_,4wRm%c7 }ej/)fq% at{ZZ4OvVz3stg7h X><~aSsH`SMMu չwѳHsw H|5 l?>ybI&2;vn3y8^;lʦΤG{)k^ 5=m8f?_`s~Gk6׏߈)SfIz 1M8Cg1W˥d'%Jz]!*<9-%{Rt?hK.KRU)\oyǒmL9mo0ĝ9|`j,yvkllLs [h۳thm*//WYY.̟L\ڽƤ15@' f@l `3 66b# `3 66b# `3 66b# `3 66b# `3 66b# `3 ###/nittTzAa3Ejޮ^[3 m S:\Ԗ; "a;oWU̹nwwMO}pQp nJWȥh}NS`TTGjӝ^"zu,y@Q㝻iS7 ;|ZuAK8/OEw%ճ.|:?p ={Hݦri9ӘaOAut;1=dG+WeByY-j~߼an8ݚRg}20Vᾒn:x*5м\TKqֻz5ttώΣN\&XMd̯L['OI.`b%mVVިUyEf)ҕmd^dY?<7̣%~ ֦]i]rYBlMZNIw*`ީL莝Rk~_:ҝоתʹY矐cjw=+йjLX'u2iϺ%Wkí8ʹFr_k&]^Z 0~'X]4hEM0{Ͼ7_{(^s l~ARUw.m=rهb{\"<ШnRj]^Fb&Ȕ ~ juA^ٜлM .Km̏G|c[jHZ+uibF5>jWqROIZ6!9pbC:&x)tk2uD:jcD8&U`5dEkxuYkα|}6TȽ񯥜:dn->5k{ƞ)g}ծKߠL3O'L _5몃Ϫv4nE VMy3l}Y~} ^''\;xTTs!''r5]OܠEk)qԻbwk@7fn%y!juaK^?ؔYٔ#ytBGC)<.IԪZ=Y(Sv ̵Km-a&QL=2=C I2̘}qWt$,؀a_'r5`pï;㙒rjg5w^&l% nsߴ[d4͂ N͐K]Gp.Býgu=eId^Ch< \ #L 󝓛6q+M=fP Nw:瀀 X{u{m\ gJ憹Oܻ sA*h׀n\v 7*I==^5d ׀ol8Q#E0KKGsTg6uM*xL4%F 7V]^Pɯ]pKpGRKT!pES>7k9|ÏCo2rǺyOJm+w֌^RBk'_qeq!4g?Ly6?I?Qo!tsg^m w7tfϽ+2r l566Q kuv \L&̑e `={Hݦri93@ SUr#2 6lFf@llFf@llFf@llFf@llFf@llFf@llFۂm4::am=ްՎ"CiloWٰxUuڝ)5oXl.ٰ/{۞=CnSyyʴpaf2/޶6}0]yʄy]lJnfٔߦM>;.tkh]i])-]B 5AcS^{vN+{u.uq:q2k0n4O}=EwmnkkG}JTfYрZ8&9 HkwtS6_ņjp _^g`J`PZ_j sxjoXw*wL^iϛ6UްIh_tYPϓYȆgמP-q~j:ɀ.TncUGף]V< `=o֮:``'{lfoB2AҊ Ad?zD&yb۽Xdjm_jw3װ'YQJS5v dW)P˷\O2~Ts6@jgV3JD\*Y*?X=L/hf0,d{#\UYRdjDJid :L@,4xϠqDJi%4UwS :7k͕:3sҠԄ+:y ˪2欀s{PBVU~PWL66Gdףw&;=Ԍ6羼@mMu6xLLc{ZδGNzFy֬5 58V校ZS\Fm.FZНݶƺ [F2;vALm~ T.r؞ۖ&ժ 7KM2f rAlm |Unp_vDYBm%4\~fsņP= S+yC8X{f)Yq 7ʦ ,mjm鎬c"OqB3q6W&+A `˶[ccc𰶞{PojUt>NdBggK]-6Guιd4;ntܧ aˮFՙ{X?:y<g5HL)v}^֬f wO+jɅZb09-g=> LjhiF"j@e9~#;D'rOfSJ>Mc >rRA].fmkǹ>B2Ma,е2A3秵 wLf?SiA,v:#ޭqiRsQQ6>"UKv3<'jsEAR5O;ZBڿAFV N궜r;ᵍ\+6e9iB 4mJi}5wPMdfg͎HaΟhs~6'4}+V5jH t ~*nݔW`tXdY3wZNB[B#:= 7̍!Ko\Bn[kϞ\Wlh־z|Ylyș}sυ~@̷%ڸ9:Sْ;_y:`:,yvkllLs [09&39h  C:6L a}ޣY~Wd6 "0m6b# `3 66b# `3 66b# `3 ###/nittTzAa35i' p9ٮC:6L a`3`n)5L @llFf@llFf@llĶ`ddeۭ1jxxX[=7lc)?JTAECiloW yΔ7,C w0 驼Sp nJWȥh}NS`TTGjӝ^"zu,yfmҡe\eeeZ0 d6{?;msZeBﬖV5joްV[4Jm(=dwnu'Cj5㽒n:x*5м\TKqֻz5ttώΣN\޵Md̯L['6fT:?V W6ҕmd^] iWV`==*4ܽw^2}enuC .(2;vJ.~oVU4xNй~M((ZVuժ  5ԧ;wLζߛP$-V1cmՖ޶ 3U۝w Z p f&mv)s6Ⱦܿ󬎸BMfWͪty j6l3 /_ņjo}jWqROIZ6)meݎ N)tKUUQuM&~"NHGVMcu4`ʥ2o2>+U]wLhsJH ׆e/VPwKO~%ezJ_>jmٛP瞤Zը[snu{&s~vko^LהPv ]wMc erG.v$0`3>ۖ Sqs/8CWkˁ: Vh#F[rJT^M|5yj6ܠw߾QJZބӟ<7s*6Γ޸Yf ; 0wl0g4ܗl 7t'H;ܔH敩!ɤίYɔɮ{n5Μ@vUӨ}sI^=C I2`" `X5F܆Gw3 u4l.SYm~s9n,.*ZtRWzni; X{u{m`" `N0ۻ/^ʄyVmytGsoQM4xGFIU5,yj6f-GޓTd|SZ}e78m=^I=NYo˶[ccc𰶞{PojƔ Hg]2m{-M*++…s 64'm{q2@i=f8~S`3 RlFf@llFf@llFf@llFf@llFf@llFۂm4::am=ްՎ"CiloWݙRŶ9(-vj{@9Np}~Sy,8u7jRWv >>նsuvwU@׮M{Ҷ'o;g.hs3|Imj_&TaǕ¼2oۋ5mҡe\eeeZ04f6_T:գ4J \TPﬖV5joްV[;ݚRg}2xGtԙDǛW@s >f )]6xOsN=۷֛HTwswD{jD04x6rsr^5!`:oQ6=q|ülo:7lF|[:&|C.|Ry$ ,suסps Xg75r5>t^|7u kY27>͍9ٹɮsͣQnCW/j tɞf(eg,4,܀B(%&s<5KU62<܀lj /jYO$#Lo[Ϙ]vʕ﹫rM L2 I(+܂1^PH(}aG0:`7vf)4ܕn^nJ")X FEnT|4n U.0fhm֜sB*hVh3#wy\p`r3ccǟ yKgD.`3QiIVybpT(=pIEUIC%4rr>Pb1R)CbMPv}txO:/jc,tۙp#r㱣zyj6Gk6GXy5Ad6mq p~̶`>IK<\0ԬQU\ 1+ᖨZw6Z]/ROoD̍53?7[f4:vNdC?)m̍Ɨ1Ty ${v->RKMNJ34}#s녆Gy5܆b>?AȾ)3k˶[ccc𰶞{PojfZ:,UZ l۳thm*//WYY.̟<5j<*"Ŷ sQwh1d6 "0m6b# `3 66b# `3 66b# `3 66b# `3 66b# `3 66b# `3 66b# `3 &+&&jH PIENDB`golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/000077500000000000000000000000001465037340600235445ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/contributing/000077500000000000000000000000001465037340600262535ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/contributing/2020_season_of_docs.md000066400000000000000000000010661465037340600322270ustar00rootroot00000000000000--- layout: default title: Google Season of Docs nav_order: 1 parent: Contributing --- # 2020 Season of Docs
The gRPC-Gateway participated in the 2020 [Google Season of Docs](https://g.co/seasonofdocs). The project was completed by [@iamrajiv](https://github.com/iamrajiv). A summary of the project work can be found in the [project report](https://github.com/iamrajiv/GSoD-2020/blob/master/GSoD_2020_Project_Report.md). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/contributing/getting_started.md000066400000000000000000000003101465037340600317560ustar00rootroot00000000000000--- layout: default title: Getting started nav_order: 0 parent: Contributing --- # How to contribute See [CONTRIBUTING.md](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/CONTRIBUTING.md). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/contributing/index.md000066400000000000000000000001141465037340600277000ustar00rootroot00000000000000--- layout: default title: Contributing nav_order: 5 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/development/000077500000000000000000000000001465037340600260665ustar00rootroot00000000000000grpc-gateway_v2_migration_guide.md000066400000000000000000000136631465037340600345710ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/development--- layout: default title: gRPC-Gateway v2 migration guide nav_order: 0 parent: Development --- # gRPC-Gateway v2 migration guide This guide is supposed to help users of the gateway migrate from v1 to v2. See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/1223) for detailed information on all changes that were made specifically to v2. The following behavioural defaults have been changed: ## protoc-gen-swagger has been renamed protoc-gen-openapiv2 See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/675) for more information. Apart from the new name, the only real difference to users will be a slightly different proto annotation: ```protobuf import "protoc-gen-openapiv2/options/annotations.proto"; ``` instead of ```protobuf import "protoc-gen-swagger/options/annotations.proto"; ``` and ```protobuf option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { ``` instead of ```protobuf option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { ``` The Bazel rule has been renamed `protoc_gen_openapiv2`. ## The example field in the OpenAPI annotations is now a string This was a `google.protobuf.Any` type, but it was only used for the JSON representation, and it was breaking some tools and it was generally unclear to the user how it works. It is now a string instead. The value is copied verbatim to the output OpenAPI file. Remember to escape any quotes in the strings. For example, if you had an example that looked like this: ```protobuf example: { value: '{ "uuid": "0cf361e1-4b44-483d-a159-54dabdf7e814" }' } ``` It would now look like this: ```protobuf example: "{\"uuid\": \"0cf361e1-4b44-483d-a159-54dabdf7e814\"}" ``` See [a_bit_of_everything.proto](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/a_bit_of_everything.proto) in the example protos for more examples. ## We now use the camelCase JSON names by default See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/375) and [original pull request](https://github.com/grpc-ecosystem/grpc-gateway/pull/540) for more information. If you want to revert to the old behaviour, configure a custom marshaler with `UseProtoNames: true`: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{ Marshaler: &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, EmitUnpopulated: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }, }), ) ``` To change the OpenAPI generator behaviour to match, set `json_names_for_fields=false` when generating: ```sh --openapiv2_out=json_names_for_fields=false:./gen/openapiv2 path/to/my/proto/v1/myproto.proto ``` If using the Bazel rule, set `json_names_for_fields=False`. ## We now emit default values for all fields See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/233) for more information. If you want to revert to the old behaviour, configure a custom marshaler with `EmitUnpopulated: false`: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{ Marshaler: &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: false, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }, }), ) ``` ## We now support google.api.HttpBody message types by default The `runtime.SetHTTPBodyMarshaler` function has disappeared, and is now enabled by default. If you for some reason don't want `HttpBody` messages to be respected, you can disable it by overwriting the default marshaler with one which does not wrap `runtime.JSONPb` in `runtime.HTTPBodyMarshaler`: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }), ) ``` ## runtime.DisallowUnknownFields has been removed All marshalling settings are now inherited from the configured marshaler. If you wish to disallow unknown fields, configure a custom marshaler: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{ Marshaler: &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: false, }, }, }), ) ``` ## WithLastMatchWins and allow_colon_final_segments=true is now default behaviour If you were previously specifying these, please remove them, as this is now the default behaviour. See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/224) for more information. There is no workaround for this, as we considered it a correct interpretation of the spec. If this breaks your application, carefully consider the order in which you define your services. ## Error handling configuration has been overhauled `runtime.HTTPError`, `runtime.OtherErrorHandler`, `runtime.GlobalHTTPErrorHandler`, `runtime.WithProtoErrorHandler` are all gone. Error handling is rewritten around the use of gRPCs Status types. If you wish to configure how the gateway handles errors, please use `runtime.WithErrorHandler` and `runtime.WithStreamErrorHandler`. To handle routing errors (similar to the removed `runtime.OtherErrorHandler`) please use `runtime.WithRoutingErrorHandler`. ## Default query parameter parsing behaviour change The default behaviour for query parameter parsing has changed to return an `InvalidArgument` (`400 Bad Request`) error when more than one of the same matching query parameters is parsed. Previously, it would log but not return an error, using the first query parameter that matched and ignoring any others. See [the original issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/2632) for more information. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/development/index.md000066400000000000000000000001131465037340600275120ustar00rootroot00000000000000--- layout: default title: Development nav_order: 4 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/development/installation_for_cygwin.md000066400000000000000000000110351465037340600333370ustar00rootroot00000000000000--- layout: default title: Installation for Cygwin nav_order: 1 parent: Development --- # Installation for Cygwin
## Installation First, you need to install the [Go language](https://golang.org/dl/). Please install the latest version, not the one that is listed here. wget -N https://storage.googleapis.com/golang/go1.8.1.windows-amd64.msi msiexec /i go1.8.1.windows-amd64.msi /passive /promptrestart Then you need to install [ProtocolBuffers 3.0.0-beta-3](https://github.com/google/protobuf/releases) or later. Use the Windows release as no native Cygwin `protoc` with version 3 is available yet. wget -N https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-win32.zip` 7z x protoc-3.2.0-win32.zip -o/usr/local/ Then you need to set up your Go workspace. Create the workspace dir. mkdir /home/user/go mkdir /home/user/go/bin mkdir /home/user/go/pkg mkdir /home/user/go/src From an elevated cmd.exe prompt set the GOPATH variable in Windows and add the `$GOPATH/bin` directory to your path using `reg add` instead of `setx` because [setx can truncate your PATH variable to 1024 characters](https://encrypted.google.com/search?hl=en&q=setx%20truncates%20PATH%201024#safe=off&hl=en&q=setx+truncated+PATH+1024). setx GOPATH c:\path\to\your\cygwin\home\user\go /M set pathkey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" for /F "usebackq skip=2 tokens=2*" %A IN (`reg query %pathkey% /v Path`) do (reg add %pathkey% /f /v Path /t REG_SZ /d "%B;c:\path\to\your\cygwin\home\user\go\bin") Then `go get -u -v` the following packages: go get -u -v github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway go get -u -v github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 go get -u -v google.golang.org/protobuf/cmd/protoc-gen-go go get -u -v google.golang.org/grpc/cmd/protoc-gen-go-grpc This will probably fail with a similar output to this: github.com/grpc-ecosystem/grpc-gateway (download) # cd .; git clone https://github.com/grpc-ecosystem/grpc-gateway C:\path\to\your\cygwin\home\user\go\src\github.com\grpc-ecosystem\grpc-gateway Cloning into 'C:\path\to\your\cygwin\home\user\go\src\github.com\grpc-ecosystem\grpc-gateway'... fatal: Invalid path '/home/user/go/C:\path\to\your\cygwin\home\user\go\src\github.com\grpc-ecosystem\grpc-gateway': No such file or directory package github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway: exit status 128 To fix this you need to run the `go get -u -v` commands and look for all lines starting with `# cd .;`. Copy and paste these lines into your shell and change the clone destination directories. git clone https://github.com/grpc-ecosystem/grpc-gateway $(cygpath -u $GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway git clone https://github.com/golang/protobuf $(cygpath -u $GOPATH)/src/github.com/golang/protobuf git clone https://github.com/google/go-genproto $(cygpath -u $GOPATH)/src/google.golang.org/genproto Once the clone operations are finished the `go get -u -v` commands shouldn't give you an error anymore. ## Usage Follow the [instructions](https://github.com/grpc-ecosystem/grpc-gateway#usage) in the [README](https://github.com/grpc-ecosystem/grpc-gateway#readme). Adjust steps 3, 5 and 7 like this. `protoc` expects native Windows paths. protoc -I. -I$(cygpath -w /usr/local/include) -I${GOPATH}/src --go_out=. --go-grpc_out=. ./path/to/your_service.proto protoc -I. -I$(cygpath -w /usr/local/include) -I${GOPATH}/src ./path/to/your_service.proto protoc -I. -I$(cygpath -w /usr/local/include) -I${GOPATH}/src ./path/to/your_service.proto Then `cd` into the directory where your entry-point `main.go` file is located and run: go get -v This will fail in this same way as it did during the installation. Look for all lines starting with `# cd .;`. Copy and paste these lines into your shell and change the clone destination directories. git clone https://go.googlesource.com/net $(cygpath -u $GOPATH)/src/golang.org/x/net git clone https://go.googlesource.com/text $(cygpath -u $GOPATH)/src/golang.org/x/text git clone https://github.com/grpc/grpc-go $(cygpath -u $GOPATH)/src/google.golang.org/grpc Once the clone operations are finished the `go get -v` commands shouldn't give you an error anymore. Then run: go install This will compile and install your gRPC-Gateway service into `$GOPATH/bin`. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/faq.md000066400000000000000000000113271465037340600246410ustar00rootroot00000000000000--- layout: default title: FAQ nav_order: 7 --- # FAQ ## How can I write the annotations which gRPC-Gateway requires? The gRPC-Gateway follows the spec of [`google.api.HttpRule`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto), so first check out the documentation if it is feasible in the spec. For situations where annotating the proto file is not an option please reference the documentation on [gRPC API Configuration](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/grpc_api_configuration/) See also [a past discussion](https://groups.google.com/d/msg/grpc-io/Xqx80hG0D44/VNCDHjeE6pUJ) in the grpc-io mailing list. ## I want to support a certain style of HTTP request but the code generated by gRPC-Gateway does not. How can I support this style? See the question above at first. The gRPC-Gateway is intended to cover 80% of use cases without forcing you to write comprehensive but complicated annotations. So the gateway itself does not always cover all the use cases you have by design. In other words, the gateway automates typical boring boilerplate mapping between gRPC and HTTP/1 communication, but it does not do arbitrarily complex custom mappings for you. On the other hand, you can still add whatever you want as a middleware which wraps [`runtime.ServeMux`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#ServeMux). Since `runtime.ServeMux` is just a standard [`http.Handler`](http://golang.org/pkg/http#Handler), you can easily write a custom wrapper of `runtime.ServeMux`, leveraged with existing third-party libraries in Go (e.g. [gateway main.go program](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/gateway/main.go). ## My gRPC server is written in (Scala or C++ or Ruby or Haskell etc). Is there a (Scala or C++ or Ruby or Haskell etc) version of gRPC-Gateway? As of now, No. But it should not be a big issue because the reverse-proxy which gRPC-Gateway generates usually works as an independent process and communicates with your gRPC server over TCP or a Unix domain sockets (Unix systems only). ## Why are the models in the OpenAPI specification prefixed with the last part of the proto package name? The reason to generate the prefixes is that we don't have a guaranteed unique namespace. If two packages produce different `Foo` messages then we will have trouble. ## Why not strip the prefix? When a message is added which happens to conflict with another message (e.g. by importing a message with the same name from a different package) it will break code that is very far away from the code that changed. This is in an effort to adhere to the [principle of least astonishment](https://en.wikipedia.org/wiki/Principle_of_least_astonishment). ## What is the difference between the gRPC-Gateway and grpc-httpjson-transcoding? The gRPC-Gateway is a generator that generates a Go implementation of a JSON/HTTP-gRPC reverse proxy based on annotations in your proto file, while the [grpc-httpjson-transcoding](https://github.com/grpc-ecosystem/grpc-httpjson-transcoding) library doesn't require the generation step, it uses protobuf descriptors as config. It can be used as a component of an existing proxy. Google Cloud Endpoints and the gRPC-JSON transcoder filter in Envoy are using this. **Behavior differences:** - By default, gRPC-Gateway does not escape path parameters in the same way. [This can be configured.](../mapping/customizing_your_gateway.md#Controlling-path-parameter-unescaping) ## What is the difference between the gRPC-Gateway and gRPC-web? ### Usage In the gRPC-Gateway, we generate a reverse-proxy from the proto file annotations. In the front-end, we call directly through REST APIs. We can generate an OpenAPI v2 specification that may further be used to generate the frontend client from using `protoc-gen-openapiv2`. In gRPC-web, the client code is generated directly from the proto files and can be used in the frontend. ### Performance The gRPC-Gateway parses JSON to the protobuf binary format before sending it to the gRPC server. It then has to parse the reply back from the protobuf binary format to JSON again The parsing overhead has a negative impact on performance. In gRPC-web, the message is sent in the protobuf binary format already, so there is no additional parsing cost on the proxy side. ### Maintenance With the gRPC-Gateway, if your proto file changes, we have to regenerate the gateway reverse proxy code. If you are using the HTTP/JSON interface you probably have to change the front-end too, which means making changes in two places. In gRPC-web, regenerating the files from the proto file will automatically update the front-end client. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/000077500000000000000000000000001465037340600251775ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/binary_file_uploads.md000066400000000000000000000026151465037340600315370ustar00rootroot00000000000000--- layout: default title: Binary file uploads nav_order: 2 parent: Mapping --- # Binary file uploads If you need to do a binary file upload, e.g. via; ```sh curl -X POST -F "attachment=@/tmp/somefile.txt" http://localhost:9090/v1/files ``` then your request will contain the binary data directly and there is no way to model this using gRPC. What you can do instead is to add a custom route directly on the `mux` instance. ## Custom route on a mux instance Here we'll setup a handler (`handleBinaryFileUpload`) for `POST` requests: ```go // Create a mux instance mux := runtime.NewServeMux() // Attachment upload from http/s handled manually mux.HandlePath("POST", "/v1/files", handleBinaryFileUpload) ``` And then in your handler you can do something like: ```go func handleBinaryFileUpload(w http.ResponseWriter, r *http.Request, params map[string]string) { err := r.ParseForm() if err != nil { http.Error(w, fmt.Sprintf("failed to parse form: %s", err.Error()), http.StatusBadRequest) return } f, header, err := r.FormFile("attachment") if err != nil { http.Error(w, fmt.Sprintf("failed to get file 'attachment': %s", err.Error()), http.StatusBadRequest) return } defer f.Close() // // Now do something with the io.Reader in `f`, i.e. read it into a buffer or stream it to a gRPC client side stream. // Also `header` will contain the filename, size etc of the original file. // } ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/customizing_openapi_output.md000066400000000000000000000675501465037340600332440ustar00rootroot00000000000000--- layout: default title: Customizing OpenAPI Output nav_order: 4 parent: Mapping --- {% raw %} # Customizing OpenAPI Output ## In proto comments You can provide comments directly in your Protocol Buffer definitions and they will be translated into comments in the generated OpenAPI definitions: ```protobuf message MyMessage { // This comment will end up direcly in your Open API definition string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The UUID field."}]; } ``` You can disable this behavior and exclude all protobuf comments from OpenAPI output via the `ignore_comments` option. ## Using proto options You can define options on your Protocol Buffer services, operations, messages, and field definitions to customize your Open API output. For instance, to customize the [OpenAPI Schema Object](https://swagger.io/specification/v2/#schemaObject) for messages and fields: ```protobuf import "protoc-gen-openapiv2/options/annotations.proto"; message ABitOfEverything { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { json_schema: { title: "A bit of everything" description: "Intentionaly complicated message type to cover many features of Protobuf." required: ["uuid", "int64_value", "double_value"] } external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more about ABitOfEverything"; } example: "{\"uuid\": \"0cf361e1-4b44-483d-a159-54dabdf7e814\"}" extensions: { key: "x-irreversible"; value { bool_value: true; } } }; string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The UUID field."}]; } ``` Operations can also be customized: ```protobuf service ABitOfEverythingService { rpc Delete(grpc.gateway.examples.internal.proto.sub2.IdMessage) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: { security_requirement: { key: "ApiKeyAuth"; value: {} } security_requirement: { key: "OAuth2"; value: { scope: "read"; scope: "write"; } } } extensions: { key: "x-irreversible"; value { bool_value: true; } } }; } } ``` [Swagger Extensions](https://swagger.io/docs/specification/2-0/swagger-extensions/) can be added as key-value pairs to the options. Keys must begin with `x-` and values can be of any type listed [here](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#value). For example: ``` extensions: { key: "x-amazon-apigateway-authorizer"; value { struct_value { fields { key: "type"; value { string_value: "token"; } } fields { key: "authorizerResultTtlInSeconds"; value { number_value: 60; } } } } } ``` Please see this [a_bit_of_everything.proto](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples of the options being used. ## Using google.api.field_behavior Google provides an [field option](https://github.com/googleapis/googleapis/blob/master/google/api/field_behavior.proto) for defining the behavior of fields that is also supported: ```protobuf import "google/api/field_behavior.proto"; message MyMessage { string a_required_field = 1 [(google.api.field_behavior) = REQUIRED]; } ``` The following options are used in the Open API output: - `REQUIRED` - marks a field as required - `OUTPUT_ONLY` - marks a field as readonly Google defines a couple of other options - `OPTIONAL`, `IMMUTABLE`, `INPUT_ONLY` - that are not currently used. `OPTIONAL` support is currently under discussion in [this issue](https://github.com/grpc-ecosystem/grpc-gateway/issues/669). For `IMMUTABLE` and `INPUT_ONLY` fields, there is an [open issue](https://github.com/OAI/OpenAPI-Specification/issues/1497) in the Open API specification for adding functionality for write-once or immutable fields to the spec. ## Using go templates in proto file comments Use [Go templates](https://golang.org/pkg/text/template/) in your proto file comments to allow more advanced documentation such as: - Documentation about fields in the proto objects. - Import the content of external files (such as [Markdown](https://en.wikipedia.org/wiki/Markdown)). ### How to use it By default this function is turned off, so if you want to use it you have to add the `use_go_templates` option: ```sh --openapiv2_out . --openapiv2_opt use_go_templates=true ``` or: ```sh --openapiv2_out=use_go_templates=true:. ``` #### Example script Example of a bash script with the `use_go_templates` flag set to true: ```sh $ protoc -I. \ --go_out . --go-grpc_out . \ --grpc-gateway_out . \ --openapiv2_out . \ --openapiv2_opt use_go_templates=true \ path/to/my/proto/v1/myproto.proto ``` #### Example proto file Example of a proto file with Go templates. This proto file imports documentation from another file, `tables.md`: ```protobuf service LoginService { // Login // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // {{import "tables.md"}} rpc Login (LoginRequest) returns (LoginReply) { option (google.api.http) = { post: "/v1/example/login" body: "*" }; } } message LoginRequest { // The entered username string username = 1; // The entered password string password = 2; } message LoginReply { // Whether you have access or not bool access = 1; } ``` The content of `tables.md`: ```markdown ## {{.RequestType.Name}} | Field ID | Name | Type | Description | | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} ## {{.ResponseType.Name}} | Field ID | Name | Type | Description | | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} ``` ### OpenAPI output #### SwaggerUI This is how the OpenAPI file would be rendered in [Swagger UI](https://swagger.io/tools/swagger-ui/). ![Screenshot OpenAPI file in SwaggerUI](../../assets/images/gotemplates/swaggerui.png) #### Postman This is how the OpenAPI file would be rendered in [Postman](https://www.getpostman.com/). ![Screenshot OpenAPI file in Postman](../../assets/images/gotemplates/postman.png) For a more detailed example of a proto file that has Go, templates enabled, [see the examples](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/use_go_template.proto). ### Using custom values Custom values can be specified in the [Go templates](https://golang.org/pkg/text/template/) that generate your proto file comments. A use case might be to interpolate different external documentation URLs when rendering documentation for different environments. #### How to use it The `use_go_templates` option has to be enabled as a prerequisite. Provide customized values in the format of `go_template_args=my_key=my_value`. `{{arg "my_key"}}` will be replaced with `my_value` in the Go template. Specify the `go_template_args` option multiple times if needed. ```sh --openapiv2_out . --openapiv2_opt use_go_templates=true --openapiv2_opt go_template_args=my_key1=my_value1 --openapiv2_opt go_template_args=my_key2=my_value2 ... ``` #### Example script Example of a bash script with the `use_go_templates` flag set to true and custom template values set: ```sh $ protoc -I. \ --go_out . --go-grpc_out . \ --grpc-gateway_out . \ --openapiv2_out . \ --openapiv2_opt use_go_templates=true \ --openapiv2_opt go_template_args=environment=test1 \ --openapiv2_opt go_template_args=environment_label=Test1 \ path/to/my/proto/v1/myproto.proto ``` #### Example proto file Example of a proto file with Go templates and custom values: ```protobuf service LoginService { // Login (Environment: {{arg "environment_label"}}) // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // This only works in the {{arg "environment"}} domain. // rpc Login (LoginRequest) returns (LoginReply) { option (google.api.http) = { post: "/v1/example/login" body: "*" }; } } ``` ## Other plugin options A comprehensive list of OpenAPI plugin options can be found [here](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/protoc-gen-openapiv2/main.go). Options can be passed via `protoc` CLI: ```sh --openapiv2_out . --openapiv2_opt bar=baz,color=red ``` Or, with `buf` in `buf.gen.yaml`: ```yaml - name: openapiv2 out: foo opt: bar=baz,color=red ``` ### Merging output If your protobuf definitions are spread across multiple files, the OpenAPI plugin will create a file for each `.proto` input. This may make sense for Go bindings, since they still share a package space, but fragmenting OpenAPI specifications across multiple files changes the schema itself. To merge disparate `.proto` inputs into a single OpenAPI file, use the `allow_merge` and `merge_file_name` options. `opt: allow_merge=true,merge_file_name=foo` will result in a single `foo.swagger.json`. Note that you may need to set the [generation strategy](https://docs.buf.build/configuration/v1/buf-gen-yaml/#strategy) to `all` when merging many files: ```yaml - name: openapiv2 out: foo strategy: all opt: allow_merge=true,merge_file_name=foo ``` ### Enums as integers To generate enums as integers instead of strings, use `enums_as_ints`. `opt: enums_as_ints=true` will result in: ```json { "name": "enumValue", "description": " - Example enums", "in": "query", "required": false, "type": "int", "enum": [ 0, 1 ], "default": 0 }, ``` ### Omitting the default value of enums If you define enum types with non default value such as declaring 0 value with UNKNOWN and want to omit the default value from generated swagger file, use `omit_enum_default_value`. This option also applies if enums_as_ints option is enalbled to generate enums as integer. `opt: omit_enum_default_value=true` will result in: Input Example: ``` enum enumValue { UNKNOWN = 0; FOO = 1; } ``` Output json: ```json { "name": "enumValue", "description": " - Example enums", "in": "query", "required": false, "type": "string", "enum": [ "FOO" ] }, ``` ### Hiding fields, methods, services and enum values If you require internal or unreleased fields and APIs to be hidden from your API documentation, [`google.api.VisibilityRule`](https://github.com/googleapis/googleapis/blob/9916192ab15e3507e41ba2c5165182fec06120d0/google/api/visibility.proto#L89) annotations can be added to customize where they are generated. Combined with the option `visibility_restriction_selectors`, overlapping rules will appear in the OpenAPI output. `visibility_restriction_selectors` can be declared multiple times as an option to include multiple visibility restrictions in the output. e.g. if you are using `buf`: ```yaml version: v1 plugins: - name: openapiv2 out: . opt: - visibility_restriction_selectors=PREVIEW - visibility_restriction_selectors=INTERNAL ``` or with `protoc` ```sh protoc --openapiv2_out=. --openapiv2_opt=visibility_restriction_selectors=PREVIEW --openapiv2_opt=visibility_restriction_selectors=INTERNAL ./path/to/file.proto ``` Elements without `google.api.VisibilityRule` annotations will appear as usual in the generated output. These restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want. In this example we use `INTERNAL` and `PREVIEW`, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish. Note: Annotations are only supported on Services, Methods, Fields and Enum Values. `opt: visibility_restriction_selectors=PREVIEW` will result in: Input Example: ```protobuf service Echo { rpc EchoInternal(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.method_visibility).restriction = "INTERNAL"; option (google.api.http) = { get: "/v1/example/echo_internal" }; } rpc EchoInternalAndPreview(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.method_visibility).restriction = "INTERNAL,PREVIEW"; option (google.api.http) = { get: "/v1/example/echo_internal_and_preview" }; } } message VisibilityRuleSimpleMessage { enum VisibilityEnum { UNSPECIFIED = 0; VISIBLE = 1; INTERNAL = 2 [(google.api.value_visibility).restriction = "INTERNAL"]; PREVIEW = 3 [(google.api.value_visibility).restriction = "INTERNAL,PREVIEW"]; } string internal_field = 1 [(google.api.field_visibility).restriction = "INTERNAL"]; string preview_field = 2 [(google.api.field_visibility).restriction = "INTERNAL,PREVIEW"]; VisibilityEnum an_enum = 3; } ``` Output json: ```json { "paths": { "/v1/example/echo_internal_and_preview": { "get": { "summary": "EchoInternalAndPreview is a internal and preview API that should be visible in the OpenAPI spec.", "operationId": "VisibilityRuleEchoService_EchoInternalAndPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "UNSPECIFIED", "VISIBLE", "PREVIEW" ], "default": "UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } } } } ``` For a more in depth example see [visibility_rule_echo_service.proto](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/visibility_rule_echo_service.proto) and the following output files for different values of `visibility_restriction_selectors`: - [`visibility_restriction_selectors=PREVIEW`](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/visibility_rule_preview_echo_service.swagger.json) - [`visibility_restriction_selectors=INTERNAL`](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/visibility_rule_internal_echo_service.swagger.json) - [`visibility_restriction_selectors=INTERNAL,visibility_restriction_selectors=PREVIEW`](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/visibility_rule_preview_and_internal_echo_service.swagger.json) - [Not set](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/visibility_rule_none_echo_service.swagger.json) ### Path parameters When defining HTTP bindings with path parameters that contain multiple path segments, as suggested by the [Google AIPs](https://google.aip.dev/), the path parameter names are numbered to avoid generating duplicate paths in the OpenAPI file. For example, consider: ```protobuf service LibraryService { rpc GetShelf(GetShelfRequest) returns (Shelf) { option (google.api.http) = { get: "/v1/{name=shelves/*}" }; } rpc GetBook(GetBookRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=shelves/*/books/*}" }; } } message GetShelfRequest { string name = 1; } message GetBookRequest { string name = 1; } ``` This will generate the following paths: - `/v1/{name}` - `/v1/{name_1}` To override the path parameter names, annotate the field used as path parameter: ```protobuf message GetShelfRequest { string name = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {field_configuration: {path_param_name: "shelfName"}}]; } message GetBookRequest { string name = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {field_configuration: {path_param_name: "bookName"}}]; } ``` This will instead generate the following paths: - `/v1/{shelfName}` - `/v1/{bookName}` Note that path parameters in OpenAPI does not support values with `/`, as discussed in [Support for path parameters which can contain slashes #892](https://github.com/OAI/OpenAPI-Specification/issues/892), so tools as Swagger UI will URL encode any `/` provided as parameter value. A possible workaround for this is to write a custom post processor for your OAS file to replace any path parameter with `/` into multiple parameters. ### Output format By default the output format is JSON, but it is possible to configure it using the `output_format` option. Allowed values are: `json`, `yaml`. The output format will also change the extension of the output files. For example, if using `buf`: ```yaml - name: openapiv2 out: pkg opt: output_format=yaml ``` Input example: ```protobuf syntax = "proto3"; package helloproto.v1; option go_package = "helloproto/v1;helloproto"; import "google/api/annotations.proto"; service EchoService { rpc Hello(HelloReq) returns (HelloResp) { option (google.api.http) = { get: "/api/hello" }; } } message HelloReq { string name = 1; } message HelloResp { string message = 1; } ``` Output: ```yaml swagger: "2.0" info: title: helloproto/v1/example.proto version: version not set tags: - name: EchoService consumes: - application/json produces: - application/json paths: /api/hello: get: operationId: EchoService_Hello responses: "200": description: A successful response. schema: $ref: '#/definitions/v1HelloResp' default: description: An unexpected error response. schema: $ref: '#/definitions/rpcStatus' parameters: - name: name in: query required: false type: string tags: - EchoService definitions: protobufAny: type: object properties: '@type': type: string additionalProperties: {} rpcStatus: type: object properties: code: type: integer format: int32 message: type: string details: type: array items: $ref: '#/definitions/protobufAny' v1HelloResp: type: object properties: message: type: string ``` ### Disable service tag generation By default service tags are generated for backend services, but it is possible to disable it using the `disable_service_tags` option. Allowed values are: `true`, `false`. For example, if you are using `buf`: ```yaml version: v1 plugins: - name: openapiv2 out: . opt: - disable_service_tags=true ``` or with `protoc` ```sh protoc --openapiv2_out=. --openapiv2_opt=disable_service_tags=true ./path/to/file.proto ``` Input example: ```protobuf syntax = "proto3"; package helloproto.v1; option go_package = "helloproto/v1;helloproto"; import "google/api/annotations.proto"; service EchoService { rpc Hello(HelloReq) returns (HelloResp) { option (google.api.http) = { get: "/api/hello" }; } } message HelloReq { string name = 1; } message HelloResp { string message = 1; } ``` Output (tags object are not generated): ```yaml swagger: "2.0" info: title: helloproto/v1/example.proto version: version not set consumes: - application/json produces: - application/json paths: /api/hello: get: operationId: EchoService_Hello ``` ### Disable default responses By default a 200 OK response is rendered for each service operation. But it is possible to disable this and explicitly define your service's responses, using the `disable_default_responses` option. Allowed values are: `true`, `false`. **Note**: This does not alter the behavior of the gateway itself and should be coupled with a `ForwardResponseWriter` when altering status codes, see [Controlling HTTP Response Codes](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_your_gateway/#controlling-http-response-status-codes). For example, if you are using `buf`: ```yaml version: v1 plugins: - name: openapiv2 out: . opt: - disable_default_responses=true ``` or with `protoc` ```sh protoc --openapiv2_out=. --openapiv2_opt=disable_default_responses=true ./path/to/file.proto ``` Input example: ```protobuf syntax = "proto3"; package helloproto.v1; import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "helloproto/v1;helloproto"; service EchoService { rpc Hello(HelloReq) returns (HelloResp) { option (google.api.http) = {get: "/api/hello"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { responses: { key: "201", value: { description: "Created"; schema: { json_schema: {ref: ".helloproto.v1.HelloResp"} } } }; }; } } message HelloReq { string name = 1; } message HelloResp { string message = 1; } ``` Output (default response not generated): ```yaml swagger: "2.0" info: title: helloproto/v1/hello.proto version: version not set consumes: - application/json produces: - application/json paths: /api/hello: get: operationId: EchoService_Hello responses: "201": description: Created schema: $ref: "#/definitions/v1HelloResp" parameters: - name: name in: query required: false type: string definitions: v1HelloResp: type: object properties: message: type: string ``` ### Custom HTTP Header Request Parameters By default the parameters for each operation are generated from the protocol buffer definition however you can extend the parameters to include extra HTTP headers if required. **NOTE**: These annotations do not alter the behaviour of the gateway and must be coupled with custom header parsing behaviour in the application. Also be aware that adding header parameters can alter the forwards and backwards compatibility of the schema. You must also set a type for your header which can be one of `STRING`, `INTEGER`, `NUMBER` or `BOOLEAN`. ```protobuf syntax = "proto3"; package helloproto.v1; import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "helloproto/v1;helloproto"; service EchoService { rpc Hello(HelloReq) returns (HelloResp) { option (google.api.http) = {get: "/api/hello"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { parameters: { headers: { name: "X-Foo"; description: "Foo Header"; type: STRING, required: true; }; headers: { name: "X-Bar"; description: "Bar Header"; type: NUMBER, }; }; }; } } message HelloReq { string name = 1; } message HelloResp { string message = 1; } ``` Output: ```yaml swagger: "2.0" info: title: helloproto/v1/hello.proto version: version not set consumes: - application/json produces: - application/json paths: /api/hello: get: operationId: Hello responses: "200": description: A successful response. schema: $ref: "#/definitions/helloproto.v1.HelloResp" parameters: - name: name in: query required: false type: string - name: X-Foo description: Foo Header in: header required: true type: string - name: X-Bar description: Bar Header in: header required: false type: number definitions: helloproto.v1.HelloResp: type: object properties: message: type: string ``` ### Ignore comments If you want to exclude all protobuf comments (such as `// buf:lint:ignore`) from OpenAPI output, use the `ignore_comments` option. Allowed values are: `true`, `false`. **Note**: `ignore_comments` and `use_go_templates` are mutually exclusive and cannot be enabled at the same time. If you are using `buf`: ```yaml version: v1 plugins: - name: openapiv2 out: . opt: - ignore_comments=true ``` or with `protoc`: ```sh protoc --openapiv2_out=. --openapiv2_opt=ignore_comments=true ./path/to/file.proto ``` ### Removing internal comments If you want to remove internal comments from the from OpenAPI output (such as `TODO` and `FIXME` directives) you can use the `remove_internal_comments` option. If set to `true`, this will remove all comment text located between `(--` and `--)` as per [AIP 192: Internal comments](https://google.aip.dev/192#internal-comments). ### Preserve RPC Path Order By default, generated Swagger files emit paths found in proto files in alphabetical order. If you would like to preserve the order of emitted paths to mirror the path order found in proto files, you can use the `preserve_rpc_order` option. If set to `true`, this option will ensure path ordering is preserved for Swagger files with both json and yaml formats. This option will also ensure path ordering is preserved in the following scenarios: 1. When using additional bindings, paths will preserve their ordering within an RPC. 2. When using multiple services, paths will preserve their ordering between RPCs in the whole protobuf file. 3. When merging protobuf files, paths will preserve their ordering depending on the order of files specified on the command line. `preserve_rpc_order` can be passed via the `protoc` CLI: ```sh protoc --openapiv2_out=. --openapiv2_opt=preserve_rpc_order=true ./path/to/file.proto ``` Or, with `buf` in `buf.gen.yaml`: ```yaml version: v1 plugins: - name: openapiv2 out: . opt: - preserve_rpc_order=true ``` {% endraw %} golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/customizing_your_gateway.md000066400000000000000000000323661465037340600327050ustar00rootroot00000000000000--- layout: default title: Customizing your gateway nav_order: 5 parent: Mapping --- # Customizing your gateway ## Message serialization ### Custom serializer You might want to serialize request/response messages in MessagePack instead of JSON, for example: 1. Write a custom implementation of [`Marshaler`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#Marshaler). 2. Register your marshaler with [`WithMarshalerOption`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#WithMarshalerOption). e.g. ```go var m your.MsgPackMarshaler mux := runtime.NewServeMux( runtime.WithMarshalerOption("application/x-msgpack", m), ) ``` You can see [the default implementation for JSON](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/runtime/marshal_jsonpb.go) for reference. ### Using proto names in JSON The protocol buffer compiler generates camelCase JSON tags that are used by default. If you want to use the exact case used in the proto files, set `UseProtoNames: true`: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }), ) ``` ### Pretty-print JSON responses when queried with ?pretty You can have Elasticsearch-style `?pretty` support in your gateway's endpoints as follows: 1. Wrap the ServeMux using a stdlib [`http.HandlerFunc`](https://golang.org/pkg/net/http/#HandlerFunc) that translates the provided query parameter into a custom `Accept` header. 2. Register a pretty-printing marshaler for that MIME code. For example: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption("application/json+pretty", &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ Indent: " ", Multiline: true, // Optional, implied by presence of "Indent". }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }), ) prettier := func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // checking Values as map[string][]string also catches ?pretty and ?pretty= // r.URL.Query().Get("pretty") would not. if _, ok := r.URL.Query()["pretty"]; ok { r.Header.Set("Accept", "application/json+pretty") } h.ServeHTTP(w, r) }) } http.ListenAndServe(":8080", prettier(mux)) ``` Now, either when passing the header `Accept: application/json+pretty` or appending `?pretty` to your HTTP endpoints, the response will be pretty-printed. Note that this will conflict with any methods having input messages with fields named `pretty`; also, this example code does not remove the query parameter `pretty` from further processing. ## Customize unmarshaling per Content-Type Having different unmarshaling options per Content-Type is as easy as configuring a custom marshaler: ```go mux := runtime.NewServeMux( runtime.WithMarshalerOption("application/json+strict", &runtime.JSONPb{ UnmarshalOptions: &protojson.UnmarshalOptions{ DiscardUnknown: false, // explicit "false", &protojson.UnmarshalOptions{} would have the same effect }, }), ) ``` ## Mapping from HTTP request headers to gRPC client metadata You might not like [the default mapping rule](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#DefaultHeaderMatcher) and might want to pass through all the HTTP headers, for example: 1. Write a [`HeaderMatcherFunc`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#HeaderMatcherFunc). 2. Register the function with [`WithIncomingHeaderMatcher`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#WithIncomingHeaderMatcher) e.g. ```go func CustomMatcher(key string) (string, bool) { switch key { case "X-Custom-Header1": return key, true case "X-Custom-Header2": return "custom-header2", true default: return key, false } } mux := runtime.NewServeMux( runtime.WithIncomingHeaderMatcher(CustomMatcher), ) ``` To keep the [the default mapping rule](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#DefaultHeaderMatcher) alongside with your own rules write: ```go func CustomMatcher(key string) (string, bool) { switch key { case "X-User-Id": return key, true default: return runtime.DefaultHeaderMatcher(key) } } ``` It will work with both: ```sh $ curl --header "x-user-id: 100d9f38-2777-4ee2-ac3b-b3a108f81a30" ... ``` and ```sh $ curl --header "X-USER-ID: 100d9f38-2777-4ee2-ac3b-b3a108f81a30" ... ``` To access this header on gRPC server side use: ```go userID := "" if md, ok := metadata.FromIncomingContext(ctx); ok { if uID, ok := md["x-user-id"]; ok { userID = strings.Join(uID, ",") } } ``` ## Mapping from gRPC server metadata to HTTP response headers Use [`WithOutgoingHeaderMatcher`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#WithOutgoingHeaderMatcher). See [gRPC metadata docs](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md) for more info on sending / receiving gRPC metadata, for example: ```go if appendCustomHeader { grpc.SendHeader(ctx, metadata.New(map[string]string{ "x-custom-header1": "value", })) } ``` ## Mutate response messages or set response headers ### Set HTTP headers You might want to return a subset of response fields as HTTP response headers; You might want to simply set an application-specific token in a header. Or you might want to mutate the response messages to be returned. 1. Write a filter function. ```go func myFilter(ctx context.Context, w http.ResponseWriter, resp proto.Message) error { t, ok := resp.(*externalpb.Tokenizer) if ok { w.Header().Set("X-My-Tracking-Token", t.Token) t.Token = "" } return nil } ``` 2. Register the filter with [`WithForwardResponseOption`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#WithForwardResponseOption) e.g. ```go mux := runtime.NewServeMux( runtime.WithForwardResponseOption(myFilter), ) ``` ### Controlling HTTP response status codes To have the most control over the HTTP response status codes, you can use custom metadata. While handling the rpc, set the intended status code: ```go _ = grpc.SetHeader(ctx, metadata.Pairs("x-http-code", "401")) ``` Now, before sending the HTTP response, we need to check for this metadata pair and explicitly set the status code for the response if found. To do so, create a function and hook it into the gRPC-Gateway as a Forward Response Option. The function looks like this: ```go func httpResponseModifier(ctx context.Context, w http.ResponseWriter, p proto.Message) error { md, ok := runtime.ServerMetadataFromContext(ctx) if !ok { return nil } // set http status code if vals := md.HeaderMD.Get("x-http-code"); len(vals) > 0 { code, err := strconv.Atoi(vals[0]) if err != nil { return err } // delete the headers to not expose any grpc-metadata in http response delete(md.HeaderMD, "x-http-code") delete(w.Header(), "Grpc-Metadata-X-Http-Code") w.WriteHeader(code) } return nil } ``` And it gets hooked into the gRPC-Gateway with: ```go gwMux := runtime.NewServeMux( runtime.WithForwardResponseOption(httpResponseModifier), ) ``` Additional responses can be added to the Protocol Buffer definitions to match the new status codes: ```protobuf service Greeter { rpc SayHello (HelloRequest) returns (HelloReply) { option (google.api.http) = { post: "/v1/example/echo" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { responses: { key: "201" value: { description: "A successful response." schema: { json_schema: { ref: ".mypackage.HelloReply" } } } } }; } rpc SayGoodbye (GoodbyeRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/example/echo/{id}" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { responses: { key: "204" value: { description: "A successful response." schema: {} } } }; } } ``` ## Error handler To override error handling for a `*runtime.ServeMux`, use the `runtime.WithErrorHandler` option. This will configure all unary error responses to pass through this error handler. ## Stream Error Handler The error handler described in the previous section applies only to RPC methods that have a unary response. When the method has a streaming response, gRPC-Gateway handles that by emitting a newline-separated stream of "chunks". Each chunk is an envelope that can contain either a response message or an error. Only the last chunk will include an error, and only when the RPC handler ends abnormally (i.e. with an error code). Because of the way the errors are included in the response body, the other error handler signature is insufficient. So for server streams, you must install a _different_ error handler: ```go mux := runtime.NewServeMux( runtime.WithStreamErrorHandler(handleStreamError), ) ``` The signature of the handler is much more rigid because we need to know the structure of the error payload to properly encode the "chunk" schema into an OpenAPI spec. So the function must return a `*runtime.StreamError`. The handler can choose to omit some fields and can filter/transform the original error, such as stripping stack traces from error messages. Here's an example custom handler: ```go // handleStreamError overrides default behavior for computing an error // message for a server stream. // // It uses a default "502 Bad Gateway" HTTP code, only emits "safe" // messages and does not set the details field (so it will // be omitted from the resulting JSON object that is sent to client). func handleStreamError(ctx context.Context, err error) *status.Status { code := codes.Internal msg := "unexpected error" if s, ok := status.FromError(err); ok { code = s.Code() // default message, based on the gRPC status msg = s.Message() // see if error details include "safe" message to send // to external callers for _, msg := range s.Details() { if safe, ok := msg.(*SafeMessage); ok { msg = safe.Text break } } } return status.Errorf(code, msg) } ``` If no custom handler is provided, the default stream error handler will include any gRPC error attributes (code, message, detail messages), if the error being reported includes them. If the error does not have these attributes, a gRPC code of `Unknown` (2) is reported. ## Controlling path parameter unescaping By default, gRPC-Gateway unescapes the entire URL path string attempting to route a request. This causes routing errors when the path parameter contains an illegal character such as `/`. To replicate the behavior described in [google.api.http](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L224), use [runtime.WithUnescapingMode()](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#WithUnescapingMode) to configure the unescaping behavior, as in the example below: ```go mux := runtime.NewServeMux( runtime.WithUnescapingMode(runtime.UnescapingModeAllExceptReserved), ) ``` For multi-segment parameters (e.g. `{id=**}`) [RFC 6570](https://tools.ietf.org/html/rfc6570) Reserved Expansion characters are left escaped and the gRPC API will need to unescape them. To replicate the default V2 escaping behavior but also allow passing pct-encoded `/` characters, the ServeMux can be configured as in the example below: ```go mux := runtime.NewServeMux( runtime.WithUnescapingMode(runtime.UnescapingModeAllCharacters), ) ``` ## Routing Error handler To override the error behavior when `*runtime.ServeMux` was not able to serve the request due to routing issues, use the `runtime.WithRoutingErrorHandler` option. This will configure all HTTP routing errors to pass through this error handler. The default behavior is to map HTTP error codes to gRPC errors. HTTP statuses and their mappings to gRPC statuses: - HTTP `404 Not Found` -> gRPC `5 NOT_FOUND` - HTTP `405 Method Not Allowed` -> gRPC `12 UNIMPLEMENTED` - HTTP `400 Bad Request` -> gRPC `3 INVALID_ARGUMENT` This method is not used outside of the initial routing. ### Customizing Routing Errors If you want to retain HTTP `405 Method Not Allowed` instead of allowing it to be converted to the equivalent of the gRPC `12 UNIMPLEMENTED`, which is HTTP `501 Not Implmented` you can use the following example: ```go func handleRoutingError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, httpStatus int) { if httpStatus != http.StatusMethodNotAllowed { runtime.DefaultRoutingErrorHandler(ctx, mux, marshaler, w, r, httpStatus) return } // Use HTTPStatusError to customize the DefaultHTTPErrorHandler status code err := &runtime.HTTPStatusError{ HTTPStatus: httpStatus, Err: status.Error(codes.Unimplemented, http.StatusText(httpStatus)), } runtime.DefaultHTTPErrorHandler(ctx, mux, marshaler, w, r, err) } ``` To use this routing error handler, construct the mux as follows: ```go mux := runtime.NewServeMux( runtime.WithRoutingErrorHandler(handleRoutingError), ) ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/examples.md000066400000000000000000000050271465037340600273430ustar00rootroot00000000000000--- layout: default title: Examples nav_order: 0 parent: Mapping --- # Examples Examples are available under `examples/internal` directory. - [`proto/examplepb/echo_service.proto`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/echo_service.proto), [`proto/examplepb/a_bit_of_everything.proto`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/a_bit_of_everything.proto), [`proto/examplepb/unannotated_echo_service.proto`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.proto): protobuf service definitions. - [`proto/examplepb/echo_service.pb.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/echo_service.pb.go), [`proto/examplepb/a_bit_of_everything.pb.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/a_bit_of_everything.pb.go), [`proto/examplepb/unannotated_echo_service.pb.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.pb.go): generated Go service stubs and types. - [`proto/examplepb/echo_service.pb.gw.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/echo_service.pb.gw.go), [`proto/examplepb/a_bit_of_everything.pb.gw.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go), [`proto/examplepb/unannotated_echo_service.pb.gw.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go): generated gRPC-Gateway clients. - [`proto/examplepb/unannotated_echo_service.yaml`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.yaml): gRPC API Configuration for `unannotated_echo_service.proto`. - [`server/main.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/server/main.go): service implementation. - [`main.go`](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/gateway/main.go): entrypoint of the generated reverse proxy. To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-Gateway, and a gRPC server, see [this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/grpc-protobufs-swagger.html)). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/grpc_api_configuration.md000066400000000000000000000137731465037340600322470ustar00rootroot00000000000000--- layout: default title: gRPC API Configuration nav_order: 3 parent: Mapping --- # gRPC API Configuration In some situations annotating the proto file of service is not an option. For example, you might not have control over the proto file, or you might want to expose the same gRPC API multiple times in completely different ways. gRPC-Gateway supports 2 ways of dealing with these situations: - [gRPC API Configuration](#grpc-api-configuration) - [`generate_unbound_methods`](#generate_unbound_methods) - [Using an external configuration file](#using-an-external-configuration-file) - [Usage of gRPC API Configuration YAML files](#usage-of-grpc-api-configuration-yaml-files) ## `generate_unbound_methods` Providing this parameter to the `protoc` plugin will make it produce the HTTP mapping even for methods without any `HttpRule` annotation. This is similar to how [Cloud Endpoints behaves](https://cloud.google.com/endpoints/docs/grpc/transcoding#where_to_configure_transcoding) and uses the way [gRPC itself](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) maps to HTTP/2: - HTTP method is `POST` - URI path is built from the service's name and method: `//` (e.g.: `/my.package.EchoService/Echo`) - HTTP body is the serialized protobuf message. NOTE: the same option is also supported by the `gen-openapiv2` plugin. ## Using an external configuration file Google Cloud Platform offers a way to do this for services hosted with them called ["gRPC API Configuration"](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config). It can be used to define the behavior of a gRPC API service without modifications to the service itself in the form of [YAML](https://en.wikipedia.org/wiki/YAML) configuration files. gRPC-Gateway generators implement the [HTTP rules part](https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#httprule) of this specification. This allows you to take a completely unannotated service proto file, add a YAML file describing its HTTP endpoints and use them together like an annotated proto file with the gRPC-Gateway generators. OpenAPI options may also be configured via ["OpenAPI Configuration"](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/internal/descriptor/openapiconfig/openapiconfig.proto) in the form of YAML configuration files. ### Usage of gRPC API Configuration YAML files The following is equivalent to the basic [`README.md`](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/README.md#usage) example but without direct annotation for gRPC-Gateway in the proto file. Only some steps require minor changes to use a gRPC API Configuration YAML file instead: 1. Define your service in gRPC as usual your_service.proto: ```protobuf syntax = "proto3"; package your.service.v1; option go_package = "github.com/yourorg/yourprotos/gen/go/your/service/v1"; message StringMessage { string value = 1; } service YourService { rpc Echo(StringMessage) returns (StringMessage) {} } ``` 2. Instead of annotating the proto file in this step leave it untouched and create a `your_service.yaml` with the following content: ```yaml type: google.api.Service config_version: 3 http: rules: - selector: your.service.v1.YourService.Echo post: /v1/example/echo body: "*" ``` Use a [linter](http://www.yamllint.com/) to validate your YAML. 3. Generate gRPC stub as before ```sh protoc -I . \ --go_out ./gen/go/ \ --go_opt paths=source_relative \ --go-grpc_out ./gen/go/ \ --go-grpc_opt paths=source_relative \ your/service/v1/your_service.proto ``` It will generate a stub file with path `./gen/go/your/service/v1/your_service.pb.go`. 4. Implement your service in gRPC as usual 5. Generate the reverse-proxy. Here we have to pass the path to the `your_service.yaml` in addition to the proto file: ```sh protoc -I . \ --grpc-gateway_out ./gen/go \ --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt grpc_api_configuration=path/to/your_service.yaml \ your/service/v1/your_service.proto ``` This will generate a reverse proxy `gen/go/your/service/v1/your_service.pb.gw.go` that is identical to the one produced for the annotated proto. In situations where you only need the reverse-proxy you can use the `standalone=true` option when generating the code. This will ensure the `types` used within `your_service.pb.gw.go` reference the external source appropriately. ``` protoc -I . \ --grpc-gateway_out ./gen/go \ --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt standalone=true \ --grpc-gateway_opt grpc_api_configuration=path/to/your_service.yaml \ your/service/v1/your_service.proto ``` 6. Generate the optional your_service.swagger.json ```sh protoc -I . --openapiv2_out ./gen/go \ --openapiv2_opt grpc_api_configuration=path/to/your_service.yaml \ your/service/v1/your_service.proto ``` or using an OpenAPI configuration file ```sh protoc -I . --openapiv2_out ./gen/go \ --openapiv2_opt grpc_api_configuration=path/to/your_service.yaml \ --openapiv2_opt openapi_configuration=path/to/your_service_swagger.yaml \ your/service/v1/your_service.proto ``` For an example of an OpenAPI configuration file, see [unannotated_echo_service.swagger.yaml](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.swagger.yaml), which adds OpenAPI options to [unannotated_echo_service.proto](https://github.com/grpc-ecosystem/grpc-gateway/tree/main/examples/internal/proto/examplepb/unannotated_echo_service.proto). ```sh protoc -I . --openapiv2_out ./gen/go \ --openapiv2_opt grpc_api_configuration=path/to/your_service.yaml \ your/service/v1/your_service.proto ``` All other steps work as before. If you want you can remove the `googleapis` include path in step 3 and 4 as the unannotated proto no longer requires them. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/httpbody_messages.md000066400000000000000000000032501465037340600312450ustar00rootroot00000000000000--- layout: default title: HttpBody Messages nav_order: 1 parent: Mapping --- # HttpBody Messages The [HTTPBody](https://github.com/googleapis/googleapis/blob/master/google/api/httpbody.proto) messages allow a response message to be specified with custom data content and a custom content-type header. The values included in the HTTPBody response will be used verbatim in the returned message from the gateway. Make sure you format your response carefully! ## Example Usage 1. Define your service in gRPC with an httpbody response message ```protobuf import "google/api/httpbody.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; service HttpBodyExampleService { rpc HelloWorld(google.protobuf.Empty) returns (google.api.HttpBody) { option (google.api.http) = { get: "/helloworld" }; } rpc Download(google.protobuf.Empty) returns (stream google.api.HttpBody) { option (google.api.http) = { get: "/download" }; } } ``` 3. Generate gRPC and reverse-proxy stubs and implement your service. ## Example service implementation ```go func (*HttpBodyExampleService) Helloworld(ctx context.Context, in *empty.Empty) (*httpbody.HttpBody, error) { return &httpbody.HttpBody{ ContentType: "text/html", Data: []byte("Hello World"), }, nil } func (HttpBodyExampleService) Download(_ *empty.Empty, stream HttpBodyExampleService_DownloadServer) error { msgs := []*httpbody.HttpBody{ { ContentType: "text/html", Data: []byte("Hello 1"), }, { ContentType: "text/html", Data: []byte("Hello 2"), }, } for _, msg := range msgs { if err := stream.Send(msg); err != nil { return err } } return nil } ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/index.md000066400000000000000000000001071465037340600266260ustar00rootroot00000000000000--- layout: default title: Mapping nav_order: 2 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/mapping/patch_feature.md000066400000000000000000000071611465037340600303400ustar00rootroot00000000000000--- layout: default title: Patch feature nav_order: 2 parent: Mapping --- # Patch feature The HTTP PATCH method allows a resource to be partially updated. If a binding is mapped to patch and the request message has exactly one FieldMask message in it, additional code is rendered for the gateway handler that will populate the FieldMask based on the request body. FieldMask is treated as a regular field by the gateway if the request method is not PATCH, or if the HttpRule body is `"*"` There are two scenarios: - The FieldMask is hidden from the REST request as per the [Google API design guide](https://cloud.google.com/apis/design/standard_methods#update) (as in the first additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/370d869f65d1ffb3d07187fb0db238eca2371ce3/examples/internal/proto/examplepb/a_bit_of_everything.proto#L428-L431) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. - By default this feature is enabled, if you need to disable it, you can use the plugin option `allow_patch_feature=false`. - Note: The same option is supported by the `protoc-gen-openapiv2` plugin. - The FieldMask is exposed to the REST request (as in the second additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/370d869f65d1ffb3d07187fb0db238eca2371ce3/examples/internal/proto/examplepb/a_bit_of_everything.proto#L432-L435) example). For this case, the field mask is left untouched by the gateway. ## Example Usage 1. Create a PATCH request. The PATCH request needs to include the message and the update mask. ```protobuf // UpdateV2Request request for update includes the message and the update mask message UpdateV2Request { ABitOfEverything abe = 1; google.protobuf.FieldMask update_mask = 2; } ``` 2. Define your service in gRPC If you want to use PATCH with fieldmask hidden from REST request only include the request message in the body. ```protobuf rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { option (google.api.http) = { put: "/v2/example/a_bit_of_everything/{abe.uuid}" body: "abe" additional_bindings { patch: "/v2/example/a_bit_of_everything/{abe.uuid}" body: "abe" } }; } ``` If you want to use PATCH with fieldmask exposed to the REST request then include the entire request message. ```protobuf rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { option (google.api.http) = { patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" body: "*" }; } ``` 3. Generate gRPC and reverse-proxy stubs and implement your service. ## cURL examples In the example below, we will partially update our ABitOfEverything resource by passing only the field we want to change. Since we are using the endpoint with field mask hidden we only need to pass the field we want to change ("string_value") and it will keep everything else in our resource the same. ```sh $ curl \ --data '{"stringValue": "strprefix/foo"}' \ -X PATCH \ http://address:port/v2/example/a_bit_of_everything/1 ``` If we know what fields we want to update then we can use PATCH with field mask approach. For this, we need to pass the resource and the update_mask. Below only the "single_nested" will get updated because that is what we specify in the field_mask. ```sh $ curl \ --data '{"abe":{"singleNested":{"amount":457},"stringValue":"some value that will not get updated because not in the field mask"},"updateMask":"singleNested"}}' \ -X PATCH \ http://address:port/v2a/example/a_bit_of_everything/1 ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/000077500000000000000000000000001465037340600257275ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/annotated_context.md000066400000000000000000000032131465037340600317710ustar00rootroot00000000000000--- layout: default title: Extracting the HTTP path pattern for a request nav_order: 4 parent: Operations --- # Extracting the HTTP path pattern for a request It is often interesting to know what [HTTP path pattern](https://github.com/googleapis/googleapis/blob/869d32e2f0af2748ab530646053b23a2b80d9ca5/google/api/http.proto#L61-L87) was matched for a specific request, for example for metrics. This article explains how to extract the HTTP path pattern from the request context. ## Get HTTP Path pattern 1. Define the HTTP path in the proto annotation. For example: ```proto syntax = "proto3"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; service LoginService { rpc Login (LoginRequest) returns (LoginReply) { option (google.api.http) = { post: "/v1/example/login" body: "*" }; } } message LoginRequest {} message LoginReply {} ``` 2. At runtime, get the HTTP path pattern from the annotated context, for example using the `WithMetadata` function. You can pass data to your backend by adding them to the gRPC metadata or push them to a metrics server. ```go mux := runtime.NewServeMux( runtime.WithMetadata(func(ctx context.Context, r *http.Request) metadata.MD { md := make(map[string]string) if method, ok := runtime.RPCMethod(ctx); ok { md["method"] = method // /grpc.gateway.examples.internal.proto.examplepb.LoginService/Login } if pattern, ok := runtime.HTTPPathPattern(ctx); ok { md["pattern"] = pattern // /v1/example/login } return metadata.New(md) }), ) ```golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/aws_gateway_integration.md000066400000000000000000000017351465037340600331750ustar00rootroot00000000000000--- layout: default title: AWS gateway integration nav_order: 3 parent: Operations --- # AWS gateway integration ## Import OpenAPI documentation into AWS API Gateway The AWS API Gateway service allows importing of an OpenAPI specification to create a REST API. The process is very straightforward and can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html). Here are some tips to consider when importing the documentation: 1. Remove any circular dependencies (these aren't supported by the parser). 2. Remove security-related annotations (These annotations aren't well supported by the parser). 3. Max length of fields are reviewed by the parser but the errors aren't self-explanatory. Review the [specification](https://swagger.io/specification/v2/) to verify that the requirements are met. 4. API gateway errors aren't great, but you can use this [page](https://apidevtools.org/swagger-parser/online/) for structure validation. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/health_check.md000066400000000000000000000044631465037340600306620ustar00rootroot00000000000000--- layout: default title: Health check nav_order: 1 parent: Operations --- # Health check ## With the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md) To use the gRPC health checking protocol you must add the two health checking methods, `Watch` and `Check`. ## Registering the health server 1. Add `google.golang.org/grpc/health/grpc_health_v1` to your imports 2. Register the health server with `grpc_health_v1.RegisterHealthServer(grpcServer, yourService)` ## Adding the health check methods 1. Check method ```go func (s *serviceServer) Check(ctx context.Context, in *health.HealthCheckRequest) (*health.HealthCheckResponse, error) { return &health.HealthCheckResponse{Status: health.HealthCheckResponse_SERVING}, nil } ``` 2. Watch method ```go func (s *serviceServer) Watch(in *health.HealthCheckRequest, _ health.Health_WatchServer) error { // Example of how to register both methods but only implement the Check method. return status.Error(codes.Unimplemented, "unimplemented") } ``` 3. You can test the functionality with [GRPC health probe](https://github.com/grpc-ecosystem/grpc-health-probe). ## Adding `/healthz` endpoint to runtime.ServeMux To automatically register a `/healthz` endpoint in your `ServeMux` you can use the `ServeMuxOption` `WithHealthzEndpoint` which takes in a connection to your registered gRPC server. This endpoint will forward a request to the `Check` method described above to really check the health of the whole system, not only the gateway itself. If your server doesn't implement the health checking protocol each request to `/healthz` will result in the following: ```json {"code":12,"message":"unknown service grpc.health.v1.Health","details":[]} ``` If you've implemented multiple services in your server you can target specific services with the `?service=` query parameter. This will then be added to the `health.HealthCheckRequest` in the `Service` property. With that you can write your own logic to handle that in the health checking methods. Analogously, to register an `{/endpoint/path}` endpoint in your `ServeMux` with a user-defined endpoint path, you can use the `ServeMuxOption` `WithHealthEndpointAt`, which accepts a connection to your registered gRPC server together with a custom `endpointPath string` parameter. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/index.md000066400000000000000000000001121465037340600273520ustar00rootroot00000000000000--- layout: default title: Operations nav_order: 3 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/inject_router.md000066400000000000000000000024251465037340600311300ustar00rootroot00000000000000--- layout: default title: Adding custom routes to the mux nav_order: 0 parent: Operations --- # Adding custom routes to the mux The gRPC-Gateway allows you to add custom routes to the serve mux, for example, if you want to support a use case that isn't supported by the gRPC-Gateway, like file uploads. ## Example ```go package main import ( "context" "net/http" pb "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" ) func main() { ctx := context.TODO() mux := runtime.NewServeMux() // Register generated routes to mux err := pb.RegisterGreeterHandlerServer(ctx, mux, &GreeterServer{}) if err != nil { panic(err) } // Register custom route for GET /hello/{name} err = mux.HandlePath("GET", "/hello/{name}", func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { w.Write([]byte("hello " + pathParams["name"])) }) if err != nil { panic(err) } http.ListenAndServe(":8080", mux) } // GreeterServer is the server API for Greeter service. type GreeterServer struct { } // SayHello implement to say hello func (h *GreeterServer) SayHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloReply, error) { return &pb.HelloReply{ Message: "hello " + req.Name, }, nil } ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/logging.md000066400000000000000000000037531465037340600277070ustar00rootroot00000000000000--- layout: default title: Logging the request body pattern for a request nav_order: 5 parent: Operations --- # Logging the request body pattern for a request If you want to log the request body of incoming requests, you will need to buffer the body before it reaches the gateway. To log the request body, you can use a middleware `http.Handler` to buffer the request body before it's consumed. 1. Create a `http.Handler` middleware. The `logRequestBody` example middleware logs the request body when the response status code is not 200. ```go type logResponseWriter struct { http.ResponseWriter statusCode int } func (rsp *logResponseWriter) WriteHeader(code int) { rsp.statusCode = code rsp.ResponseWriter.WriteHeader(code) } // Unwrap returns the original http.ResponseWriter. This is necessary // to expose Flush() and Push() on the underlying response writer. func (rsp *logResponseWriter) Unwrap() http.ResponseWriter { return rsp.ResponseWriter } func newLogResponseWriter(w http.ResponseWriter) *logResponseWriter { return &logResponseWriter{w, http.StatusOK} } // logRequestBody logs the request body when the response status code is not 200. func logRequestBody(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { lw := newLogResponseWriter(w) // Note that buffering the entire request body could consume a lot of memory. body, err := io.ReadAll(r.Body) if err != nil { http.Error(w, fmt.Sprintf("failed to read body: %v", err), http.StatusBadRequest) return } clonedR := r.Clone(r.Context()) clonedR.Body = io.NopCloser(bytes.NewReader(body)) h.ServeHTTP(lw, clonedR) if lw.statusCode != http.StatusOK { grpclog.Errorf("http error %+v request body %+v", lw.statusCode, string(body)) } }) } ``` 2. Wrap the gateway serve mux with the `logRequestBody` middleware: ```go mux := runtime.NewServeMux() // Register generated gateway handlers s := &http.Server{ Handler: logRequestBody(mux), } ``` golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/operations/tracing.md000066400000000000000000000132341465037340600277030ustar00rootroot00000000000000--- layout: default title: Tracing nav_order: 2 parent: Operations --- # Tracing ## With [OpenCensus.io](https://opencensus.io/) and [AWS X-ray](https://aws.amazon.com/xray/) ### Adding tracing using AWS-Xray as the exporter This example uses the AWS-Xray exporter with a global trace setting. Note that AWS X-ray exporter does not handle any metrics only tracing. 1. Add the following imports ```go xray "contrib.go.opencensus.io/exporter/aws" "go.opencensus.io/plugin/ocgrpc" "go.opencensus.io/plugin/ochttp" "go.opencensus.io/trace" ``` 2. Register the AWS X-ray exporter for the GRPC server ```go xrayExporter, err := xray.NewExporter( xray.WithVersion("latest"), // Add your AWS region. xray.WithRegion("ap-southeast-1"), ) if err != nil { // Handle any error. } // Do not forget to call Flush() before the application terminates. defer xrayExporter.Flush() // Register the trace exporter. trace.RegisterExporter(xrayExporter) ``` 3. Add a global tracing configuration ```go // Always trace in this example. // In production this can be set to a trace.ProbabilitySampler. trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()}) ``` 4. Add `ocgrpc.ClientHandler` for tracing the gRPC client calls ```go conn, err := grpc.NewClient( // Other options goes here. // Add ocgrpc.ClientHandler for tracing the grpc client calls. grpc.WithStatsHandler(&ocgrpc.ClientHandler{}), ) ``` 5. Wrap the gateway mux with the OpenCensus HTTP handler ```go gwmux := runtime.NewServeMux() openCensusHandler := &ochttp.Handler{ Handler: gwmux, } gwServer := &http.Server{ Addr: "0.0.0.0:10000", Handler: openCensusHandler, }), } ``` ### Without a global configuration In this example we have added the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md) and we do not wish to trace any health checks. 1. Follow step `1`, `2` and `4` from the previous section. 2. Since we are not using a global configuration we can decide what paths we want to trace. ```go gwmux := runtime.NewServeMux() openCensusHandler := &ochttp.Handler{ Handler: gwmux, GetStartOptions: func(r *http.Request) trace.StartOptions { startOptions := trace.StartOptions{} if strings.HasPrefix(r.URL.Path, "/api") { // This example will always trace anything starting with /api. startOptions.Sampler = trace.AlwaysSample() } return startOptions }, } ``` 4. No global configuration means we have to use the [per span sampler](https://opencensus.io/tracing/sampling/#per-span-sampler). #### A method we want to trace ```go func (s *service) Name(ctx context.Context, req *pb.Request) (*pb.Response, error) { // Here we add the span ourselves. ctx, span := trace.StartSpan(ctx, "name.to.use.in.trace", trace. // Select a sampler that fits your implementation. WithSampler(trace.AlwaysSample())) defer span.End() /// Other stuff goes here. } ``` #### A method we do not wish to trace ```go func (s *service) Check(ctx context.Context, in *health.HealthCheckRequest) (*health.HealthCheckResponse, error) { // Note no span here. return &health.HealthCheckResponse{Status: health.HealthCheckResponse_SERVING}, nil } ``` ## OpenTracing Support If your project uses [OpenTracing](https://github.com/opentracing/opentracing-go) and you'd like spans to propagate through the gateway, you can add some middleware which parses the incoming HTTP headers to create a new span correctly. ```go import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" ) var grpcGatewayTag = opentracing.Tag{Key: string(ext.Component), Value: "grpc-gateway"} func tracingWrapper(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { parentSpanContext, err := opentracing.GlobalTracer().Extract( opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header)) if err == nil || err == opentracing.ErrSpanContextNotFound { serverSpan := opentracing.GlobalTracer().StartSpan( "ServeHTTP", // this is magical, it attaches the new span to the parent parentSpanContext, and creates an unparented one if empty. ext.RPCServerOption(parentSpanContext), grpcGatewayTag, ) r = r.WithContext(opentracing.ContextWithSpan(r.Context(), serverSpan)) defer serverSpan.Finish() } h.ServeHTTP(w, r) }) } // Then just wrap the mux returned by runtime.NewServeMux() like this if err := http.ListenAndServe(":8080", tracingWrapper(mux)); err != nil { log.Fatalf("failed to start gateway server on 8080: %v", err) } ``` Finally, don't forget to add a tracing interceptor when registering the services. E.g. ```go import ( "google.golang.org/grpc" "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing" ) opts := []grpc.DialOption{ grpc.WithUnaryInterceptor( grpc_opentracing.UnaryClientInterceptor( grpc_opentracing.WithTracer(opentracing.GlobalTracer()), ), ), } if err := pb.RegisterMyServiceHandlerFromEndpoint(ctx, mux, serviceEndpoint, opts); err != nil { log.Fatalf("could not register HTTP service: %v", err) } ``` ## OpenTelemetry If your project uses [OpenTelemetry](https://opentelemetry.io/) and you would like spans to propagate through the gateway, you can refer to the [OpenTelemetry gRPC-Gateway Boilerplate](https://github.com/iamrajiv/opentelemetry-grpc-gateway-boilerplate) project. This repository provides a sample project that showcases the integration of OpenTelemetry with gRPC-Gateway to set up an OpenTelemetry-enabled gRPC-Gateway REST server. The project includes a simple `SayHello` method implemented on the gRPC server that returns a greeting message to the client. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/overview/000077500000000000000000000000001465037340600254125ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/overview/background.md000066400000000000000000000013751465037340600300610ustar00rootroot00000000000000--- layout: default title: Background nav_order: 0 parent: Overview --- # Background gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/overview/index.md000066400000000000000000000001101465037340600270330ustar00rootroot00000000000000--- layout: default title: Overview nav_order: 1 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/overview/usage.md000066400000000000000000000003771465037340600270470ustar00rootroot00000000000000--- layout: default title: How do I use this? nav_order: 1 parent: Overview --- # How do I use this? Follow the [instructions](https://github.com/grpc-ecosystem/grpc-gateway#usage) in the [README](https://github.com/grpc-ecosystem/grpc-gateway#readme). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/related_projects.md000066400000000000000000000013741465037340600274240ustar00rootroot00000000000000--- layout: default title: Related projects nav_order: 8 --- # Related projects - [grpc-dynamic-gateway](https://github.com/konsumer/grpc-dynamic-gateway) A dynamically configured alternative to the grpc-gateway written in Node. - [rest2grpc](https://www.npmjs.com/package/rest2grpc) A statically configured alternative to the grpc-gateway written in Node. - The Envoy proxy [gRPC-JSON transcoder](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter) An Envoy proxy filter that translates incoming JSON requests to gRPC and back. - Google Cloud Platform [HTTP/JSON gRPC transcoding](https://cloud.google.com/endpoints/docs/grpc/transcoding) A GCP product that behaves like the grpc-gateway. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/000077500000000000000000000000001465037340600255725ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/adding_annotations.md000066400000000000000000000127421465037340600317650ustar00rootroot00000000000000--- layout: default title: Adding gRPC-Gateway annotations to an existing proto file nav_order: 4 parent: Tutorials --- # Adding gRPC-Gateway annotations to an existing proto file Now that we've got a working Go gRPC server, we need to add the gRPC-Gateway annotations. The annotations define how gRPC services map to the JSON request and response. When using protocol buffers, each RPC must define the HTTP method and path using the `google.api.http` annotation. So we will need to add the `google/api/http.proto` import to the proto file. We also need to add the HTTP->gRPC mapping we want. In this case, we're mapping `POST /v1/example/echo` to our `SayHello` RPC. ```protobuf syntax = "proto3"; package helloworld; import "google/api/annotations.proto"; // Here is the overall greeting service definition where we define all our endpoints service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply) { option (google.api.http) = { post: "/v1/example/echo" body: "*" }; } } // The request message containing the user's name message HelloRequest { string name = 1; } // The response message containing the greetings message HelloReply { string message = 1; } ``` See [a_bit_of_everything.proto](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples of more annotations you can add to customize gateway behavior. ## Generating the gRPC-Gateway stubs Now that we've got the gRPC-Gateway annotations added to the proto file, we need to use the gRPC-Gateway generator to generate the stubs. ### Using buf We'll need to add the gRPC-Gateway generator to the generation configuration: ```yaml version: v1 plugins: - plugin: go out: proto opt: paths=source_relative - plugin: go-grpc out: proto opt: paths=source_relative,require_unimplemented_servers=false - plugin: grpc-gateway out: proto opt: paths=source_relative ``` We'll also need to add the `googleapis` dependency to our `buf.yaml` file: ```yaml version: v1 name: buf.build/myuser/myrepo deps: - buf.build/googleapis/googleapis ``` Then we need to run `buf mod update` to select a version of the dependency to use. And that's it! Now if you run: ```sh $ buf generate ``` It should produce a `*.gw.pb.go` file. ### Using `protoc` Before we can generate the stubs with `protoc`, we need to copy some dependencies into our proto file structure. Copy a subset of the `googleapis` from the [official repository](https://github.com/googleapis/googleapis) to your local proto file structure. It should look like this afterwards: ``` proto ├── google │ └── api │ ├── annotations.proto │ └── http.proto └── helloworld └── hello_world.proto ``` Now we need to add the gRPC-Gateway generator to the `protoc` invocation: ```sh $ protoc -I ./proto \ --go_out ./proto --go_opt paths=source_relative \ --go-grpc_out ./proto --go-grpc_opt paths=source_relative \ --grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative \ ./proto/helloworld/hello_world.proto ``` This should generate a `*.gw.pb.go` file. We also need to add and serve the gRPC-Gateway mux in our `main.go` file. ```go package main import ( "context" "log" "net" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" helloworldpb "github.com/myuser/myrepo/proto/helloworld" ) type server struct{ helloworldpb.UnimplementedGreeterServer } func NewServer() *server { return &server{} } func (s *server) SayHello(ctx context.Context, in *helloworldpb.HelloRequest) (*helloworldpb.HelloReply, error) { return &helloworldpb.HelloReply{Message: in.Name + " world"}, nil } func main() { // Create a listener on TCP port lis, err := net.Listen("tcp", ":8080") if err != nil { log.Fatalln("Failed to listen:", err) } // Create a gRPC server object s := grpc.NewServer() // Attach the Greeter service to the server helloworldpb.RegisterGreeterServer(s, &server{}) // Serve gRPC server log.Println("Serving gRPC on 0.0.0.0:8080") go func() { log.Fatalln(s.Serve(lis)) }() // Create a client connection to the gRPC server we just started // This is where the gRPC-Gateway proxies the requests conn, err := grpc.NewClient( "0.0.0.0:8080", grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { log.Fatalln("Failed to dial server:", err) } gwmux := runtime.NewServeMux() // Register Greeter err = helloworldpb.RegisterGreeterHandler(context.Background(), gwmux, conn) if err != nil { log.Fatalln("Failed to register gateway:", err) } gwServer := &http.Server{ Addr: ":8090", Handler: gwmux, } log.Println("Serving gRPC-Gateway on http://0.0.0.0:8090") log.Fatalln(gwServer.ListenAndServe()) } ``` For more examples, please refer to [our boilerplate repository](https://github.com/johanbrandhorst/grpc-gateway-boilerplate). ## Testing the gRPC-Gateway Now we can start the server: ```sh $ go run main.go ``` Then we use cURL to send HTTP requests: ```sh $ curl -X POST -k http://localhost:8090/v1/example/echo -d '{"name": " hello"}' ``` ``` {"message":"hello world"} ``` Hopefully, that gives a bit of understanding of how to use the gRPC-Gateway. Full source code of hello world program can be found here [helloworld-grpc-gateway](https://github.com/iamrajiv/helloworld-grpc-gateway). [Next](learn_more.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/creating_main.go.md000066400000000000000000000026671465037340600313330ustar00rootroot00000000000000--- layout: default title: Creating main.go nav_order: 3 parent: Tutorials --- # Creating main.go Before creating `main.go` file we are assuming that the user has created a `go.mod` with the name `github.com/myuser/myrepo`, if not please refer to [Creating go.mod file](introduction.md#creating-gomod-file). The import here is using the path to the generated files in `proto/helloworld` relative to the root of the repository. ```go package main import ( "context" "log" "net" "google.golang.org/grpc" helloworldpb "github.com/myuser/myrepo/proto/helloworld" ) type server struct{ helloworldpb.UnimplementedGreeterServer } func NewServer() *server { return &server{} } func (s *server) SayHello(ctx context.Context, in *helloworldpb.HelloRequest) (*helloworldpb.HelloReply, error) { return &helloworldpb.HelloReply{Message: in.Name + " world"}, nil } func main() { // Create a listener on TCP port lis, err := net.Listen("tcp", ":8080") if err != nil { log.Fatalln("Failed to listen:", err) } // Create a gRPC server object s := grpc.NewServer() // Attach the Greeter service to the server helloworldpb.RegisterGreeterServer(s, &server{}) // Serve gRPC Server log.Println("Serving gRPC on 0.0.0.0:8080") log.Fatal(s.Serve(lis)) } ``` ## Read More For more refer to gRPC docs [https://grpc.io/docs/languages/go/](https://grpc.io/docs/languages/go/). [Next](adding_annotations.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/generating_stubs/000077500000000000000000000000001465037340600311355ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/generating_stubs/index.md000066400000000000000000000007661465037340600325770ustar00rootroot00000000000000--- layout: default title: Generating stubs parent: Tutorials nav_order: 2 has_children: true --- For generating the stubs, we have two alternatives: `protoc` and `buf`. `protoc` is the more classic generation experience that is used widely in the industry, but it has a pretty steep learning curve. `buf` is a newer tool that is built with user experience and speed in mind. It also offers linting and breaking change detection, something `protoc` doesn't offer. We offer instructions for both here. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/generating_stubs/using_buf.md000066400000000000000000000036411465037340600334440ustar00rootroot00000000000000--- layout: default title: Generating stubs using buf nav_order: 0 parent: Generating stubs grand_parent: Tutorials --- # Generating stubs using buf [Buf](https://github.com/bufbuild/buf) is a tool that provides various protobuf utilities such as linting, breaking change detection and generation. Please find installation instructions on [https://docs.buf.build/installation/](https://docs.buf.build/installation/). It is configured through a `buf.yaml` file that should be checked in to the root of your Protobuf file hierarchy. Buf will automatically read this file if present. Configuration can also be provided via the command-line flag `--config`, which accepts a path to a `.json` or `.yaml` file, or direct JSON or YAML data. As opposed to `protoc`, where all `.proto` files are manually specified on the command-line, buf operates by recursively discovering all `.proto` files under configuration and building them. The following is an example of a valid configuration, and you would put it in the root of your Protobuf file hierarchy, e.g. in `proto/buf.yaml` relative to the root of your repository. ```yaml version: v1 name: buf.build/myuser/myrepo ``` To generate type and gRPC stubs for Go, create the file `buf.gen.yaml`: ```yaml version: v1 plugins: - plugin: go out: proto opt: paths=source_relative - plugin: go-grpc out: proto opt: paths=source_relative ``` We use the `go` and `go-grpc` plugins to generate Go types and gRPC service definitions. We're outputting the generated files relative to the `proto` folder, and we're using the `paths=source_relative` option, which means that the generated files will appear in the same directory as the source `.proto` file. Then run ```sh $ buf generate ``` This will have generated a `*.pb.go` and a `*_grpc.pb.go` file for each protobuf package in our `proto` file hierarchy. [Next](../creating_main.go.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } using_protoc.md000066400000000000000000000020201465037340600341050ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/generating_stubs--- layout: default title: Generating stubs using protoc nav_order: 1 parent: Generating stubs grand_parent: Tutorials --- # Generating stubs using protoc Here's an example of what a `protoc` command might look like to generate Go stubs, assuming that you're at the root of your repository and you have your proto files in a directory called `proto`: ```sh $ protoc -I ./proto \ --go_out ./proto --go_opt paths=source_relative \ --go-grpc_out ./proto --go-grpc_opt paths=source_relative \ ./proto/helloworld/hello_world.proto ``` We use the `go` and `go-grpc` plugins to generate Go types and gRPC service definitions. We're outputting the generated files relative to the `proto` folder, and we're using the `paths=source_relative` option, which means that the generated files will appear in the same directory as the source `.proto` file. This will have generated a `*.pb.go` and a `*_grpc.pb.go` file for `proto/helloworld/hello_world.proto`. [Next](../creating_main.go.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/index.md000066400000000000000000000001111465037340600272140ustar00rootroot00000000000000--- layout: default title: Tutorials nav_order: 6 has_children: true --- golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/introduction.md000066400000000000000000000060661465037340600306450ustar00rootroot00000000000000--- layout: default title: Introduction to the gRPC-Gateway nav_order: 0 parent: Tutorials --- # Introduction to the gRPC-Gateway We all know that gRPC is not a tool for everything. There are cases where we still want to provide a traditional HTTP/JSON API. The reasons can range from maintaining backward-compatibility to supporting programming languages or clients not well supported by gRPC. But writing another service just to expose an HTTP/JSON API is quite a time consuming and tedious task. So is there any way to code just once, but provide APIs in both gRPC and HTTP/JSON at the same time? The answer is Yes. The gRPC-Gateway is a plugin of the Google protocol buffers compiler [protoc](https://github.com/protocolbuffers/protobuf). It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) annotations in your service definitions. This helps you provide your APIs in both gRPC and HTTP/JSON format at the same time.
## Prerequisites Before we start coding, we have to install some tools. We will be using a Go gRPC server in the examples, so please install Go first from [https://golang.org/dl/](https://golang.org/dl/). After installing Go, use `go install` to download and build the following binaries: ```sh $ go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest $ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest ``` This installs the `protoc` generator plugins we need to generate the stubs. Make sure to add `$GOPATH/bin` to your `$PATH` so that executables installed via `go get` are available on your `$PATH`. We will be working in a new module for this tutorial, so go ahead and create that in a folder of your choosing now: ### Creating go.mod file Start your module using the [go mod init command](https://golang.org/cmd/go/#hdr-Initialize_new_module_in_current_directory) to create a go.mod file. Run the `go mod init` command, giving it the path of the module your code will be in. Here, use github.com/myuser/myrepo for the module path -- in production code, this would be the URL from which your module can be downloaded. ```sh $ go mod init github.com/myuser/myrepo go: creating new go.mod: module github.com/myuser/myrepo ``` The `go mod init` command creates a go.mod file that identifies your code as a module that might be used from other code. The file you just created includes only the name of your module and the Go version your code supports. But as you add dependencies -- meaning packages from other modules -- the go.mod file will list the specific module versions to use. This keeps builds reproducible and gives you direct control over which module versions to use. [Next](simple_hello_world.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/learn_more.md000066400000000000000000000016621465037340600302440ustar00rootroot00000000000000--- layout: default title: Learn More nav_order: 5 parent: Tutorials --- # Learn More ## How it works When the HTTP request arrives at the gRPC-Gateway, it parses the JSON data into a protobuf message. It then makes a normal Go gRPC client request using the parsed protobuf message. The Go gRPC client encodes the protobuf structure into the protobuf binary format and sends it to the gRPC server. The gRPC Server handles the request and returns the response in the protobuf binary format. The Go gRPC client parses it into a protobuf message and returns it to the gRPC-Gateway, which encodes the protobuf message to JSON and returns it to the original client. ## google.api.http Read more about `google.api.http` in [the source file documentation](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto). ## HTTP and gRPC Transcoding Read more about HTTP and gRPC Transcoding on [AIP 127](https://google.aip.dev/127). golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/docs/tutorials/simple_hello_world.md000066400000000000000000000026261465037340600320050ustar00rootroot00000000000000--- layout: default title: Creating a simple hello world with gRPC nav_order: 1 parent: Tutorials --- # Creating a simple hello world with gRPC To understand the gRPC-Gateway we are going to first make a hello world gRPC service. ## Defining your gRPC service using protocol buffers Before we create a gRPC service, we should create a proto file to define what we need, here we create a file named `hello_world.proto` in the directory `proto/helloworld/hello_world.proto`. The gRPC service is defined using [Google Protocol Buffers](https://developers.google.com/protocol-buffers). To learn more about how to define a service in a `.proto` file see their [Basics tutorial](https://grpc.io/docs/languages/go/basics/). For now, all you need to know is that both the server and the client stub have a `SayHello()` RPC method that takes a `HelloRequest` parameter from the client and returns a `HelloReply` from the server, and that the method is defined like this: ```protobuf syntax = "proto3"; package helloworld; // The greeting service definition service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply) {} } // The request message containing the user's name message HelloRequest { string name = 1; } // The response message containing the greetings message HelloReply { string message = 1; } ``` [Next](generating_stubs/index.md){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/favicon.ico000066400000000000000000000360561465037340600247470ustar00rootroot00000000000000 h6  (00 h&(  ----------------------------------------------------------------------------------.pOP<ļbº]/-Yƿh-----ƿhأАĽc޲߳4.߳Pz--S֟˅Аyߴo7Mp޲--޲ס˅kАώߴ͉ӗMnS--{mأА͉ߴʂБߴL----.pOPwBº^s4Wƿi-----------------------------------------------------------------------------------( @ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------1ӗڨ;-j-΍أY7---Nx-----------ύ۫ݰ-ʁ0ҕj;---X-R.--------ә-ʁ[Oj;--1ɂ1}>Ȁ--------ѕ-ʁ՜.j;--1~-2/1s----Gܭݯw-޲-jߴ֟M1~/٥ݯݰp----pݰwݯԜ-njߵ5~/٥ݯݯܭG----s1-02-ʁ-٧j;YE~-3/-------ɀ>-є-ʁ-٦j;WCʃ2~-------.R-΍۫ݰ-ݯpj٧.Y----------1ӗڨ;-ʂ.YܮJ-I|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(0` ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------4XƿiP1--AZK--:ZQ2QZ2------9º\ƿiM/-----------------9ђ5-ʂܫ.-ɀ֟@B-----B----------------1ܭm-͊./ƿiBD-----נº]--49-----------G}AБߵ-͊.KEBD----0qEܮک-.͉ԛ6----------SQ-X-͊.͋۫5BD----4J.ʂݮ.ZĽd----------SP-W-͊6{.BD----4J-153-6H-------9FGƿiRCl-͊žfN-B[D6--4J-8FGGJD------;ޱû_-͊V-Bɀ14J.~D------Dû_-͊>Bq5J.~ޱ;------DJƿiRCGF@-͊H\[B[Pܮ՝9J-8FGGGF9-------H6SP-/75-͊.-۫tBD-o۪޲˅------------------4XƿiP1--AZ[[S9--2Q[[V@----7\ƿiN0---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/index.md000066400000000000000000000051221465037340600242450ustar00rootroot00000000000000--- layout: default title: gRPC-Gateway nav_order: 0 description: "Documentation site for the gRPC-Gateway" permalink: / --- # gRPC-Gateway {: .fs-9 } gRPC-Gateway is a plugin of [protoc](https://github.com/protocolbuffers/protobuf). It reads a [gRPC](https://grpc.io/) service definition and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. This server is generated according to [custom options](https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.api#http) in your gRPC definition. {: .fs-6 .fw-300 } [Get started](#getting-started){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } [View it on GitHub](https://github.com/grpc-ecosystem/grpc-gateway){: .btn .fs-5 .mb-4 .mb-md-0 } --- ## Getting started gRPC-Gateway helps you to provide your APIs in both gRPC and RESTful style at the same time.
To learn more about gRPC-Gateway check out the documentation. ## Contribution See [CONTRIBUTING.md](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/CONTRIBUTING.md). ## License gRPC-Gateway is licensed under the BSD 3-Clause License. See [LICENSE](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE) for more details. ### Thank you to the contributors of gRPC-Gateway
    {% for contributor in site.github.contributors %}
  • {{ contributor.login }}
  • {% endfor %}
golang-github-grpc-ecosystem-grpc-gateway-2.20.0/docs/run.sh000077500000000000000000000015171465037340600237630ustar00rootroot00000000000000#! /bin/bash set -e JEKYLL_VERSION=4 BUNDLE_DIR="/tmp/grpc-gateway-bundle" if [ ! -d "${BUNDLE_DIR}" ]; then mkdir "${BUNDLE_DIR}" # Run this to update the Gemsfile.lock docker run --rm \ --volume="${PWD}:/srv/jekyll" \ -e "JEKYLL_UID=$(id -u)" \ -e "JEKYLL_GID=$(id -g)" \ --volume="/tmp/grpc-gateway-bundle:/usr/local/bundle" \ -it "jekyll/builder:${JEKYLL_VERSION}" \ bundle update fi if [[ ${JEKYLL_GITHUB_TOKEN} == "" ]]; then echo "Please set \$JEKYLL_GITHUB_TOKEN before running" exit 1 fi docker run --rm \ --volume="${PWD}:/srv/jekyll" \ -p 35729:35729 -p 4000:4000 \ -e "JEKYLL_UID=$(id -u)" \ -e "JEKYLL_GID=$(id -g)" \ -e "JEKYLL_GITHUB_TOKEN=${JEKYLL_GITHUB_TOKEN}" \ --volume="/tmp/grpc-gateway-bundle:/usr/local/bundle" \ -it "jekyll/builder:${JEKYLL_VERSION}" \ jekyll serve golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/000077500000000000000000000000001465037340600235025ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/000077500000000000000000000000001465037340600253165ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/README.md000066400000000000000000000014601465037340600265760ustar00rootroot00000000000000# One way to run the example ```bash # Handle dependencies $ dep init ``` Follow the guides from this [README.md](./browser/README.md) to run the server and gateway. ```bash # Make sure you are in the correct directory: # $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/v2/examples $ cd examples/internal/browser $ pwd # Install gulp $ npm install -g gulp-cli $ npm install $ gulp # Run $ gulp bower $ gulp backends ``` Then you can use curl or a browser to test: ```bash # List all apis $ curl http://localhost:8080/openapiv2/echo_service.swagger.json # Visit the apis $ curl -XPOST http://localhost:8080/v1/example/echo/foo {"id":"foo"} $ curl http://localhost:8080/v1/example/echo/foo/123 {"id":"foo","num":"123"} ``` So you have visited the apis by HTTP successfully. You can also try other apis. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/000077500000000000000000000000001465037340600270015ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/.gitignore000066400000000000000000000000401465037340600307630ustar00rootroot00000000000000/bower_components /node_modules golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/README.md000066400000000000000000000007631465037340600302660ustar00rootroot00000000000000# Browser example This directory contains an example use of gRPC-Gateway with web browsers. The following commands automatically runs integration tests with phantomjs. ```shell-session $ npm install -g gulp-cli $ npm install $ gulp ``` ## Other examples ### Very simple example Run ```shell-session $ gulp bower $ gulp backends ``` then, open `index.html`. ### Integration test with your browser Run ```shell-session $ gulp serve ``` then, open `http://localhost:8000` with your browser. a_bit_of_everything_service.spec.js000066400000000000000000000171511465037340600357440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser'use strict'; var SwaggerClient = require('swagger-client'); describe('ABitOfEverythingService', function () { var client; beforeEach(function (done) { new SwaggerClient({ url: "http://localhost:8080/openapiv2/a_bit_of_everything.swagger.json", usePromise: true, }).then(function (c) { client = c; }).catch(function (err) { done.fail(err); }).then(done); }); describe('Create', function () { var created; var expected = { floatValue: 1.5, doubleValue: 2.5, int64Value: "4294967296", uint64Value: "9223372036854775807", int32Value: -2147483648, fixed64Value: "9223372036854775807", fixed32Value: 4294967295, boolValue: true, stringValue: "strprefix/foo", uint32Value: 4294967295, sfixed32Value: 2147483647, sfixed64Value: "-4611686018427387904", sint32Value: 2147483647, sint64Value: "4611686018427387903", nonConventionalNameValue: "camelCase", enumValue: "ONE", pathEnumValue: "DEF", nestedPathEnumValue: "JKL", enumValueAnnotation: "ONE", requiredStringViaFieldBehaviorAnnotation: "foo", singleNested: null, nested: [], bytesValue: "", repeatedStringValue: [], mapValue: {}, mappedStringValue: {}, mappedNestedValue: {}, timestampValue: "2006-01-02T15:04:05Z", repeatedEnumValue: [], repeatedEnumAnnotation: [], repeatedStringAnnotation: [], repeatedNestedAnnotation: [], nestedAnnotation: null, int64OverrideType: "0", outputOnlyStringViaFieldBehaviorAnnotation: "", }; beforeEach(function (done) { client.ABitOfEverythingService.ABitOfEverythingService_Create(expected).then(function (resp) { created = resp.obj; }).catch(function (err) { done.fail(err); }).then(done); }); it('should assign id', function () { expect(created.uuid).not.toBe(""); }); it('should echo the request back', function () { delete created.uuid; expect(created).toEqual(expected); }); }); describe('CreateBody', function () { var created; var expected = { floatValue: 1.5, doubleValue: 2.5, int64Value: "4294967296", uint64Value: "9223372036854775807", int32Value: -2147483648, fixed64Value: "9223372036854775807", fixed32Value: 4294967295, boolValue: true, stringValue: "strprefix/foo", uint32Value: 4294967295, sfixed32Value: 2147483647, sfixed64Value: "-4611686018427387904", sint32Value: 2147483647, sint64Value: "4611686018427387903", nonConventionalNameValue: "camelCase", enumValue: "ONE", pathEnumValue: "DEF", nestedPathEnumValue: "JKL", nested: [ { name: "bar", amount: 10 }, { name: "baz", amount: 20 }, ], repeatedStringValue: ["a", "b", "c"], oneofString: "x", mapValue: { a: "ONE", b: 2 }, mappedStringValue: { a: "x", b: "y" }, mappedNestedValue: { a: { name: "x", amount: 1 }, b: { name: "y", amount: 2 }, }, enumValueAnnotation: "ONE", requiredStringViaFieldBehaviorAnnotation: "foo", singleNested: null, nested: [], bytesValue: "", repeatedStringValue: [], mapValue: {}, mappedStringValue: {}, mappedNestedValue: {}, timestampValue: "2006-01-02T15:04:05Z", repeatedEnumValue: [], repeatedEnumAnnotation: [], repeatedStringAnnotation: [], repeatedNestedAnnotation: [], nestedAnnotation: null, int64OverrideType: "0", outputOnlyStringViaFieldBehaviorAnnotation: "", }; beforeEach(function (done) { client.ABitOfEverythingService.ABitOfEverythingService_CreateBody({ body: expected, }).then(function (resp) { created = resp.obj; }).catch(function (err) { done.fail(err); }).then(done); }); it('should assign id', function () { expect(created.uuid).not.toBe(""); }); it('should echo the request back', function () { delete created.uuid; expect(created).toEqual(expected); }); }); describe('lookup', function () { var created; var expected = { boolValue: true, stringValue: "strprefix/foo", }; beforeEach(function (done) { client.ABitOfEverythingService.ABitOfEverythingService_CreateBody({ body: expected, }).then(function (resp) { created = resp.obj; }).catch(function (err) { fail(err); }).finally(done); }); it('should look up an object by uuid', function (done) { client.ABitOfEverythingService.ABitOfEverythingService_Lookup({ uuid: created.uuid }).then(function (resp) { expect(resp.obj).toEqual(created); }).catch(function (err) { fail(err.errObj); }).finally(done); }); it('should fail if no such object', function (done) { client.ABitOfEverythingService.ABitOfEverythingService_Lookup({ uuid: 'not_exist', }).then(function (resp) { fail('expected failure but succeeded'); }).catch(function (err) { expect(err.status).toBe(404); }).finally(done); }); }); describe('Delete', function () { var created; var expected = { boolValue: true, stringValue: "strprefix/foo", }; beforeEach(function (done) { client.ABitOfEverythingService.ABitOfEverythingService_CreateBody({ body: expected, }).then(function (resp) { created = resp.obj; }).catch(function (err) { fail(err); }).finally(done); }); it('should delete an object by id', function (done) { client.ABitOfEverythingService.ABitOfEverythingService_Delete({ uuid: created.uuid }).then(function (resp) { expect(resp.obj).toEqual({}); }).catch(function (err) { fail(err.errObj); }).then(function () { return client.ABitOfEverythingService.ABitOfEverythingService_Lookup({ uuid: created.uuid }); }).then(function (resp) { fail('expected failure but succeeded'); }).catch(function (err) { expect(err.status).toBe(404); }).finally(done); }); }); describe('GetRepeatedQuery', function () { var repeated; var expected = { pathRepeatedFloatValue: [1.5, -1.5], pathRepeatedDoubleValue: [2.5, -2.5], pathRepeatedInt64Value: ["4294967296", "-4294967296"], pathRepeatedUint64Value: ["0", "9223372036854775807"], pathRepeatedInt32Value: [2147483647, -2147483648], pathRepeatedFixed64Value: ["0", "9223372036854775807"], pathRepeatedFixed32Value: [0, 4294967295], pathRepeatedBoolValue: [true, false], pathRepeatedStringValue: ["foo", "bar"], pathRepeatedBytesValue: ["AA==", "_w=="], pathRepeatedUint32Value: [4294967295, 0], pathRepeatedEnumValue: ["ONE", "ONE"], pathRepeatedSfixed32Value: [-2147483648, 2147483647], pathRepeatedSfixed64Value: ["-4294967296", "4294967296"], pathRepeatedSint32Value: [2147483646, -2147483647], pathRepeatedSint64Value: ["4611686018427387903", "-4611686018427387904"] }; beforeEach(function (done) { client.ABitOfEverythingService.ABitOfEverythingService_GetRepeatedQuery(expected).then(function (resp) { repeated = resp.obj; }).catch(function (err) { done.fail(err); }).then(done); }); it('should echo the request back', function () { // API will echo a non URL safe encoding expected.pathRepeatedBytesValue = ["AA==", "/w=="]; expect(repeated).toEqual(expected); }); }); }); golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/bin/000077500000000000000000000000001465037340600275515ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/bin/.gitignore000066400000000000000000000000201465037340600315310ustar00rootroot00000000000000/* !/.gitignore golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/bower.json000066400000000000000000000007251465037340600310160ustar00rootroot00000000000000{ "name": "grpc-gateway-example-browser", "description": "Example use of gRPC-Gateway from browser", "main": "index.js", "authors": [ "Yuki Yugui Sonoda " ], "license": "SEE LICENSE IN LICENSE file", "homepage": "https://github.com/grpc-ecosystem/grpc-gateway", "private": true, "dependencies": { "swagger-js": "~> 2.1" }, "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ] } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/echo_service.spec.js000066400000000000000000000024021465037340600327240ustar00rootroot00000000000000'use strict'; var SwaggerClient = require('swagger-client'); describe('EchoService', function () { var client; beforeEach(function (done) { new SwaggerClient({ url: "http://localhost:8080/openapiv2/echo_service.swagger.json", usePromise: true, }).then(function (c) { client = c; done(); }); }); describe('Echo', function () { it('should echo the request back', function (done) { var expected = { id: "foo", num: "0", status: null }; client.EchoService.EchoService_Echo( expected, { responseContentType: "application/json" } ).then(function (resp) { expect(resp.obj).toEqual(expected); }).catch(function (err) { done.fail(err); }).then(done); }); }); describe('EchoBody', function () { it('should echo the request back', function (done) { var expected = { id: "foo", num: "0", status: null }; client.EchoService.EchoService_EchoBody( { body: expected }, { responseContentType: "application/json" } ).then(function (resp) { expect(resp.obj).toEqual(expected); }).catch(function (err) { done.fail(err); }).then(done); }); }); }); golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/gulpfile.js000066400000000000000000000043411465037340600311500ustar00rootroot00000000000000"use strict"; var gulp = require('gulp'); var path = require('path'); var bower = require('gulp-bower'); var exit = require('gulp-exit'); var shell = require('gulp-shell'); var jasmineBrowser = require('gulp-jasmine-browser'); var webpack = require('webpack-stream'); const child = require('child_process'); gulp.task('bower', function () { return bower(); }); gulp.task('server', shell.task([ 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-grpc-server', ])); gulp.task('gateway', shell.task([ 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-gateway-server', ])); gulp.task('serve-server', ['server'], function () { let server = child.spawn('bin/example-server', [], { stdio: 'inherit' }); process.on('exit', function () { server.kill(); }); }); gulp.task('serve-gateway', ['gateway', 'serve-server'], function () { let gw = child.spawn('bin/example-gw', [ '--openapi_dir', path.join(__dirname, "../proto/examplepb"), ], { stdio: 'inherit' }); process.on('exit', function () { gw.kill(); }); }); gulp.task('backends', ['serve-gateway', 'serve-server']); var specFiles = ['*.spec.js']; gulp.task('test', ['backends'], function (done) { let s = gulp.src(specFiles) console.log(s); return s .pipe(webpack({ output: { filename: 'spec.js' } })) .pipe(jasmineBrowser.specRunner({ console: true, sourceMappedStacktrace: true, })) .pipe(jasmineBrowser.headless({ driver: 'phantomjs', findOpenPort: true, catch: true, throwFailures: true, })) .on('error', function (err) { done(err); process.exit(1); }) .pipe(exit()); }); gulp.task('serve', ['backends'], function (done) { var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin'); var plugin = new JasminePlugin(); return gulp.src(specFiles) .pipe(webpack({ output: { filename: 'spec.js' }, watch: true, plugins: [plugin], })) .pipe(jasmineBrowser.specRunner({ sourceMappedStacktrace: true, })) .pipe(jasmineBrowser.server({ port: 8000, whenReady: plugin.whenReady, })); }); gulp.task('default', ['test']); golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/index.html000066400000000000000000000012521465037340600307760ustar00rootroot00000000000000
golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/package-lock.json000066400000000000000000006574521465037340600322400ustar00rootroot00000000000000{ "name": "grpc-gateway-example", "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { "accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "requires": { "mime-types": "~2.1.34", "negotiator": "0.6.3" } }, "acorn": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", "integrity": "sha512-OLUyIIZ7mF5oaAUT1w0TFqQS81q3saT46x8t7ukpPjMNk+nbs4ZHhs7ToV8EWnLYLepjETXd4XaCE4uxkMeqUw==", "dev": true }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha512-GrTZLRpmp6wIC2ztrWW9MjjTgSKccffgFagbNDOX95/dcjEcYZibYTeaOntySQLcdw1ztBoFkviiUvTMbb9MYg==", "dev": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", "repeat-string": "^1.5.2" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "^1.1.5" } } } }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", "dev": true }, "ansi-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "requires": { "ansi-wrap": "^0.1.0" } }, "ansi-escapes": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", "integrity": "sha512-wiXutNjDUlNEDWHcYH3jtZUhd3c4/VojassD8zHdHCY13xbZy2XbW+NKQwA0tWGBVzDA9qEzYwfoSsWmviidhw==", "dev": true }, "ansi-gray": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", "integrity": "sha512-HrgGIZUl8h2EHuZaU9hTR/cU5nhKxpVE1V6kdGsQ8e4zirElJ5fvtfc8N7Q1oq1aatO275i8pUFUCpNWCAnVWw==", "requires": { "ansi-wrap": "0.1.0" } }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", "dev": true }, "ansi-wrap": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", "integrity": "sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==" }, "any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", "dev": true }, "anymatch": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", "dev": true, "requires": { "micromatch": "^2.1.5", "normalize-path": "^2.0.0" }, "dependencies": { "arr-diff": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", "integrity": "sha512-dtXTVMkh6VkEEA7OhXnN1Ecb8aAGFdZ1LFxtOCoqj4qkyOJMt7+qs6Ahdy6p/NQCPYsRSXXivhSB/J5E9jmYKA==", "dev": true, "requires": { "arr-flatten": "^1.0.1" } }, "array-unique": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", "integrity": "sha512-G2n5bG5fSUCpnsXz4+8FUkYsGPkNfLn9YvS66U5qbTIXI2Ynnlo4Bi42bWv+omKUCqz+ejzfClwne0alJWJPhg==", "dev": true }, "braces": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", "integrity": "sha512-xU7bpz2ytJl1bH9cgIurjpg/n8Gohy9GTw81heDYLJQ4RU60dlyJsa+atVF2pI0yMMvKxI9HkKwjePCj5XI1hw==", "dev": true, "requires": { "expand-range": "^1.8.1", "preserve": "^0.2.0", "repeat-element": "^1.1.2" } }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { "is-posix-bracket": "^0.1.0" } }, "extglob": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { "is-extglob": "^1.0.0" } }, "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "^1.0.0" } }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "^1.1.5" } }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", "integrity": "sha512-LnU2XFEk9xxSJ6rfgAry/ty5qwUTyHYOBU0g4R6tIw5ljwgGIBmiKhRWLw5NpMOnrgUNcDJ4WMp8rl3sYVHLNA==", "dev": true, "requires": { "arr-diff": "^2.0.0", "array-unique": "^0.2.1", "braces": "^1.8.2", "expand-brackets": "^0.1.4", "extglob": "^0.3.1", "filename-regex": "^2.0.0", "is-extglob": "^1.0.0", "is-glob": "^2.0.1", "kind-of": "^3.0.2", "normalize-path": "^2.0.1", "object.omit": "^2.0.0", "parse-glob": "^3.0.4", "regex-cache": "^0.4.2" } } } }, "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==" }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "integrity": "sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==" }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==" }, "array-differ": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", "integrity": "sha512-LeZY+DZDRnvP7eMuQ6LHfCzUGxAAIViUBliK24P3hWXL6y4SortgR6Nim6xrkfSLlmH0+k+9NYNwVC2s53ZrYQ==", "dev": true }, "array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==" }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", "dev": true }, "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" }, "array-sort": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz", "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==", "requires": { "default-compare": "^1.0.0", "get-value": "^2.0.6", "kind-of": "^5.0.2" } }, "array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", "dev": true }, "array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==" }, "asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { "safer-buffer": "~2.1.0" } }, "assert": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", "dev": true, "requires": { "object-assign": "^4.1.1", "util": "0.10.3" }, "dependencies": { "inherits": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", "dev": true }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { "inherits": "2.0.1" } } } }, "assert-plus": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", "integrity": "sha512-u1L0ZLywRziOVjUhRxI0Qg9G+4RnFB9H/Rq40YWn0dieDgO7vAYeJz6jKAO6t/aruzlDFLAPkQTT87e+f8Imaw==", "dev": true }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==" }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==", "dev": true }, "async-each": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, "aws-sign2": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", "integrity": "sha512-JnJpAS0p9RmixkOvW2XwDxxzs1bd4/VAGIl6Q0EC5YOo+p+hqIhtDhn/nmFnB/xUNXbLkpE2mOjgVIBRKD4xYw==", "dev": true }, "babel-polyfill": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", "integrity": "sha512-F2rZGQnAdaHWQ8YAoeRbukc7HS9QgdgeyJ0rQDd485v9opwuPvjpPFcOOT/WmkKTdgy9ESgSPXDcTNpzrGr6iQ==", "dev": true, "requires": { "babel-runtime": "^6.26.0", "core-js": "^2.5.0", "regenerator-runtime": "^0.10.5" } }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==", "dev": true, "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" }, "dependencies": { "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", "dev": true } } }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "requires": { "cache-base": "^1.0.1", "class-utils": "^0.3.5", "component-emitter": "^1.2.1", "define-property": "^1.0.0", "isobject": "^3.0.1", "mixin-deep": "^1.2.0", "pascalcase": "^0.1.1" }, "dependencies": { "define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { "is-descriptor": "^1.0.0" } }, "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "requires": { "kind-of": "^6.0.0" } }, "is-data-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "requires": { "kind-of": "^6.0.0" } }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, "requires": { "tweetnacl": "^0.14.3" } }, "beeper": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", "integrity": "sha512-3vqtKL1N45I5dV0RdssXZG7X6pCqQrWPNOlBPZPrd+QkE2HEhR57Z04m0KtpbsZH73j+a3F8UD1TQnn+ExTvIA==", "dev": true }, "big.js": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", "dev": true }, "binary-extensions": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, "bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, "optional": true, "requires": { "file-uri-to-path": "1.0.0" } }, "bl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.0.3.tgz", "integrity": "sha512-phbvN+yOk05EGoFcV/0S8N8ShnJqf6VCWRAw5he2gvRwBubFt/OzmcTNGqBt5b7Y4RK3YCgf6jrgGSR0Cwtsgw==", "dev": true, "requires": { "readable-stream": "~2.0.5" }, "dependencies": { "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==", "dev": true }, "readable-stream": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha512-TXcFfb63BQe1+ySzsHZI/5v1aJPCShfqvWJ64ayNImXMsN1Cd0YGk/wm8KB7/OeessgPc9QvS9Zou8QTkFzsLw==", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "~1.0.0", "process-nextick-args": "~1.0.6", "string_decoder": "~0.10.x", "util-deprecate": "~1.0.1" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", "dev": true } } }, "bluebird": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", "integrity": "sha512-UfFSr22dmHPQqPP9XWHRhq+gWnHCYguQGkXQlbyPtW5qTnhFWA8/iXg765tH0cAjy7l/zPJ1aBTO0g5XgA7kvQ==", "dev": true }, "boom": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha512-KbiZEa9/vofNcVJXGwdWWn25reQ3V3dHBWbS07FTF3/TOehLnm9GEhJV4T6ZvGPkShRpmUqYwnaCrkj0mRnP6Q==", "dev": true, "requires": { "hoek": "2.x.x" } }, "bower": { "version": "1.8.14", "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.14.tgz", "integrity": "sha512-8Rq058FD91q9Nwthyhw0la9fzpBz0iwZTrt51LWl+w+PnJgZk9J+5wp3nibsJcIUPglMYXr4NRBaR+TUj0OkBQ==", "dev": true }, "bower-config": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/bower-config/-/bower-config-0.6.2.tgz", "integrity": "sha512-P9qlrsulpuklPusQ6H+44c+xBokDh6Tl5vOP6LDcebjqDitrqe/fn27uxknRMTj3LLMvqsOfjV4h+UWNCkmsfg==", "dev": true, "requires": { "graceful-fs": "~2.0.0", "mout": "~0.9.0", "optimist": "~0.6.0", "osenv": "0.0.3" }, "dependencies": { "graceful-fs": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz", "integrity": "sha1-fNLNsiiko/Nule+mzBQt59GhNtA=", "dev": true }, "mout": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/mout/-/mout-0.9.1.tgz", "integrity": "sha1-hPDz/WrMcxf2PeKv/cwM7gCbBHc=", "dev": true } } }, "bower-logger": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/bower-logger/-/bower-logger-0.2.2.tgz", "integrity": "sha512-2x4n3GsmV6w3BeMK3zHv6T88HbuMQH2MJ0KZNbQMbJq8XPARdH1p9/CXsdkOBW5sMcnBCOVGxutDJYbkh2A7QQ==", "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "braces": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", "extend-shallow": "^2.0.1", "fill-range": "^4.0.0", "isobject": "^3.0.1", "repeat-element": "^1.1.2", "snapdragon": "^0.8.1", "snapdragon-node": "^2.0.1", "split-string": "^3.0.2", "to-regex": "^3.0.1" }, "dependencies": { "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", "requires": { "is-extendable": "^0.1.0" } } } }, "browserify-aes": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-0.4.0.tgz", "integrity": "sha512-hnvbMhZ/Ete34qnoKKyjikiYQfZbl89d5UZ29cz3EG13cv/8VRyM8Zs84luB/O7BRzC3qSng9dVovJ6jghcAvg==", "dev": true, "requires": { "inherits": "^2.0.1" } }, "browserify-zlib": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", "dev": true, "requires": { "pako": "~0.2.0" } }, "btoa": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==", "dev": true }, "buffer": { "version": "4.9.2", "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", "dev": true, "requires": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" } }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", "dev": true }, "bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "dev": true }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "requires": { "collection-visit": "^1.0.0", "component-emitter": "^1.2.1", "get-value": "^2.0.6", "has-value": "^1.0.0", "isobject": "^3.0.1", "set-value": "^2.0.0", "to-object-path": "^0.3.0", "union-value": "^1.0.0", "unset-value": "^1.0.0" } }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" } }, "camelcase": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==" }, "caseless": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", "integrity": "sha512-ODLXH644w9C2fMPAm7bMDQ3GRvipZWZfKc+8As6hIadRIelE0n0xZuN38NS6kiK3KPEVrpymmQD8bvncAHWQkQ==", "dev": true }, "center-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", "integrity": "sha512-Baz3aNe2gd2LP2qk5U+sDk/m4oSuwSDcBfayTCTBoWpfIGO5XFxPmjILQII4NGiZjD6DoDI6kf7gKaxkf7s3VQ==", "dev": true, "requires": { "align-text": "^0.1.3", "lazy-cache": "^1.0.3" } }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", "dev": true, "requires": { "ansi-styles": "^2.2.1", "escape-string-regexp": "^1.0.2", "has-ansi": "^2.0.0", "strip-ansi": "^3.0.0", "supports-color": "^2.0.0" } }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", "integrity": "sha512-mk8fAWcRUOxY7btlLtitj3A45jOwSAxH4tOFOoEGbVsl6cL6pPMWUy7dwZ/canfj3QEdP6FHSnf/l1c6/WkzVg==", "dev": true, "requires": { "anymatch": "^1.3.0", "async-each": "^1.0.0", "fsevents": "^1.0.0", "glob-parent": "^2.0.0", "inherits": "^2.0.1", "is-binary-path": "^1.0.0", "is-glob": "^2.0.0", "path-is-absolute": "^1.0.0", "readdirp": "^2.0.0" }, "dependencies": { "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha512-7Q+VbVafe6x2T+Tu6NcOf6sRklazEPmBoB3IWk3WdGZM2iGUwU/Oe3Wtq5lSEkDTTlpp8yx+5t4pzO/i9Ty1ww==", "dev": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha512-a1dBeB19NXsf/E0+FHqkagizel/LQw2DjSQpvQrj3zT+jYPpaUCryPnrQajXKFLCMuf4I6FhRpaGtw4lPrG6Eg==", "dev": true, "requires": { "is-extglob": "^1.0.0" } } } }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "requires": { "arr-union": "^3.1.0", "define-property": "^0.2.5", "isobject": "^3.0.0", "static-extend": "^0.1.1" }, "dependencies": { "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" } } } }, "cli-cursor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", "integrity": "sha512-25tABq090YNKkF6JH7lcwO0zFJTRke4Jcq9iX2nr/Sz0Cjjv4gckmwlW6Ty/aoyFd6z3ysR2hMGC2GFugmBo6A==", "dev": true, "requires": { "restore-cursor": "^1.0.1" } }, "cli-width": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-1.1.1.tgz", "integrity": "sha512-eMU2akIeEIkCxGXUNmDnJq1KzOIiPnJ+rKqRe6hcxE3vIOPvpMrBYOn/Bl7zNlYJj/zQxXquAnozHUCf9Whnsg==", "dev": true }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", "requires": { "string-width": "^1.0.1", "strip-ansi": "^3.0.1", "wrap-ansi": "^2.0.0" } }, "clone": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, "clone-stats": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "dev": true }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "requires": { "map-visit": "^1.0.0", "object-visit": "^1.0.0" } }, "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "requires": { "delayed-stream": "~1.0.0" } }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "concat-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "configstore": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", "dev": true, "requires": { "dot-prop": "^4.1.0", "graceful-fs": "^4.1.2", "make-dir": "^1.0.0", "unique-string": "^1.0.0", "write-file-atomic": "^2.0.0", "xdg-basedir": "^3.0.0" } }, "console-browserify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", "dev": true }, "constants-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, "content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dev": true, "requires": { "safe-buffer": "5.2.1" }, "dependencies": { "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true } } }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, "cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", "dev": true }, "cookiejar": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, "copy-props": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.5.tgz", "integrity": "sha512-XBlx8HSqrT0ObQwmSzM7WE5k8FxTV75h1DX1Z3n6NhQ/UYYAvInWYmG06vFt7hQZArE2fuO62aihiWIVQwh1sw==", "requires": { "each-props": "^1.3.2", "is-plain-object": "^5.0.0" } }, "core-js": { "version": "2.6.12", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", "dev": true }, "core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cryptiles": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "integrity": "sha512-FFN5KwpvvQTTS5hWPxrU8/QE4kQUc6uwZcrnlMBN82t1MgAtq8mnoDwINBly9Tdr02seeIIhtdF+UH1feBYGog==", "dev": true, "requires": { "boom": "2.x.x" } }, "crypto-browserify": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.3.0.tgz", "integrity": "sha1-ufx1u0oO1h3PHNXa6W6zDJw+UGw=", "dev": true, "requires": { "browserify-aes": "0.4.0", "pbkdf2-compat": "2.0.1", "ripemd160": "0.2.0", "sha.js": "2.2.6" } }, "crypto-random-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", "requires": { "es5-ext": "^0.10.50", "type": "^1.0.1" } }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, "requires": { "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true } } }, "dateformat": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", "dev": true }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "default-compare": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", "requires": { "kind-of": "^5.0.2" } }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "requires": { "clone": "^1.0.2" } }, "define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "requires": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "requires": { "is-descriptor": "^1.0.2", "isobject": "^3.0.1" }, "dependencies": { "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "requires": { "kind-of": "^6.0.0" } }, "is-data-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "requires": { "kind-of": "^6.0.0" } }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true }, "deprecated": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", "dev": true }, "destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true }, "detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=" }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", "dev": true }, "dot-prop": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", "dev": true, "requires": { "is-obj": "^1.0.0" } }, "duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", "dev": true }, "duplexer2": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", "dev": true, "requires": { "readable-stream": "~1.1.9" }, "dependencies": { "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } } }, "each-props": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==", "requires": { "is-plain-object": "^2.0.1", "object.defaults": "^1.1.0" }, "dependencies": { "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, "emojis-list": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", "dev": true }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", "dev": true }, "end-of-stream": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", "dev": true, "requires": { "once": "~1.3.0" } }, "enhanced-resolve": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", "dev": true, "requires": { "graceful-fs": "^4.1.2", "memory-fs": "^0.2.0", "tapable": "^0.1.8" }, "dependencies": { "memory-fs": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz", "integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=", "dev": true } } }, "errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", "dev": true, "requires": { "prr": "~1.0.1" } }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "requires": { "is-arrayish": "^0.2.1" } }, "es5-ext": { "version": "0.10.62", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", "requires": { "es6-iterator": "^2.0.3", "es6-symbol": "^3.1.3", "next-tick": "^1.1.0" } }, "es6-iterator": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", "requires": { "d": "1", "es5-ext": "^0.10.35", "es6-symbol": "^3.1.1" } }, "es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", "requires": { "d": "^1.0.1", "ext": "^1.1.2" } }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", "dev": true }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", "dev": true }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, "exit-hook": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", "dev": true }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "requires": { "debug": "^2.3.3", "define-property": "^0.2.5", "extend-shallow": "^2.0.1", "posix-character-classes": "^0.1.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" }, "dependencies": { "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" } }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" } } } }, "expand-range": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { "fill-range": "^2.1.0" }, "dependencies": { "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { "is-number": "^2.1.0", "isobject": "^2.0.0", "randomatic": "^3.0.0", "repeat-element": "^1.1.2", "repeat-string": "^1.5.2" } }, "is-number": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { "kind-of": "^3.0.2" } }, "isobject": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "requires": { "isarray": "1.0.0" } }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "^1.1.5" } } } }, "expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "requires": { "homedir-polyfill": "^1.0.1" } }, "express": { "version": "4.19.2", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "1.2.0", "fresh": "0.5.2", "http-errors": "2.0.0", "merge-descriptors": "1.0.1", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.7", "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.18.0", "serve-static": "1.15.0", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" }, "dependencies": { "body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "requires": { "bytes": "3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, "dependencies": { "content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "dev": true } } }, "cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true }, "qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dev": true, "requires": { "side-channel": "^1.0.4" } }, "raw-body": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "requires": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true } } }, "ext": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", "requires": { "type": "^2.7.2" }, "dependencies": { "type": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" } } }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "requires": { "assign-symbols": "^1.0.0", "is-extendable": "^1.0.1" }, "dependencies": { "is-extendable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "requires": { "is-plain-object": "^2.0.4" } }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "requires": { "array-unique": "^0.3.2", "define-property": "^1.0.0", "expand-brackets": "^2.1.4", "extend-shallow": "^2.0.1", "fragment-cache": "^0.2.1", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" }, "dependencies": { "define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { "is-descriptor": "^1.0.0" } }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" } }, "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "requires": { "kind-of": "^6.0.0" } }, "is-data-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "requires": { "kind-of": "^6.0.0" } }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "extract-zip": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.5.0.tgz", "integrity": "sha512-Ht7oUiEXWnX5BvLzMX/UBNIjrAs53lhXtNxMNeUe8Nv0S8rfy5UGqsKOXpP8ZQMWLvheOvRqYYShBoj6fTO9bg==", "dev": true, "requires": { "concat-stream": "1.5.0", "debug": "0.7.4", "mkdirp": "0.5.0", "yauzl": "2.4.1" }, "dependencies": { "concat-stream": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.0.tgz", "integrity": "sha512-litEocitzYgqQ0IPaoLw+tCHcVcJJYW05+SAhH+LS9qutSC7iuejvawts3cUYQycZbRbLsjG8mCJLQi2KX5kEw==", "dev": true, "requires": { "inherits": "~2.0.1", "readable-stream": "~2.0.0", "typedarray": "~0.0.5" } }, "debug": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", "integrity": "sha512-EohAb3+DSHSGx8carOSKJe8G0ayV5/i609OD0J2orCkuyae7SyZSz2aoLmQF2s0Pj5gITDebwPH7GFBlqOUQ1Q==", "dev": true }, "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", "dev": true }, "mkdirp": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", "integrity": "sha512-xjjNGy+ry1lhtIKcr2PT6ok3aszhQfgrUDp4OZLHacgRgFmF6XR9XCOJVcXlVGQonIqXcK1DvqgKKQOPWYGSfw==", "dev": true, "requires": { "minimist": "0.0.8" } }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==", "dev": true }, "readable-stream": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha512-TXcFfb63BQe1+ySzsHZI/5v1aJPCShfqvWJ64ayNImXMsN1Cd0YGk/wm8KB7/OeessgPc9QvS9Zou8QTkFzsLw==", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "~1.0.0", "process-nextick-args": "~1.0.6", "string_decoder": "~0.10.x", "util-deprecate": "~1.0.1" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", "dev": true } } }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "dev": true }, "fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", "integrity": "sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==", "requires": { "ansi-gray": "^0.1.1", "color-support": "^1.1.3", "parse-node-version": "^1.0.0", "time-stamp": "^1.0.0" } }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "integrity": "sha512-MX1ZLPIuKED51hrI4++K+1B0VX87Cs4EkybD2q12Ysuf5p4vkmHqMvQJRlDwROqFr4D2Pzyit5wGQxf30grIcw==", "dev": true, "requires": { "pend": "~1.2.0" } }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { "escape-string-regexp": "^1.0.5", "object-assign": "^4.1.0" }, "dependencies": { "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true } } }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", "dev": true, "optional": true }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", "dev": true }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "requires": { "extend-shallow": "^2.0.1", "is-number": "^3.0.0", "repeat-string": "^1.6.1", "to-regex-range": "^2.1.0" }, "dependencies": { "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" } } } }, "finalhandler": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", "dev": true, "requires": { "debug": "2.6.9", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", "statuses": "2.0.1", "unpipe": "~1.0.0" } }, "find-index": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", "dev": true }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" } }, "findup-sync": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", "requires": { "detect-file": "^1.0.0", "is-glob": "^4.0.0", "micromatch": "^3.0.4", "resolve-dir": "^1.0.1" } }, "fined": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz", "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==", "requires": { "expand-tilde": "^2.0.2", "is-plain-object": "^2.0.3", "object.defaults": "^1.1.0", "object.pick": "^1.2.0", "parse-filepath": "^1.0.1" }, "dependencies": { "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "first-chunk-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", "dev": true }, "flagged-respawn": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==" }, "flat-map": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/flat-map/-/flat-map-0.1.0.tgz", "integrity": "sha1-Qw7NcEDGbuhAAYgsdZMhPLhVLAQ=", "dev": true, "requires": { "babel-runtime": "^6.11.6", "is-stream": "^1.1.0", "through": "^2.3.8" } }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" }, "for-own": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", "requires": { "for-in": "^1.0.1" } }, "foreachasync": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=", "dev": true }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true }, "form-data": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", "integrity": "sha512-M4Yhq2mLogpCtpUmfopFlTTuIe6mSCTgKvnlMhDj3NcgVhA1uS20jT0n+xunKPzpmL5w2erSVtp+SKiJf1TlWg==", "dev": true, "requires": { "async": "^2.0.1", "combined-stream": "^1.0.5", "mime-types": "^2.1.11" }, "dependencies": { "async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { "lodash": "^4.17.14" } }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true } } }, "formidable": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", "dev": true }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "dev": true }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "requires": { "map-cache": "^0.2.2" } }, "fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", "dev": true }, "fs-extra": { "version": "0.26.7", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", "integrity": "sha512-waKu+1KumRhYv8D8gMRCKJGAMI9pRnPuEb1mvgYD0f7wBscg+h6bW4FDTmEZhB9VKxvoTtxW+Y7bnIlB7zja6Q==", "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^2.1.0", "klaw": "^1.0.0", "path-is-absolute": "^1.0.0", "rimraf": "^2.2.8" } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "fsevents": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" } }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "gaze": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", "dev": true, "requires": { "globule": "~0.1.0" } }, "generate-function": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", "dev": true, "requires": { "is-property": "^1.0.2" } }, "generate-object-property": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", "integrity": "sha512-TuOwZWgJ2VAMEGJvAyPWvpqxSANF0LDpmyHauMjFYzaACvn+QTT/AZomvPCzVBV7yDN3OmwHQ5OvHaeLKre3JQ==", "dev": true, "requires": { "is-property": "^1.0.0" } }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" }, "get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1" } }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, "requires": { "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true } } }, "glob": { "version": "4.5.3", "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", "dev": true, "requires": { "inflight": "^1.0.4", "inherits": "2", "minimatch": "^2.0.1", "once": "^1.3.0" } }, "glob-base": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { "glob-parent": "^2.0.0", "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "^1.0.0" } } } }, "glob-parent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "^1.0.0" } } } }, "glob-stream": { "version": "3.1.18", "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", "dev": true, "requires": { "glob": "^4.3.1", "glob2base": "^0.0.12", "minimatch": "^2.0.1", "ordered-read-streams": "^0.1.0", "through2": "^0.6.1", "unique-stream": "^1.0.0" }, "dependencies": { "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, "readable-stream": { "version": "1.0.34", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { "readable-stream": ">=1.0.33-1 <1.1.0-0", "xtend": ">=4.0.0 <4.1.0-0" } } } }, "glob-watcher": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", "dev": true, "requires": { "gaze": "^0.5.1" } }, "glob2base": { "version": "0.0.12", "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", "dev": true, "requires": { "find-index": "^0.1.1" } }, "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "requires": { "global-prefix": "^1.0.1", "is-windows": "^1.0.1", "resolve-dir": "^1.0.0" } }, "global-prefix": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", "requires": { "expand-tilde": "^2.0.2", "homedir-polyfill": "^1.0.1", "ini": "^1.3.4", "is-windows": "^1.0.1", "which": "^1.2.14" } }, "globule": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", "dev": true, "requires": { "glob": "~3.1.21", "lodash": "~1.0.1", "minimatch": "~0.2.11" }, "dependencies": { "glob": { "version": "3.1.21", "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", "dev": true, "requires": { "graceful-fs": "~1.2.0", "inherits": "1", "minimatch": "~0.2.11" } }, "graceful-fs": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", "dev": true }, "inherits": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", "dev": true }, "minimatch": { "version": "0.2.14", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "dev": true, "requires": { "lru-cache": "2", "sigmund": "~1.0.0" } } } }, "glogg": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.2.tgz", "integrity": "sha512-5mwUoSuBk44Y4EshyiqcH95ZntbDdTQqA3QYSrxmzj28Ai0vXBGMH1ApSANH14j2sIRtqCEyg6PfsuP7ElOEDA==", "requires": { "sparkles": "^1.0.0" } }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "gulp": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", "dev": true, "requires": { "archy": "^1.0.0", "chalk": "^1.0.0", "deprecated": "^0.0.1", "gulp-util": "^3.0.0", "interpret": "^1.0.0", "liftoff": "^2.1.0", "minimist": "^1.1.0", "orchestrator": "^0.3.0", "pretty-hrtime": "^1.0.0", "semver": "^4.1.0", "tildify": "^1.0.0", "v8flags": "^2.0.2", "vinyl-fs": "^0.3.0" }, "dependencies": { "findup-sync": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", "dev": true, "requires": { "detect-file": "^1.0.0", "is-glob": "^3.1.0", "micromatch": "^3.0.4", "resolve-dir": "^1.0.1" } }, "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { "is-extglob": "^2.1.0" } }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" } }, "liftoff": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", "dev": true, "requires": { "extend": "^3.0.0", "findup-sync": "^2.0.0", "fined": "^1.0.1", "flagged-respawn": "^1.0.0", "is-plain-object": "^2.0.4", "object.map": "^1.0.0", "rechoir": "^0.6.2", "resolve": "^1.1.7" } }, "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "semver": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", "dev": true }, "v8flags": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "dev": true, "requires": { "user-home": "^1.1.1" } } } }, "gulp-bower": { "version": "0.0.13", "resolved": "https://registry.npmjs.org/gulp-bower/-/gulp-bower-0.0.13.tgz", "integrity": "sha1-fKTjxaWZ0I+torHAVMzozeTnQjU=", "dev": true, "requires": { "bower": "^1.3.12", "gulp-util": "^3.0.1", "inquirer": "^0.11.2", "through2": "0.6.2", "walk": "2.3.3" }, "dependencies": { "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, "readable-stream": { "version": "1.0.34", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.2.tgz", "integrity": "sha1-UyZYJMVV5/zcQRHc3FLH3mRjbHU=", "dev": true, "requires": { "readable-stream": ">=1.0.28 <1.1.0-0", "xtend": ">=4.0.0 <4.1.0-0" } } } }, "gulp-cli": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.3.0.tgz", "integrity": "sha512-zzGBl5fHo0EKSXsHzjspp3y5CONegCm8ErO5Qh0UzFzk2y4tMvzLWhoDokADbarfZRL2pGpRp7yt6gfJX4ph7A==", "requires": { "ansi-colors": "^1.0.1", "archy": "^1.0.0", "array-sort": "^1.0.0", "color-support": "^1.1.3", "concat-stream": "^1.6.0", "copy-props": "^2.0.1", "fancy-log": "^1.3.2", "gulplog": "^1.0.0", "interpret": "^1.4.0", "isobject": "^3.0.1", "liftoff": "^3.1.0", "matchdep": "^2.0.0", "mute-stdout": "^1.0.0", "pretty-hrtime": "^1.0.0", "replace-homedir": "^1.0.0", "semver-greatest-satisfied-range": "^1.1.0", "v8flags": "^3.2.0", "yargs": "^7.1.0" } }, "gulp-exit": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/gulp-exit/-/gulp-exit-0.0.2.tgz", "integrity": "sha1-CCMTVIaDrQqwXUMNelYzMNTmE3A=", "dev": true }, "gulp-jasmine-browser": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/gulp-jasmine-browser/-/gulp-jasmine-browser-1.9.1.tgz", "integrity": "sha512-LsrOZ1JxoF0rri0NObyTZR1YHEOopgklBmOC37L6zayFBxjhKDG4RpqCRR8BCr67WHYO6mkSWEM8w1oQaQoJ6Q==", "dev": true, "requires": { "babel-polyfill": "^6.3.14", "babel-runtime": "^6.3.19", "express": "^4.13.3", "flat-map": "^0.1.0", "jasmine-core": "^2.4.1", "jasmine-json-stream-reporter": "^0.3.1", "jasmine-profile-reporter": "^0.0.2", "jasmine-terminal-reporter": "^1.0.2", "lazypipe": "^1.0.1", "lodash.once": "^4.0.0", "mime": "^1.3.4", "portastic": "^1.0.1", "qs": "^5.2.0", "serve-favicon": "^2.3.0", "sourcemapped-stacktrace": "^1.0.1", "split2": "^2.1.0", "thenify": "^3.1.1", "through2": "^2.0.0", "through2-reduce": "^1.1.1", "vinyl": "^1.2.0" }, "dependencies": { "vinyl": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { "clone": "^1.0.0", "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } } }, "gulp-shell": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/gulp-shell/-/gulp-shell-0.5.2.tgz", "integrity": "sha1-pJWcoGUa0ce7/nCy0K27tOGuqY0=", "dev": true, "requires": { "async": "^1.5.0", "gulp-util": "^3.0.7", "lodash": "^4.0.0", "through2": "^2.0.0" }, "dependencies": { "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true } } }, "gulp-util": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", "dev": true, "requires": { "array-differ": "^1.0.0", "array-uniq": "^1.0.2", "beeper": "^1.0.0", "chalk": "^1.0.0", "dateformat": "^2.0.0", "fancy-log": "^1.1.0", "gulplog": "^1.0.0", "has-gulplog": "^0.1.0", "lodash._reescape": "^3.0.0", "lodash._reevaluate": "^3.0.0", "lodash._reinterpolate": "^3.0.0", "lodash.template": "^3.0.0", "minimist": "^1.1.0", "multipipe": "^0.1.2", "object-assign": "^3.0.0", "replace-ext": "0.0.1", "through2": "^2.0.0", "vinyl": "^0.5.0" }, "dependencies": { "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true } } }, "gulplog": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", "requires": { "glogg": "^1.0.0" } }, "har-validator": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", "integrity": "sha512-P6tFV+wCcUL3nbyTDAvveDySfbhy0XkDtAIfZP6HITjM2WUsiPna/Eg1Yy93SFXvahqoX+kt0n+6xlXKDXYowA==", "dev": true, "requires": { "chalk": "^1.1.1", "commander": "^2.9.0", "is-my-json-valid": "^2.12.4", "pinkie-promise": "^2.0.0" } }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "requires": { "function-bind": "^1.1.1" } }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { "ansi-regex": "^2.0.0" } }, "has-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, "has-gulplog": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", "dev": true, "requires": { "sparkles": "^1.0.0" } }, "has-property-descriptors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", "requires": { "get-intrinsic": "^1.1.1" } }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "requires": { "get-value": "^2.0.6", "has-values": "^1.0.0", "isobject": "^3.0.0" } }, "has-values": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "requires": { "is-number": "^3.0.0", "kind-of": "^4.0.0" }, "dependencies": { "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "requires": { "is-buffer": "^1.1.5" } } } }, "hasha": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", "integrity": "sha512-jZ38TU/EBiGKrmyTNNZgnvCZHNowiRI4+w/I9noMlekHTZH3KyGgvJLmhSgykeAQ9j2SYPDosM0Bg3wHfzibAQ==", "dev": true, "requires": { "is-stream": "^1.0.1", "pinkie-promise": "^2.0.0" } }, "hawk": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "integrity": "sha512-X8xbmTc1cbPXcQV4WkLcRMALuyoxhfpFATmyuCxJPOAvrDS4DNnsTAOmKUxMTOWU6TzrTOkxPKwIx5ZOpJVSrg==", "dev": true, "requires": { "boom": "2.x.x", "cryptiles": "2.x.x", "hoek": "2.x.x", "sntp": "1.x.x" } }, "hoek": { "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha512-V6Yw1rIcYV/4JsnggjBU0l4Kr+EXhpwqXRusENU1Xx6ro00IHPHYNynCuBTOZAPlr3AAmLvchH9I7N/VUdvOwQ==", "dev": true }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", "requires": { "parse-passwd": "^1.0.0" } }, "hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "dev": true, "requires": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "http-signature": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", "integrity": "sha512-iUn0NcRULlDGtqNLN1Jxmzayk8ogm7NToldASyZBpM2qggbphjXzNOiw3piN8tgz+e/DRs6X5gAzFwTI6BCRcg==", "dev": true, "requires": { "assert-plus": "^0.2.0", "jsprim": "^1.2.2", "sshpk": "^1.7.0" } }, "https-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", "dev": true }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, "indent-string": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { "repeating": "^2.0.0" } }, "indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "inquirer": { "version": "0.11.4", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.11.4.tgz", "integrity": "sha1-geM3ToNhvq/y2XAWIG01nQsy+k0=", "dev": true, "requires": { "ansi-escapes": "^1.1.0", "ansi-regex": "^2.0.0", "chalk": "^1.0.0", "cli-cursor": "^1.0.1", "cli-width": "^1.0.1", "figures": "^1.3.5", "lodash": "^3.3.1", "readline2": "^1.0.1", "run-async": "^0.1.0", "rx-lite": "^3.1.2", "string-width": "^1.0.1", "strip-ansi": "^3.0.0", "through": "^2.3.6" }, "dependencies": { "lodash": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true } } }, "interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==" }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "dev": true }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "requires": { "is-relative": "^1.0.0", "is-windows": "^1.0.1" } }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "requires": { "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { "binary-extensions": "^1.0.0" } }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-core-module": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", "requires": { "has": "^1.0.3" } }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "requires": { "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "requires": { "is-accessor-descriptor": "^0.1.6", "is-data-descriptor": "^0.1.4", "kind-of": "^5.0.0" } }, "is-dotfile": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", "dev": true }, "is-equal-shallow": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { "is-primitive": "^2.0.0" } }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-finite": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { "number-is-nan": "^1.0.0" } }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "requires": { "is-extglob": "^2.1.1" } }, "is-my-ip-valid": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.1.tgz", "integrity": "sha512-jxc8cBcOWbNK2i2aTkCZP6i7wkHF1bqKFrwEHuN5Jtg5BSaZHUZQ/JTOJwoV41YvHnOaRyWWh72T/KvfNz9DJg==", "dev": true }, "is-my-json-valid": { "version": "2.20.6", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.20.6.tgz", "integrity": "sha512-1JQwulVNjx8UqkPE/bqDaxtH4PXCe/2VRh/y3p99heOV87HG4Id5/VfDswd+YiAfHcRTfDlWgISycnHuhZq1aw==", "dev": true, "requires": { "generate-function": "^2.0.0", "generate-object-property": "^1.1.0", "is-my-ip-valid": "^1.0.0", "jsonpointer": "^5.0.0", "xtend": "^4.0.0" } }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "requires": { "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, "is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" }, "is-posix-bracket": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", "dev": true }, "is-primitive": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==", "dev": true }, "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "requires": { "is-unc-path": "^1.0.0" } }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "requires": { "unc-path-regex": "^0.1.2" } }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, "jasmine": { "version": "2.99.0", "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz", "integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=", "dev": true, "requires": { "exit": "^0.1.2", "glob": "^7.0.6", "jasmine-core": "~2.99.0" }, "dependencies": { "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } } } }, "jasmine-core": { "version": "2.99.1", "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, "jasmine-json-stream-reporter": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/jasmine-json-stream-reporter/-/jasmine-json-stream-reporter-0.3.1.tgz", "integrity": "sha1-8zMKYL2t5jeeF80j00O7nu+Q08w=", "dev": true, "requires": { "through2": "^2.0.1", "uuid": "^2.0.2" } }, "jasmine-profile-reporter": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/jasmine-profile-reporter/-/jasmine-profile-reporter-0.0.2.tgz", "integrity": "sha1-sQ3a+at1t7xsTJ9G8kpnoEVfOXg=", "dev": true }, "jasmine-terminal-reporter": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/jasmine-terminal-reporter/-/jasmine-terminal-reporter-1.0.3.tgz", "integrity": "sha1-iW8eyP30v2rs3UHFA+2nNH9hUms=", "dev": true, "requires": { "indent-string": "^2.1.0", "pluralize": "^1.2.1" } }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", "dev": true }, "json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, "jsonfile": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", "dev": true, "requires": { "graceful-fs": "^4.1.6" } }, "jsonpointer": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", "dev": true }, "jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.4.0", "verror": "1.10.0" }, "dependencies": { "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true } } }, "kew": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", "integrity": "sha512-IG6nm0+QtAMdXt9KvbgbGdvY50RSrw+U4sGZg+KlrSKPJEwVE5JVoI3d7RWfSMdBQneRheeAOj3lIjX5VL/9RQ==", "dev": true }, "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" }, "klaw": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", "dev": true, "requires": { "graceful-fs": "^4.1.9" } }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true }, "lazypipe": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/lazypipe/-/lazypipe-1.0.2.tgz", "integrity": "sha512-CrU+NYdFHW8ElaeXCWz5IbmetiYVYq1fOCmpdAeZ8L+khbv1e7EnshyjlKqkO+pJbVPrsJQnHbVxEiLujG6qhQ==", "dev": true, "requires": { "stream-combiner": "*" } }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", "requires": { "invert-kv": "^1.0.0" } }, "liftoff": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz", "integrity": "sha512-DlIPlJUkCV0Ips2zf2pJP0unEoT1kwYhiiPUGF3s/jtxTCjziNLoiVVh+jqWOWeFi6mmwQ5fNxvAUyPad4Dfog==", "requires": { "extend": "^3.0.0", "findup-sync": "^3.0.0", "fined": "^1.0.1", "flagged-respawn": "^1.0.0", "is-plain-object": "^2.0.4", "object.map": "^1.0.0", "rechoir": "^0.6.2", "resolve": "^1.1.7" }, "dependencies": { "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", "pinkie-promise": "^2.0.0", "strip-bom": "^2.0.0" } }, "loader-utils": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", "dev": true, "requires": { "big.js": "^3.1.3", "emojis-list": "^2.0.0", "json5": "^0.5.0", "object-assign": "^4.0.1" }, "dependencies": { "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true } } }, "lodash": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", "dev": true }, "lodash-compat": { "version": "3.10.2", "resolved": "https://registry.npmjs.org/lodash-compat/-/lodash-compat-3.10.2.tgz", "integrity": "sha1-xpQBKKnTD46QLNLPmf0Muk7PwYM=", "dev": true }, "lodash._basecopy": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", "dev": true }, "lodash._basetostring": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", "dev": true }, "lodash._basevalues": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", "dev": true }, "lodash._getnative": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", "dev": true }, "lodash._isiterateecall": { "version": "3.0.9", "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", "dev": true }, "lodash._reescape": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", "dev": true }, "lodash._reevaluate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", "dev": true }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, "lodash._root": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", "dev": true }, "lodash.clone": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=", "dev": true }, "lodash.escape": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", "dev": true, "requires": { "lodash._root": "^3.0.0" } }, "lodash.isarguments": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", "dev": true }, "lodash.isarray": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", "dev": true }, "lodash.keys": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { "lodash._getnative": "^3.0.0", "lodash.isarguments": "^3.0.0", "lodash.isarray": "^3.0.0" } }, "lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=", "dev": true }, "lodash.restparam": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "dev": true }, "lodash.some": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=", "dev": true }, "lodash.template": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", "dev": true, "requires": { "lodash._basecopy": "^3.0.0", "lodash._basetostring": "^3.0.0", "lodash._basevalues": "^3.0.0", "lodash._isiterateecall": "^3.0.0", "lodash._reinterpolate": "^3.0.0", "lodash.escape": "^3.0.0", "lodash.keys": "^3.0.0", "lodash.restparam": "^3.0.0", "lodash.templatesettings": "^3.0.0" } }, "lodash.templatesettings": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", "dev": true, "requires": { "lodash._reinterpolate": "^3.0.0", "lodash.escape": "^3.0.0" } }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", "dev": true }, "lru-cache": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", "dev": true }, "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { "pify": "^3.0.0" }, "dependencies": { "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true } } }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "requires": { "kind-of": "^6.0.2" }, "dependencies": { "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "requires": { "object-visit": "^1.0.0" } }, "matchdep": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", "integrity": "sha512-LFgVbaHIHMqCRuCZyfCtUOq9/Lnzhi7Z0KFUE2fhD54+JN2jLh3hC02RLkqauJ3U4soU6H1J3tfj/Byk7GoEjA==", "requires": { "findup-sync": "^2.0.0", "micromatch": "^3.0.4", "resolve": "^1.4.0", "stack-trace": "0.0.10" }, "dependencies": { "findup-sync": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", "integrity": "sha512-vs+3unmJT45eczmcAZ6zMJtxN3l/QXeccaXQx5cu/MeJMhewVfoWZqibRkOxPnmoR59+Zy5hjabfQc6JLSah4g==", "requires": { "detect-file": "^1.0.0", "is-glob": "^3.1.0", "micromatch": "^3.0.4", "resolve-dir": "^1.0.1" } }, "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", "requires": { "is-extglob": "^2.1.0" } } } }, "math-random": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", "dev": true }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, "memory-fs": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.3.0.tgz", "integrity": "sha1-e8xrYp46Q+hx1+Kaymrop/FcuyA=", "dev": true, "requires": { "errno": "^0.1.3", "readable-stream": "^2.0.1" } }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", "dev": true }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", "dev": true }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", "braces": "^2.3.1", "define-property": "^2.0.2", "extend-shallow": "^3.0.2", "extglob": "^2.0.4", "fragment-cache": "^0.2.1", "kind-of": "^6.0.2", "nanomatch": "^1.2.9", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.2" }, "dependencies": { "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true }, "mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "requires": { "mime-db": "1.52.0" } }, "minimatch": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { "brace-expansion": "^1.0.0" } }, "minimist": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "requires": { "for-in": "^1.0.2", "is-extendable": "^1.0.1" }, "dependencies": { "is-extendable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "requires": { "is-plain-object": "^2.0.4" } }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "requires": { "minimist": "^1.2.6" }, "dependencies": { "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true } } }, "mout": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/mout/-/mout-1.2.4.tgz", "integrity": "sha512-mZb9uOruMWgn/fw28DG4/yE3Kehfk1zKCLhuDU2O3vlKdnBBr4XaOCqVTflJ5aODavGUPqFHZgrFX3NJVuxGhQ==", "dev": true }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "multipipe": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { "duplexer2": "0.0.2" } }, "mute-stdout": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz", "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==" }, "mute-stream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", "dev": true }, "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", "dev": true, "optional": true }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", "define-property": "^2.0.2", "extend-shallow": "^3.0.2", "fragment-cache": "^0.2.1", "is-windows": "^1.0.2", "kind-of": "^6.0.2", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" }, "dependencies": { "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "natives": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.6.tgz", "integrity": "sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==", "dev": true }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true }, "next-tick": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" }, "node-libs-browser": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-0.7.0.tgz", "integrity": "sha1-PicsCBnjCJNeJmdECNevDhSRuDs=", "dev": true, "requires": { "assert": "^1.1.1", "browserify-zlib": "^0.1.4", "buffer": "^4.9.0", "console-browserify": "^1.1.0", "constants-browserify": "^1.0.0", "crypto-browserify": "3.3.0", "domain-browser": "^1.1.1", "events": "^1.0.0", "https-browserify": "0.0.1", "os-browserify": "^0.2.0", "path-browserify": "0.0.0", "process": "^0.11.0", "punycode": "^1.2.4", "querystring-es3": "^0.2.0", "readable-stream": "^2.0.5", "stream-browserify": "^2.0.1", "stream-http": "^2.3.1", "string_decoder": "^0.10.25", "timers-browserify": "^2.0.2", "tty-browserify": "0.0.0", "url": "^0.11.0", "util": "^0.10.3", "vm-browserify": "0.0.4" }, "dependencies": { "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } } }, "node-uuid": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", "integrity": "sha512-TkCET/3rr9mUuRp+CpO7qfgT++aAxfDRaalQhwPFzI9BY/2rCDn6OfpZOVggi1AXfTPpfkTrg5f5WQx5G1uLxA==", "dev": true }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "requires": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { "remove-trailing-separator": "^1.0.1" } }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", "integrity": "sha512-VlF07iu3VV3+BTXj43Nmp6Irt/G7j/NgEctUS6IweH1RGhURjjCc2NWtzXFPXXWWfc7hgbXQdtiQu2LGp6MxUg==", "dev": true }, "object-assign": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", "dev": true }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "requires": { "copy-descriptor": "^0.1.0", "define-property": "^0.2.5", "kind-of": "^3.0.3" }, "dependencies": { "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" } }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "object-inspect": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.1.tgz", "integrity": "sha512-Y/jF6vnvEtOPGiKD1+q+X0CiUYRQtEHp89MLLUJ7TUivtH8Ugn2+3A7Rynqk7BRsAoqeOQWnFnjpDrKSxDgIGA==", "dev": true }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "requires": { "isobject": "^3.0.0" } }, "object.assign": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "has-symbols": "^1.0.3", "object-keys": "^1.1.1" } }, "object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", "requires": { "array-each": "^1.0.1", "array-slice": "^1.0.0", "for-own": "^1.0.0", "isobject": "^3.0.0" } }, "object.map": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", "requires": { "for-own": "^1.0.0", "make-iterator": "^1.0.0" } }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { "for-own": "^0.1.4", "is-extendable": "^0.1.1" }, "dependencies": { "for-own": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { "for-in": "^1.0.1" } } } }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "requires": { "isobject": "^3.0.1" } }, "on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, "requires": { "ee-first": "1.1.1" } }, "once": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", "dev": true, "requires": { "wrappy": "1" } }, "onetime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { "minimist": "~0.0.1", "wordwrap": "~0.0.2" } }, "orchestrator": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", "dev": true, "requires": { "end-of-stream": "~0.1.5", "sequencify": "~0.0.7", "stream-consume": "~0.1.0" } }, "ordered-read-streams": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", "dev": true }, "os-browserify": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.2.1.tgz", "integrity": "sha1-Y/xMzuXS13Y9Jrv4YBB45sLgBE8=", "dev": true }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", "requires": { "lcid": "^1.0.0" } }, "osenv": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.0.3.tgz", "integrity": "sha1-zWrY3bKQkVrZ4idlV2Al1BHynLY=", "dev": true }, "pako": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", "dev": true }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", "requires": { "is-absolute": "^1.0.0", "map-cache": "^0.2.0", "path-root": "^0.1.1" } }, "parse-glob": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { "glob-base": "^0.3.0", "is-dotfile": "^1.0.0", "is-extglob": "^1.0.0", "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "^1.0.0" } } } }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", "requires": { "error-ex": "^1.2.0" } }, "parse-node-version": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==" }, "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "dev": true }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" }, "path-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", "dev": true }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", "requires": { "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-root": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", "requires": { "path-root-regex": "^0.1.0" } }, "path-root-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=" }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", "dev": true }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", "requires": { "graceful-fs": "^4.1.2", "pify": "^2.0.0", "pinkie-promise": "^2.0.0" } }, "pbkdf2-compat": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", "integrity": "sha1-tuDI+plJTZTgURV1gCpZpcFC8og=", "dev": true }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true }, "phantomjs": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/phantomjs/-/phantomjs-2.1.7.tgz", "integrity": "sha512-hw9ShqlOOeBD7qXTB7HAPJzqscG15AUymngJFRJt4gex3MVdBykWrGV1Js21CsnZ35A6/x3KFbHxZd3xu6boBA==", "dev": true, "requires": { "extract-zip": "~1.5.0", "fs-extra": "~0.26.4", "hasha": "^2.2.0", "kew": "~0.7.0", "progress": "~1.1.8", "request": "~2.67.0", "request-progress": "~2.0.1", "which": "~1.2.2" }, "dependencies": { "which": { "version": "1.2.14", "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", "integrity": "sha512-16uPglFkRPzgiUXYMi1Jf8Z5EzN1iB4V0ZtMXcHZnwsBtQhhHeCqoWw7tsUY42hJGNDWtUsVLTjakIa5BgAxCw==", "dev": true, "requires": { "isexe": "^2.0.0" } } } }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "requires": { "pinkie": "^2.0.0" } }, "pluralize": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", "dev": true }, "portastic": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/portastic/-/portastic-1.0.1.tgz", "integrity": "sha1-HJgF1D+uj2pAzw28d5QJGi6dDSo=", "dev": true, "requires": { "bluebird": "^2.9.34", "commander": "^2.8.1", "debug": "^2.2.0" } }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=" }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", "dev": true }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha512-UdA8mJ4weIkUBO224tIarHzuHs4HuYiJvsuGT7j/SPQiUJVjYvNDBIPa0hAorduOfjGohB/qHWRa/lrrWX/mXw==", "dev": true }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "dev": true, "requires": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "dev": true }, "qs": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/qs/-/qs-5.2.1.tgz", "integrity": "sha1-gB/uAw4LlFDWOFrcSKTMVbRK7fw=", "dev": true }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", "dev": true }, "querystring-es3": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, "randomatic": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", "dev": true, "requires": { "is-number": "^4.0.0", "kind-of": "^6.0.0", "math-random": "^1.0.1" }, "dependencies": { "is-number": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", "dev": true }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "dev": true }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", "requires": { "load-json-file": "^1.0.0", "normalize-package-data": "^2.3.2", "path-type": "^1.0.0" } }, "read-pkg-up": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", "requires": { "find-up": "^1.0.0", "read-pkg": "^1.0.0" } }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "readdirp": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", "micromatch": "^3.1.10", "readable-stream": "^2.0.2" } }, "readline2": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", "mute-stream": "0.0.5" } }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "requires": { "resolve": "^1.1.6" } }, "regenerator-runtime": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", "dev": true }, "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { "is-equal-shallow": "^0.1.3" } }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", "requires": { "extend-shallow": "^3.0.2", "safe-regex": "^1.1.0" } }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" }, "repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==" }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, "repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { "is-finite": "^1.0.0" } }, "replace-ext": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", "dev": true }, "replace-homedir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", "integrity": "sha512-CHPV/GAglbIB1tnQgaiysb8H2yCy8WQ7lcEwQ/eT+kLj0QHV8LnJW0zpqpE7RSkrMSRoa+EBoag86clf7WAgSg==", "requires": { "homedir-polyfill": "^1.0.1", "is-absolute": "^1.0.0", "remove-trailing-separator": "^1.1.0" } }, "request": { "version": "2.67.0", "resolved": "https://registry.npmjs.org/request/-/request-2.67.0.tgz", "integrity": "sha512-fzMRDWVEdMktE3foqvL4CBmC+AR8WvcP8pIPx6JSqqhWuPr+BxX9tKx4XiijfyeKtqqRMNpHDWqFMw4JlRPIJg==", "dev": true, "requires": { "aws-sign2": "~0.6.0", "bl": "~1.0.0", "caseless": "~0.11.0", "combined-stream": "~1.0.5", "extend": "~3.0.0", "forever-agent": "~0.6.1", "form-data": "~1.0.0-rc3", "har-validator": "~2.0.2", "hawk": "~3.1.0", "http-signature": "~1.1.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.7", "node-uuid": "~1.4.7", "oauth-sign": "~0.8.0", "qs": "~5.2.0", "stringstream": "~0.0.4", "tough-cookie": "~2.2.0", "tunnel-agent": "~0.4.1" } }, "request-progress": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", "integrity": "sha512-dxdraeZVUNEn9AvLrxkgB2k6buTlym71dJk1fk4v8j3Ou3RKNm07BcgbHdj2lLgYGfqX71F+awb1MR+tWPFJzA==", "dev": true, "requires": { "throttleit": "^1.0.0" } }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" }, "require-main-filename": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "requires": { "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "requires": { "expand-tilde": "^2.0.0", "global-modules": "^1.0.0" } }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, "restore-cursor": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", "dev": true, "requires": { "exit-hook": "^1.0.0", "onetime": "^1.0.0" } }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, "right-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { "align-text": "^0.1.1" } }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" }, "dependencies": { "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } } } }, "ripemd160": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-0.2.0.tgz", "integrity": "sha1-K/GYveFnys+lHAqSjoS2i74XH84=", "dev": true }, "run-async": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", "dev": true, "requires": { "once": "^1.3.0" } }, "rx-lite": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", "dev": true }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" } }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" }, "semver-greatest-satisfied-range": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", "integrity": "sha512-Ny/iyOzSSa8M5ML46IAx3iXc6tfOsYU2R4AXi2UpHk60Zrgyq6eqPj/xiOfS0rRl/iiQ/rdJkVjw/5cdUyCntQ==", "requires": { "sver-compat": "^1.5.0" } }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", "dev": true, "requires": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "2.4.1", "range-parser": "~1.2.1", "statuses": "2.0.1" }, "dependencies": { "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true } } }, "sequencify": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", "dev": true }, "serve-favicon": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz", "integrity": "sha1-k10kDN/g9YBTB/3+ln2IlCosvPA=", "dev": true, "requires": { "etag": "~1.8.1", "fresh": "0.5.2", "ms": "2.1.1", "parseurl": "~1.3.2", "safe-buffer": "5.1.1" }, "dependencies": { "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true } } }, "serve-static": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", "dev": true, "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "0.18.0" } }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", "is-plain-object": "^2.0.3", "split-string": "^3.0.1" }, "dependencies": { "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" } }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "requires": { "isobject": "^3.0.1" } } } }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", "dev": true }, "setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, "sha.js": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.2.6.tgz", "integrity": "sha1-F93t3F9yL7ZlAWWIlUYZd4ZzFbo=", "dev": true }, "side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", "object-inspect": "^1.9.0" } }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "requires": { "base": "^0.11.1", "debug": "^2.2.0", "define-property": "^0.2.5", "extend-shallow": "^2.0.1", "map-cache": "^0.2.2", "source-map": "^0.5.6", "source-map-resolve": "^0.5.0", "use": "^3.1.0" }, "dependencies": { "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" } }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" } } } }, "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "requires": { "define-property": "^1.0.0", "isobject": "^3.0.0", "snapdragon-util": "^3.0.1" }, "dependencies": { "define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { "is-descriptor": "^1.0.0" } }, "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "requires": { "kind-of": "^6.0.0" } }, "is-data-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "requires": { "kind-of": "^6.0.0" } }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" } } }, "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "requires": { "kind-of": "^3.2.0" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "sntp": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "integrity": "sha512-7bgVOAnPj3XjrKY577S+puCKGCRlUrcrEdsMeRXlg9Ghf5df/xNi6sONUa43WrHUd3TjJBF7O04jYoiY0FVa0A==", "dev": true, "requires": { "hoek": "2.x.x" } }, "source-list-map": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.8.tgz", "integrity": "sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=", "dev": true }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, "source-map-resolve": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", "requires": { "atob": "^2.1.2", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", "urix": "^0.1.0" } }, "source-map-url": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==" }, "sourcemapped-stacktrace": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/sourcemapped-stacktrace/-/sourcemapped-stacktrace-1.1.11.tgz", "integrity": "sha512-O0pcWjJqzQFVsisPlPXuNawJHHg9N9UgpJ/aDmvi9+vnS3x1C0NhwkVFzzZ1VN0Xo+bekyweoqYvBw5ZBKiNnQ==", "dev": true, "requires": { "source-map": "0.5.6" }, "dependencies": { "source-map": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", "dev": true } } }, "sparkles": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==" }, "spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" }, "spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { "version": "3.0.12", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==" }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "requires": { "extend-shallow": "^3.0.0" } }, "split2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", "dev": true, "requires": { "through2": "^2.0.2" } }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, "sshpk": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", "dashdash": "^1.12.0", "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, "dependencies": { "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true } } }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "requires": { "define-property": "^0.2.5", "object-copy": "^0.1.0" }, "dependencies": { "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" } } } }, "statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true }, "stream-browserify": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", "dev": true, "requires": { "inherits": "~2.0.1", "readable-stream": "^2.0.2" } }, "stream-combiner": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", "dev": true, "requires": { "duplexer": "~0.1.1", "through": "~2.3.4" } }, "stream-consume": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", "dev": true }, "stream-http": { "version": "2.8.3", "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", "dev": true, "requires": { "builtin-status-codes": "^3.0.0", "inherits": "^2.0.1", "readable-stream": "^2.3.6", "to-arraybuffer": "^1.0.0", "xtend": "^4.0.0" } }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", "strip-ansi": "^3.0.0" } }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { "safe-buffer": "~5.1.0" } }, "stringstream": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", "dev": true }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" } }, "strip-bom": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", "requires": { "is-utf8": "^0.2.0" } }, "superagent": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-2.3.0.tgz", "integrity": "sha1-cDUpoHFOV+EjlZ3e+84ZOy5Q0RU=", "dev": true, "requires": { "component-emitter": "^1.2.0", "cookiejar": "^2.0.6", "debug": "^2.2.0", "extend": "^3.0.0", "form-data": "1.0.0-rc4", "formidable": "^1.0.17", "methods": "^1.1.1", "mime": "^1.3.4", "qs": "^6.1.0", "readable-stream": "^2.0.5" }, "dependencies": { "form-data": { "version": "1.0.0-rc4", "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz", "integrity": "sha1-BaxrwiIntD5EYfSIFhVUaZ1Pi14=", "dev": true, "requires": { "async": "^1.5.2", "combined-stream": "^1.0.5", "mime-types": "^2.1.10" } }, "qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", "dev": true, "requires": { "side-channel": "^1.0.4" } } } }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, "sver-compat": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", "integrity": "sha512-aFTHfmjwizMNlNE6dsGmoAM4lHjL0CyiobWaFiXWSlD7cIxshW422Nb8KbXCmR6z+0ZEPY+daXJrDyh/vuwTyg==", "requires": { "es6-iterator": "^2.0.1", "es6-symbol": "^3.1.1" } }, "swagger-client": { "version": "2.2.21", "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-2.2.21.tgz", "integrity": "sha1-WWa+I0dyRm5EcW9l4yAIFm2u66Q=", "dev": true, "requires": { "btoa": "^1.1.2", "cookiejar": "^2.0.1", "js-yaml": "^3.3.0", "lodash-compat": "^3.5.0", "q": "^1.4.1", "superagent": "^2.2" } }, "tapable": { "version": "0.1.10", "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz", "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", "dev": true }, "thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, "requires": { "any-promise": "^1.0.0" } }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==", "dev": true }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, "requires": { "readable-stream": "~2.3.6", "xtend": "~4.0.1" } }, "through2-reduce": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/through2-reduce/-/through2-reduce-1.1.1.tgz", "integrity": "sha1-QCv5qWQO//9RNpkbx9xyoqdnJRw=", "dev": true, "requires": { "through2": "~2.0.0", "xtend": "~4.0.1" } }, "tildify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", "dev": true, "requires": { "os-homedir": "^1.0.0" } }, "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=" }, "timers-browserify": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", "dev": true, "requires": { "setimmediate": "^1.0.4" } }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", "dev": true }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "requires": { "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { "is-buffer": "^1.1.5" } } } }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "requires": { "define-property": "^2.0.2", "extend-shallow": "^3.0.2", "regex-not": "^1.0.2", "safe-regex": "^1.1.0" } }, "to-regex-range": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "requires": { "is-number": "^3.0.0", "repeat-string": "^1.6.1" } }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true }, "tough-cookie": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.2.tgz", "integrity": "sha512-Knz9Yr0hlBoWQgUKzOIvRg5adinizAf49i2gHRhj6cLjlM304zRw7uyiY22ADniDxnPHXfIeyQD0EAkgpIz0ow==", "dev": true }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, "tunnel-agent": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", "integrity": "sha512-e0IoVDWx8SDHc/hwFTqJDQ7CCDTEeGhmcT9jkWJjoGQSpgBz20nAMr80E3Tpk7PatJ1b37DQDgJR3CNSzcMOZQ==", "dev": true }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", "dev": true }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dev": true, "requires": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "uglify-js": { "version": "2.7.5", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", "dev": true, "requires": { "async": "~0.2.6", "source-map": "~0.5.1", "uglify-to-browserify": "~1.0.0", "yargs": "~3.10.0" }, "dependencies": { "async": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", "integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==", "dev": true }, "camelcase": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", "integrity": "sha512-wzLkDa4K/mzI1OSITC+DUyjgIl/ETNHE9QvYgy6J6Jvqyyz4C0Xfd+lQhb19sX2jMpZV4IssUn0VDVmglV+s4g==", "dev": true }, "cliui": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { "center-align": "^0.1.1", "right-align": "^0.1.1", "wordwrap": "0.0.2" } }, "wordwrap": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", "dev": true }, "yargs": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { "camelcase": "^1.0.2", "cliui": "^2.1.0", "decamelize": "^1.0.0", "window-size": "0.1.0" } } } }, "uglify-to-browserify": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", "dev": true }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", "set-value": "^2.0.1" } }, "unique-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", "dev": true }, "unique-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", "dev": true, "requires": { "crypto-random-string": "^1.0.0" } }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "requires": { "has-value": "^0.3.1", "isobject": "^3.0.0" }, "dependencies": { "has-value": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "requires": { "get-value": "^2.0.3", "has-values": "^0.1.4", "isobject": "^2.0.0" }, "dependencies": { "isobject": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "requires": { "isarray": "1.0.0" } } } }, "has-values": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" } } }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", "dev": true, "requires": { "punycode": "1.3.2", "querystring": "0.2.0" }, "dependencies": { "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", "dev": true } } }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, "user-home": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", "dev": true }, "util": { "version": "0.10.4", "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", "dev": true, "requires": { "inherits": "2.0.3" }, "dependencies": { "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true } } }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", "dev": true }, "uuid": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", "dev": true }, "v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", "requires": { "homedir-polyfill": "^1.0.1" } }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "dev": true }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" }, "dependencies": { "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", "dev": true } } }, "vinyl": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "dev": true, "requires": { "clone": "^1.0.0", "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } }, "vinyl-fs": { "version": "0.3.14", "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", "dev": true, "requires": { "defaults": "^1.0.0", "glob-stream": "^3.1.5", "glob-watcher": "^0.0.6", "graceful-fs": "^3.0.0", "mkdirp": "^0.5.0", "strip-bom": "^1.0.0", "through2": "^0.6.1", "vinyl": "^0.4.0" }, "dependencies": { "clone": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", "dev": true }, "graceful-fs": { "version": "3.0.12", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.12.tgz", "integrity": "sha512-J55gaCS4iTTJfTXIxSVw3EMQckcqkpdRv3IR7gu6sq0+tbC363Zx6KH/SEwXASK9JRbhyZmVjJEVJIOxYsB3Qg==", "dev": true, "requires": { "natives": "^1.1.3" } }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, "readable-stream": { "version": "1.0.34", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "strip-bom": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", "dev": true, "requires": { "first-chunk-stream": "^1.0.0", "is-utf8": "^0.2.0" } }, "through2": { "version": "0.6.5", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { "readable-stream": ">=1.0.33-1 <1.1.0-0", "xtend": ">=4.0.0 <4.1.0-0" } }, "vinyl": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { "clone": "^0.2.0", "clone-stats": "^0.0.1" } } } }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", "dev": true, "requires": { "indexof": "0.0.1" } }, "walk": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/walk/-/walk-2.3.3.tgz", "integrity": "sha1-tMDoxCRkwW274dcWZnZerAeBnl8=", "dev": true, "requires": { "foreachasync": "3.x" } }, "watchpack": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz", "integrity": "sha1-Yuqkq15bo1/fwBgnVibjwPXj+ws=", "dev": true, "requires": { "async": "^0.9.0", "chokidar": "^1.0.0", "graceful-fs": "^4.1.2" }, "dependencies": { "async": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==", "dev": true } } }, "webpack": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-1.15.0.tgz", "integrity": "sha1-T/MfU9sDM55VFkqdRo7gMklo/pg=", "dev": true, "requires": { "acorn": "^3.0.0", "async": "^1.3.0", "clone": "^1.0.2", "enhanced-resolve": "~0.9.0", "interpret": "^0.6.4", "loader-utils": "^0.2.11", "memory-fs": "~0.3.0", "mkdirp": "~0.5.0", "node-libs-browser": "^0.7.0", "optimist": "~0.6.0", "supports-color": "^3.1.0", "tapable": "~0.1.8", "uglify-js": "~2.7.3", "watchpack": "^0.2.1", "webpack-core": "~0.6.9" }, "dependencies": { "interpret": { "version": "0.6.6", "resolved": "https://registry.npmjs.org/interpret/-/interpret-0.6.6.tgz", "integrity": "sha1-/s16GOfOXKar+5U+H4YhOknxYls=", "dev": true }, "supports-color": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { "has-flag": "^1.0.0" } } } }, "webpack-core": { "version": "0.6.9", "resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz", "integrity": "sha1-/FcViMhVjad76e+23r3Fo7FyvcI=", "dev": true, "requires": { "source-list-map": "~0.1.7", "source-map": "~0.4.1" }, "dependencies": { "source-map": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { "amdefine": ">=0.0.4" } } } }, "webpack-stream": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/webpack-stream/-/webpack-stream-3.2.0.tgz", "integrity": "sha1-Oh0WD7EdQXJ7fObzL3IkZPmLIYY=", "dev": true, "requires": { "gulp-util": "^3.0.7", "lodash.clone": "^4.3.2", "lodash.some": "^4.2.2", "memory-fs": "^0.3.0", "through": "^2.3.8", "vinyl": "^1.1.0", "webpack": "^1.12.9" }, "dependencies": { "vinyl": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { "clone": "^1.0.0", "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } } }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "requires": { "isexe": "^2.0.0" } }, "which-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" }, "window-size": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true }, "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "dev": true }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", "requires": { "string-width": "^1.0.1", "strip-ansi": "^3.0.1" } }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "write-file-atomic": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", "signal-exit": "^3.0.2" } }, "xdg-basedir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", "dev": true }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, "y18n": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" }, "yargs": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.2.tgz", "integrity": "sha512-ZEjj/dQYQy0Zx0lgLMLR8QuaqTihnxirir7EwUHp1Axq4e3+k8jXU5K0VLbNvedv1f4EWtBonDIZm0NUr+jCcA==", "requires": { "camelcase": "^3.0.0", "cliui": "^3.2.0", "decamelize": "^1.1.1", "get-caller-file": "^1.0.1", "os-locale": "^1.4.0", "read-pkg-up": "^1.0.1", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^1.0.2", "which-module": "^1.0.0", "y18n": "^3.2.1", "yargs-parser": "^5.0.1" } }, "yargs-parser": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.1.tgz", "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==", "requires": { "camelcase": "^3.0.0", "object.assign": "^4.1.0" } }, "yauzl": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", "integrity": "sha512-TXNR2Feu/p/8k5YRy4z45wCUhoncIrZywmRd+xW0IvB3lWTAM7F6wVbeJvRjO0dplQ8oqmJEj/TpJuULBV/hbw==", "dev": true, "requires": { "fd-slicer": "~1.0.1" } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/browser/package.json000066400000000000000000000013101465037340600312620ustar00rootroot00000000000000{ "name": "grpc-gateway-example", "version": "1.0.0", "description": "Example use of gRPC-Gateway from browser", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "SEE LICENSE", "devDependencies": { "bower": "^1.7.9", "bower-config": "^0.6.2", "bower-logger": "^0.2.2", "configstore": "^4.0.0", "gulp": "^3.9.1", "gulp-bower": "0.0.13", "gulp-exit": "0.0.2", "gulp-jasmine-browser": "^1.3.2", "gulp-shell": "^0.5.2", "jasmine": "^2.4.1", "mout": "^1.2.4", "phantomjs": "^2.1.7", "swagger-client": "^2.1.28", "webpack-stream": "^3.2.0" }, "dependencies": { "gulp-cli": "^2.3.0" } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/000077500000000000000000000000001465037340600267575ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/000077500000000000000000000000001465037340600275065ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/.gitignore000066400000000000000000000000061465037340600314720ustar00rootroot00000000000000/docs .swagger-codegen-ignore000066400000000000000000000000131465037340600337440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe.gitignore golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/.swagger-codegen/000077500000000000000000000000001465037340600326255ustar00rootroot00000000000000VERSION000066400000000000000000000000051465037340600336110ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/.swagger-codegen2.4.8golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/BUILD.bazel000066400000000000000000000062411465037340600313670ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") package(default_visibility = ["//visibility:public"]) go_library( name = "abe", srcs = [ "api_a_bit_of_everything.go", "api_a_bit_of_everything_service.go", "api_camel_case_service_name.go", "api_echo_rpc.go", "api_snake_enum_service.go", "client.go", "configuration.go", "enum_helper.go", "model_a_bit_of_everything.go", "model_a_bit_of_everything_1.go", "model_a_bit_of_everything_2.go", "model_a_bit_of_everything_3.go", "model_a_bit_of_everything_4.go", "model_a_bit_of_everything_5.go", "model_a_bit_of_everything_6.go", "model_a_bit_of_everything_7.go", "model_a_bit_of_everything_8.go", "model_a_bit_of_everything_nested.go", "model_a_bit_of_everything_service_deep_path_echo_body.go", "model_a_bit_of_everything_service_deep_path_echo_body_single_nested.go", "model_a_bit_of_everything_service_post_with_empty_body_body.go", "model_a_bit_of_everything_service_update_body.go", "model_a_bit_of_everything_service_update_v2_body.go", "model_book.go", "model_examplepb_a_bit_of_everything.go", "model_examplepb_a_bit_of_everything_repeated.go", "model_examplepb_a_bit_of_everything_service_update_body.go", "model_examplepb_bar.go", "model_examplepb_body.go", "model_examplepb_book.go", "model_examplepb_check_status_response.go", "model_examplepb_error_object.go", "model_examplepb_error_response.go", "model_examplepb_foo.go", "model_examplepb_numeric_enum.go", "model_examplepb_required_message_type_request.go", "model_examplepb_snake_enum_response.go", "model_examplepbsnake_case_0_enum.go", "model_examplepbsnake_case_enum.go", "model_message_path_enum_nested_path_enum.go", "model_nested_deep_enum.go", "model_oneofenum_example_enum.go", "model_pathenum_path_enum.go", "model_pathenumsnake_case_for_import.go", "model_protobuf_any.go", "model_protoexamplepb_foo.go", "model_rpc_status.go", "model_sub_string_message.go", "model_the_book_to_update_.go", "model_the_book_to_update__1.go", "model_the_book_to_update_the_books_name_field_is_used_to_identify_the_book_to_be_updated_format_publisherspublisherbooksbook.go", "model_update_v2_request_request_for_update_includes_the_message_and_the_update_mask.go", "model_update_v2_request_request_for_update_includes_the_message_and_the_update_mask_1.go", "model_v1exampledeep_pathsingle_nested_name_single_nested.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/abe", deps = [ "//examples/internal/proto/examplepb", "//examples/internal/proto/pathenum", "//runtime", "@com_github_antihax_optional//:optional", "@org_golang_x_oauth2//:oauth2", ], ) alias( name = "go_default_library", actual = ":abe", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/api/000077500000000000000000000000001465037340600302575ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/api/swagger.yaml000066400000000000000000006415121465037340600326130ustar00rootroot00000000000000--- swagger: "2.0" info: version: "1.0" title: "A Bit of Everything" contact: name: "gRPC-Gateway project" url: "https://github.com/grpc-ecosystem/grpc-gateway" email: "none@example.com" license: name: "BSD 3-Clause License" url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE" x-something-something: "yadda" tags: - name: "echo rpc" description: "Echo Rpc description" x-traitTag: true - name: "ABitOfEverything" description: "ABitOfEverythingService description -- which should not be used in\ \ place of the documentation comment!" externalDocs: description: "Find out more about EchoService" url: "https://github.com/grpc-ecosystem/grpc-gateway" - name: "camelCaseServiceName" - name: "AnotherServiceWithNoBindings" - name: "SnakeEnumService" schemes: - "http" - "https" - "wss" consumes: - "application/json" - "application/x-foo-mime" produces: - "application/json" - "application/x-foo-mime" security: - ApiKeyAuth: [] BasicAuth: [] - ApiKeyAuth: [] OAuth2: - "read" - "write" paths: /v1/example/a_bit_of_everything: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CreateBody" parameters: - in: "body" name: "body" description: "Intentionally complicated message type to cover many features\ \ of Protobuf." required: true schema: $ref: "#/definitions/examplepbABitOfEverything" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/echo/{value}: get: tags: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" operationId: "ABitOfEverythingService_Echo" parameters: - name: "value" in: "path" required: true type: "string" x-exportParamName: "Value" responses: 200: description: "A successful response." examples: application/json: value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "integer" format: "integer" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" 503: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" /v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckNestedEnumGetQueryParams" parameters: - name: "singleNested.ok" in: "path" description: "DeepEnum description." required: true type: "string" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "uuid" in: "query" required: true type: "string" pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" format: "uuid" x-internal: true x-exportParamName: "Uuid" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/params/get/{singleNested.name}: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckGetQueryParams" parameters: - name: "singleNested.name" in: "path" description: "name is nested field." required: true type: "string" x-exportParamName: "SingleNestedName" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "uuid" in: "query" required: true type: "string" pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" format: "uuid" x-internal: true x-exportParamName: "Uuid" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/params/post/{stringValue}: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckPostQueryParams" parameters: - name: "stringValue" in: "path" required: true type: "string" x-exportParamName: "StringValue" - in: "body" name: "singleNested" required: true schema: $ref: "#/definitions/ABitOfEverythingNested" x-exportParamName: "SingleNested" - name: "uuid" in: "query" required: true type: "string" pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" format: "uuid" x-internal: true x-exportParamName: "Uuid" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/query/{uuidName}: get: tags: - "ABitOfEverything" operationId: "ABitOfEverythingService_GetQuery" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" security: [] externalDocs: description: "Find out more about GetQuery" url: "https://github.com/grpc-ecosystem/grpc-gateway" deprecated: true ? /v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation} : post: tags: - "ABitOfEverythingService" summary: "Create a new ABitOfEverything" description: "This API creates a new ABitOfEverything" operationId: "ABitOfEverythingService_Create" parameters: - name: "floatValue" in: "path" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "path" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "path" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "path" required: true type: "string" format: "uint64" x-exportParamName: "Uint64Value" - name: "int32Value" in: "path" required: true type: "integer" format: "int32" x-exportParamName: "Int32Value" - name: "fixed64Value" in: "path" required: true type: "string" format: "uint64" x-exportParamName: "Fixed64Value" - name: "fixed32Value" in: "path" required: true type: "integer" format: "int64" x-exportParamName: "Fixed32Value" - name: "boolValue" in: "path" required: true type: "boolean" x-exportParamName: "BoolValue" - name: "stringValue" in: "path" required: true type: "string" pattern: "strprefix/[^/]+" x-exportParamName: "StringValue" - name: "uint32Value" in: "path" required: true type: "integer" format: "int64" x-exportParamName: "Uint32Value" - name: "sfixed32Value" in: "path" required: true type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" - name: "sfixed64Value" in: "path" required: true type: "string" format: "int64" x-exportParamName: "Sfixed64Value" - name: "sint32Value" in: "path" required: true type: "integer" format: "int32" x-exportParamName: "Sint32Value" - name: "sint64Value" in: "path" required: true type: "string" format: "int64" x-exportParamName: "Sint64Value" - name: "nonConventionalNameValue" in: "path" required: true type: "string" x-exportParamName: "NonConventionalNameValue" - name: "enumValue" in: "path" required: true type: "string" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" - name: "pathEnumValue" in: "path" required: true type: "string" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" - name: "nestedPathEnumValue" in: "path" required: true type: "string" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" - name: "enumValueAnnotation" in: "path" description: "Numeric enum description." required: true type: "string" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "uuid" in: "query" required: true type: "string" pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" format: "uuid" x-internal: true x-exportParamName: "Uuid" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/{uuidName}: head: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_Exists" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: type: "object" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" put: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_Update" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - in: "body" name: "body" required: true schema: $ref: "#/definitions/examplepbABitOfEverythingServiceUpdateBody" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" options: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CustomOptionsRequest" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: type: "object" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/{uuidName}:custom: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_Custom" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/{uuidName}:custom:custom: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_DoubleColon" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - name: "singleNested.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "SingleNestedName" x-optionalDataType: "String" - name: "singleNested.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "SingleNestedAmount" x-optionalDataType: "Int64" - name: "singleNested.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "SingleNestedOk" x-optionalDataType: "String" - name: "floatValue" in: "query" description: "Float value field" required: true type: "number" default: 0.2 format: "float" x-exportParamName: "FloatValue" - name: "doubleValue" in: "query" required: true type: "number" format: "double" x-exportParamName: "DoubleValue" - name: "int64Value" in: "query" required: true type: "string" format: "int64" x-exportParamName: "Int64Value" - name: "uint64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Uint64Value" x-optionalDataType: "String" - name: "int32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Int32Value" x-optionalDataType: "Int32" - name: "fixed64Value" in: "query" required: false type: "string" format: "uint64" x-exportParamName: "Fixed64Value" x-optionalDataType: "String" - name: "fixed32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Fixed32Value" x-optionalDataType: "Int64" - name: "boolValue" in: "query" required: false type: "boolean" x-exportParamName: "BoolValue" x-optionalDataType: "Bool" - name: "stringValue" in: "query" required: false type: "string" x-exportParamName: "StringValue" x-optionalDataType: "String" - name: "bytesValue" in: "query" required: false type: "string" format: "byte" x-exportParamName: "BytesValue" x-optionalDataType: "String" - name: "uint32Value" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Uint32Value" x-optionalDataType: "Int64" - name: "enumValue" in: "query" description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValue" x-optionalDataType: "String" - name: "pathEnumValue" in: "query" required: false type: "string" default: "ABC" enum: - "ABC" - "DEF" x-exportParamName: "PathEnumValue" x-optionalDataType: "String" - name: "nestedPathEnumValue" in: "query" required: false type: "string" default: "GHI" enum: - "GHI" - "JKL" x-exportParamName: "NestedPathEnumValue" x-optionalDataType: "String" - name: "sfixed32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sfixed32Value" x-optionalDataType: "Int32" - name: "sfixed64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sfixed64Value" x-optionalDataType: "String" - name: "sint32Value" in: "query" required: false type: "integer" format: "int32" x-exportParamName: "Sint32Value" x-optionalDataType: "Int32" - name: "sint64Value" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Sint64Value" x-optionalDataType: "String" - name: "repeatedStringValue" in: "query" required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringValue" - name: "oneofEmpty" in: "query" required: false type: "object" x-exportParamName: "OneofEmpty" - name: "oneofString" in: "query" required: false type: "string" x-exportParamName: "OneofString" x-optionalDataType: "String" - name: "mapValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MapValue" - name: "mappedStringValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false type: "string" x-exportParamName: "MappedStringValue" x-optionalDataType: "String" - name: "mappedNestedValue" in: "query" description: "This is a request variable of the map type. The query format\ \ is \"map_name[key]=value\", e.g. If the map name is Age, the key type\ \ is string, and the value type is integer, the query parameter is expressed\ \ as Age[\"bob\"]=18" required: false x-exportParamName: "MappedNestedValue" - name: "nonConventionalNameValue" in: "query" required: false type: "string" x-exportParamName: "NonConventionalNameValue" x-optionalDataType: "String" - name: "timestampValue" in: "query" required: false type: "string" format: "date-time" x-exportParamName: "TimestampValue" x-optionalDataType: "Time" - name: "repeatedEnumValue" in: "query" description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumValue" - name: "repeatedEnumAnnotation" in: "query" description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\ \n - ZERO: ZERO means 0\n - ONE: ONE means 1" required: false type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "multi" x-exportParamName: "RepeatedEnumAnnotation" - name: "enumValueAnnotation" in: "query" description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\ \ ZERO means 0\n - ONE: ONE means 1" required: false type: "string" default: "ZERO" enum: - "ZERO" - "ONE" x-exportParamName: "EnumValueAnnotation" x-optionalDataType: "String" - name: "repeatedStringAnnotation" in: "query" description: "Repeated string title\n\nRepeated string description." required: false type: "array" items: type: "string" collectionFormat: "multi" x-exportParamName: "RepeatedStringAnnotation" - name: "nestedAnnotation.name" in: "query" description: "name is nested field." required: false type: "string" x-exportParamName: "NestedAnnotationName" x-optionalDataType: "String" - name: "nestedAnnotation.amount" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "NestedAnnotationAmount" x-optionalDataType: "Int64" - name: "nestedAnnotation.ok" in: "query" description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." required: false type: "string" default: "FALSE" enum: - "FALSE" - "TRUE" x-exportParamName: "NestedAnnotationOk" x-optionalDataType: "String" - name: "int64OverrideType" in: "query" required: false type: "integer" format: "int64" x-exportParamName: "Int64OverrideType" x-optionalDataType: "Int64" - name: "requiredStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as required in Open API definition" required: true type: "string" x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation" - name: "outputOnlyStringViaFieldBehaviorAnnotation" in: "query" description: "mark a field as readonly in Open API definition" required: false type: "string" x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation" x-optionalDataType: "String" - name: "optionalStringValue" in: "query" required: false type: "string" x-exportParamName: "OptionalStringValue" x-optionalDataType: "String" - name: "productId" in: "query" description: "Test openapiv2 generation of repeated fields\n\nOnly digits\ \ are allowed." required: false type: "array" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" collectionFormat: "multi" x-exportParamName: "ProductId" - name: "optionalStringField" in: "query" description: "Test openapiv2 generation of required fields with annotation\ \ and jsonschema to reproduce" required: false type: "string" x-exportParamName: "OptionalStringField" x-optionalDataType: "String" - name: "requiredStringField1" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField1" - name: "requiredStringField2" in: "query" required: true type: "string" x-exportParamName: "RequiredStringField2" - name: "required_field_behavior_json_name_custom" in: "query" description: "Test openapiv2 handling of required json_name fields" required: true type: "string" x-exportParamName: "RequiredFieldBehaviorJsonNameCustom" - name: "required_field_schema_json_name_custom" in: "query" required: true type: "string" x-exportParamName: "RequiredFieldSchemaJsonNameCustom" - name: "trailingOnly" in: "query" description: "Trailing only" required: false type: "string" x-exportParamName: "TrailingOnly" x-optionalDataType: "String" - name: "trailingOnlyDot" in: "query" description: "Trailing only dot." required: false type: "string" x-exportParamName: "TrailingOnlyDot" x-optionalDataType: "String" - name: "trailingBoth" in: "query" description: "Leading both\n\nTrailing both." required: false type: "string" x-exportParamName: "TrailingBoth" x-optionalDataType: "String" - name: "trailingMultiline" in: "query" description: "Leading multiline\n\nThis is an example of a multi-line comment.\n\ \nTrailing multiline." required: false type: "string" x-exportParamName: "TrailingMultiline" x-optionalDataType: "String" - name: "uuids" in: "query" description: "Specify a custom format of repeated field items" required: false type: "array" items: type: "string" format: "uuid" collectionFormat: "multi" x-exportParamName: "Uuids" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/a_bit_of_everything/{uuid}: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_Lookup" parameters: - name: "uuid" in: "path" required: true type: "string" x-exportParamName: "Uuid" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" delete: tags: - "ABitOfEverything" operationId: "ABitOfEverythingService_Delete" parameters: - name: "uuid" in: "path" required: true type: "string" x-exportParamName: "Uuid" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" security: - ApiKeyAuth: [] OAuth2: - "read" - "write" x-irreversible: true ? /v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value} : get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_GetRepeatedQuery" parameters: - name: "pathRepeatedFloatValue" in: "path" description: "repeated values. they are comma-separated in path" required: true type: "array" items: type: "number" format: "float" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedFloatValue" - name: "pathRepeatedDoubleValue" in: "path" required: true type: "array" items: type: "number" format: "double" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedDoubleValue" - name: "pathRepeatedInt64Value" in: "path" required: true type: "array" items: type: "string" format: "int64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedInt64Value" - name: "pathRepeatedUint64Value" in: "path" required: true type: "array" items: type: "string" format: "uint64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedUint64Value" - name: "pathRepeatedInt32Value" in: "path" required: true type: "array" items: type: "integer" format: "int32" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedInt32Value" - name: "pathRepeatedFixed64Value" in: "path" required: true type: "array" items: type: "string" format: "uint64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedFixed64Value" - name: "pathRepeatedFixed32Value" in: "path" required: true type: "array" items: type: "integer" format: "int64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedFixed32Value" - name: "pathRepeatedBoolValue" in: "path" required: true type: "array" items: type: "boolean" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedBoolValue" - name: "pathRepeatedStringValue" in: "path" required: true type: "array" items: type: "string" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedStringValue" - name: "pathRepeatedBytesValue" in: "path" required: true type: "array" items: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedBytesValue" - name: "pathRepeatedUint32Value" in: "path" required: true type: "array" items: type: "integer" format: "int64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedUint32Value" - name: "pathRepeatedEnumValue" in: "path" required: true type: "array" items: type: "string" enum: - "ZERO" - "ONE" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedEnumValue" - name: "pathRepeatedSfixed32Value" in: "path" required: true type: "array" items: type: "integer" format: "int32" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedSfixed32Value" - name: "pathRepeatedSfixed64Value" in: "path" required: true type: "array" items: type: "string" format: "int64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedSfixed64Value" - name: "pathRepeatedSint32Value" in: "path" required: true type: "array" items: type: "integer" format: "int32" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedSint32Value" - name: "pathRepeatedSint64Value" in: "path" required: true type: "array" items: type: "string" format: "int64" collectionFormat: "csv" minItems: 1 x-exportParamName: "PathRepeatedSint64Value" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverythingRepeated" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/checkStatus: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckStatus" parameters: [] responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbCheckStatusResponse" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/deep_path/{singleNested.name}: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_DeepPathEcho" parameters: - name: "singleNested.name" in: "path" description: "name is nested field." required: true type: "string" x-exportParamName: "SingleNestedName" - in: "body" name: "body" required: true schema: $ref: "#/definitions/ABitOfEverythingServiceDeepPathEchoBody" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbABitOfEverything" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/oneofenum: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_PostOneofEnum" parameters: - in: "body" name: "exampleEnum" required: true schema: $ref: "#/definitions/oneofenumExampleEnum" x-exportParamName: "ExampleEnum" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/requiredmessagetype: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_PostRequiredMessageType" parameters: - in: "body" name: "body" required: true schema: $ref: "#/definitions/examplepbRequiredMessageTypeRequest" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/snake/{who}/{what}/{where}: get: tags: - "SnakeEnumService" operationId: "SnakeEnumService_SnakeEnum" parameters: - name: "who" in: "path" required: true type: "string" enum: - "value_e" - "value_f" x-exportParamName: "Who" - name: "what" in: "path" required: true type: "string" enum: - "value_c" - "value_d" x-exportParamName: "What" - name: "where" in: "path" required: true type: "string" enum: - "value_x" - "value_y" x-exportParamName: "Where" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSnakeEnumResponse" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/{book.name}: patch: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_UpdateBook" parameters: - name: "book.name" in: "path" description: "The resource name of the book.\n\nFormat: `publishers/{publisher}/books/{book}`\n\ \nExample: `publishers/1257894000000000000/books/my-book`" required: true type: "string" pattern: "publishers/[^/]+/books/[^/]+" x-exportParamName: "BookName" - in: "body" name: "book" description: "The book to update.\n\nThe book's `name` field is used to identify\ \ the book to be updated.\nFormat: publishers/{publisher}/books/{book}" required: true schema: $ref: "The book to update." x-exportParamName: "Book" - name: "allowMissing" in: "query" description: "If set to true, and the book is not found, a new book will be\ \ created.\nIn this situation, `update_mask` is ignored." required: false type: "boolean" x-exportParamName: "AllowMissing" x-optionalDataType: "Bool" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbBook" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/{parent}/books: post: tags: - "ABitOfEverythingService" summary: "Create a book." operationId: "ABitOfEverythingService_CreateBook" parameters: - name: "parent" in: "path" description: "The publisher in which to create the book.\n\nFormat: `publishers/{publisher}`\n\ \nExample: `publishers/1257894000000000000`" required: true type: "string" pattern: "publishers/[^/]+" x-exportParamName: "Parent" - in: "body" name: "book" description: "The book to create." required: true schema: $ref: "#/definitions/examplepbBook" x-exportParamName: "Book" - name: "bookId" in: "query" description: "The ID to use for the book.\n\nThis must start with an alphanumeric\ \ character." required: false type: "string" x-exportParamName: "BookId" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbBook" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/a_bit_of_everything/{uuidName}: put: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_UpdateV2" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - in: "body" name: "abe" description: "A bit of everything\n\nIntentionally complicated message type\ \ to cover many features of Protobuf." required: true schema: $ref: "#/definitions/A bit of everything" x-exportParamName: "Abe" - name: "updateMask" in: "query" description: "The paths to update." required: false type: "string" x-exportParamName: "UpdateMask" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" patch: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_UpdateV22" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - in: "body" name: "abe" description: "A bit of everything\n\nIntentionally complicated message type\ \ to cover many features of Protobuf." required: true schema: $ref: "#/definitions/A bit of everything_1" x-exportParamName: "Abe" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/echo: get: tags: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" operationId: "ABitOfEverythingService_Echo3" parameters: - name: "value" in: "query" required: false type: "string" x-exportParamName: "Value" x-optionalDataType: "String" responses: 200: description: "A successful response." examples: application/json: value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "integer" format: "integer" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" 503: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" post: tags: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" operationId: "ABitOfEverythingService_Echo2" parameters: - in: "body" name: "value" required: true schema: type: "string" x-exportParamName: "Value" responses: 200: description: "A successful response." examples: application/json: value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "integer" format: "integer" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" 503: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" /v2/example/empty: get: tags: - "camelCaseServiceName" operationId: "camelCaseServiceName_Empty" parameters: [] responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/errorwithdetails: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_ErrorWithDetails" parameters: [] responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/overwriterequestcontenttype: post: tags: - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteRequestContentType" consumes: - "application/x-bar-mime" parameters: - in: "body" name: "body" required: true schema: $ref: "#/definitions/examplepbBody" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/overwriteresponsecontenttype: get: tags: - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteResponseContentType" produces: - "application/text" parameters: [] responses: 200: description: "A successful response." schema: type: "string" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/postwithemptybody/{name}: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_PostWithEmptyBody" parameters: - name: "name" in: "path" required: true type: "string" x-exportParamName: "Name" - in: "body" name: "body" required: true schema: $ref: "#/definitions/ABitOfEverythingServicePostWithEmptyBodyBody" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/timeout: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_Timeout" parameters: [] responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/example/withbody/{id}: post: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_GetMessageWithBody" parameters: - name: "id" in: "path" required: true type: "string" x-exportParamName: "Id" - in: "body" name: "data" required: true schema: $ref: "#/definitions/examplepbBody" x-exportParamName: "Data" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2/{value}:check: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckExternalPathEnum" parameters: - name: "value" in: "path" required: true type: "string" enum: - "ABC" - "DEF" x-exportParamName: "Value" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v2a/example/a_bit_of_everything/{uuidName}: patch: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_UpdateV23" parameters: - name: "uuidName" in: "path" required: true type: "string" format: "uuid" x-internal: true x-exportParamName: "UuidName" - in: "body" name: "body" required: true schema: $ref: "#/definitions/ABitOfEverythingServiceUpdateV2Body" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v3/{value}:check: get: tags: - "ABitOfEverythingService" operationId: "ABitOfEverythingService_CheckExternalNestedPathEnum" parameters: - name: "value" in: "path" required: true type: "string" enum: - "GHI" - "JKL" x-exportParamName: "Value" responses: 200: description: "A successful response." schema: type: "object" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" 418: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" 500: description: "Server error" schema: $ref: "#/definitions/examplepbErrorResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" securityDefinitions: ApiKeyAuth: type: "apiKey" name: "X-API-Key" in: "header" x-amazon-apigateway-authorizer: authorizerResultTtlInSeconds: 60 type: "token" x-amazon-apigateway-authtype: "oauth2" BasicAuth: type: "basic" OAuth2: type: "oauth2" authorizationUrl: "https://example.com/oauth/authorize" tokenUrl: "https://example.com/oauth/token" flow: "accessCode" scopes: admin: "Grants read and write access to administrative information" read: "Grants read access" write: "Grants write access" definitions: ABitOfEverythingNested: type: "object" properties: name: type: "string" description: "name is nested field." amount: type: "integer" format: "int64" ok: description: "DeepEnum description." $ref: "#/definitions/NestedDeepEnum" description: "Nested is nested type." example: ok: "TRUE" ABitOfEverythingServiceDeepPathEchoBody: type: "object" required: - "doubleValue" - "floatValue" - "int64Value" - "requiredStringField1" - "requiredStringField2" - "requiredStringViaFieldBehaviorAnnotation" - "required_field_behavior_json_name_custom" - "required_field_schema_json_name_custom" - "uuid" properties: singleNested: $ref: "#/definitions/ABitOfEverythingServiceDeepPathEchoBody_singleNested" uuid: type: "string" format: "uuid" minLength: 1 pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" x-internal: true nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" externalDocs: description: "Find out more about ABitOfEverything" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: int64_value: 12 double_value: 12.3 x-a-bit-of-everything-foo: "bar" ABitOfEverythingServicePostWithEmptyBodyBody: type: "object" ABitOfEverythingServiceUpdateV2Body: type: "object" properties: abe: $ref: "#/definitions/A bit of everything_2" updateMask: type: "string" description: "The paths to update." title: "UpdateV2Request request for update includes the message and the update\ \ mask" example: abe: "{\"int64_value\":12,\"double_value\":12.3}" updateMask: "updateMask" MessagePathEnumNestedPathEnum: type: "string" enum: - "GHI" - "JKL" default: "GHI" NestedDeepEnum: type: "string" description: "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE:\ \ TRUE is true." enum: - "FALSE" - "TRUE" default: "FALSE" examplepbABitOfEverything: type: "object" required: - "doubleValue" - "floatValue" - "int64Value" - "requiredStringField1" - "requiredStringField2" - "requiredStringViaFieldBehaviorAnnotation" - "required_field_behavior_json_name_custom" - "required_field_schema_json_name_custom" - "uuid" properties: singleNested: $ref: "#/definitions/ABitOfEverythingNested" uuid: type: "string" format: "uuid" minLength: 1 pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" x-internal: true nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" externalDocs: description: "Find out more about ABitOfEverything" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: int64_value: 12 double_value: 12.3 x-a-bit-of-everything-foo: "bar" examplepbABitOfEverythingRepeated: type: "object" properties: pathRepeatedFloatValue: type: "array" title: "repeated values. they are comma-separated in path" items: type: "number" format: "float" pathRepeatedDoubleValue: type: "array" items: type: "number" format: "double" pathRepeatedInt64Value: type: "array" items: type: "string" format: "int64" pathRepeatedUint64Value: type: "array" items: type: "string" format: "uint64" pathRepeatedInt32Value: type: "array" items: type: "integer" format: "int32" pathRepeatedFixed64Value: type: "array" items: type: "string" format: "uint64" pathRepeatedFixed32Value: type: "array" items: type: "integer" format: "int64" pathRepeatedBoolValue: type: "array" items: type: "boolean" pathRepeatedStringValue: type: "array" items: type: "string" pathRepeatedBytesValue: type: "array" items: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" pathRepeatedUint32Value: type: "array" items: type: "integer" format: "int64" pathRepeatedEnumValue: type: "array" items: $ref: "#/definitions/examplepbNumericEnum" pathRepeatedSfixed32Value: type: "array" items: type: "integer" format: "int32" pathRepeatedSfixed64Value: type: "array" items: type: "string" format: "int64" pathRepeatedSint32Value: type: "array" items: type: "integer" format: "int32" pathRepeatedSint64Value: type: "array" items: type: "string" format: "int64" title: "ABitOfEverythingRepeated is used to validate repeated path parameter functionality" example: path_repeated_bool_value: - true - true - false - true path_repeated_int32_value: - 1 - 2 - 3 examplepbABitOfEverythingServiceUpdateBody: type: "object" required: - "doubleValue" - "floatValue" - "int64Value" - "requiredStringField1" - "requiredStringField2" - "requiredStringViaFieldBehaviorAnnotation" - "required_field_behavior_json_name_custom" - "required_field_schema_json_name_custom" properties: singleNested: $ref: "#/definitions/ABitOfEverythingNested" nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" externalDocs: description: "Find out more about ABitOfEverything" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: int64_value: 12 double_value: 12.3 x-a-bit-of-everything-foo: "bar" examplepbBar: type: "object" required: - "id" properties: id: type: "string" examplepbBody: type: "object" properties: name: type: "string" examplepbBook: type: "object" properties: name: type: "string" description: "The resource name of the book.\n\nFormat: `publishers/{publisher}/books/{book}`\n\ \nExample: `publishers/1257894000000000000/books/my-book`" id: type: "string" description: "Output only. The book's ID." readOnly: true createTime: type: "string" format: "date-time" description: "Output only. Creation time of the book." readOnly: true description: "An example resource type from AIP-123 used to test the behavior\ \ described in\nthe CreateBookRequest message.\n\nSee: https://google.aip.dev/123" example: createTime: "2000-01-23T04:56:07.000+00:00" name: "name" id: "id" examplepbCheckStatusResponse: type: "object" properties: status: $ref: "#/definitions/rpcStatus" example: status: code: 0 details: - '@type': "@type" - '@type': "@type" message: "message" examplepbErrorObject: type: "object" properties: code: type: "integer" format: "integer" description: "Response code" title: "code" message: type: "string" description: "Response message" title: "message" pattern: "^[a-zA-Z0-9]{1, 32}$" examplepbErrorResponse: type: "object" properties: correlationId: type: "string" format: "uuid" example: "2438ac3c-37eb-4902-adef-ed16b4431030" description: "Unique event identifier for server requests" title: "x-correlation-id" pattern: "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$" error: $ref: "#/definitions/examplepbErrorObject" examplepbNumericEnum: type: "string" description: "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE\ \ means 1" enum: - "ZERO" - "ONE" default: "ZERO" examplepbRequiredMessageTypeRequest: type: "object" required: - "foo" - "id" properties: id: type: "string" foo: $ref: "#/definitions/protoexamplepbFoo" title: "Required message type -> OpenAPI\nhttps://github.com/grpc-ecosystem/grpc-gateway/issues/2837" examplepbSnakeEnumResponse: type: "object" examplepbsnake_case_0_enum: type: "string" title: "Ignoring lint warnings as this enum type exist to validate proper functionality\n\ for projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" description: "- value_e: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_f:\ \ buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE" enum: - "value_e" - "value_f" default: "value_e" examplepbsnake_case_enum: type: "string" title: "Ignoring lint warnings as this enum type exist to validate proper functionality\n\ for projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" description: "- value_c: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_d:\ \ buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE" enum: - "value_c" - "value_d" default: "value_c" oneofenumExampleEnum: type: "string" enum: - "EXAMPLE_ENUM_UNSPECIFIED" - "EXAMPLE_ENUM_FIRST" default: "EXAMPLE_ENUM_UNSPECIFIED" pathenumPathEnum: type: "string" enum: - "ABC" - "DEF" default: "ABC" pathenumsnake_case_for_import: type: "string" title: "Ignoring lint warnings as this enum type exist to validate proper functionality\n\ for projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" description: "- value_x: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_y:\ \ buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE" enum: - "value_x" - "value_y" default: "value_x" protobufAny: type: "object" properties: '@type': type: "string" description: "A URL/resource name that uniquely identifies the type of the\ \ serialized\nprotocol buffer message. This string must contain at least\n\ one \"/\" character. The last segment of the URL's path must represent\n\ the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ \nIn practice, teams usually precompile into the binary all types that they\n\ expect it to use in the context of Any. However, for URLs which use the\n\ scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ server that maps type URLs to message definitions as follows:\n\n* If no\ \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ \ an error.\n* Applications are allowed to cache lookup results based on\ \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ \ Therefore, binary compatibility needs to be preserved\n on changes to\ \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ \ this functionality is not currently available in the official\nprotobuf\ \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ \ with implementation specific semantics." description: "`Any` contains an arbitrary serialized protocol buffer message along\ \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ \ library provides support to pack/unpack Any values in the form\nof utility\ \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ \ }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ \ any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in\ \ Go\n\n foo := &pb.Foo{...}\n any, err := anypb.New(foo)\n if err\ \ != nil {\n ...\n }\n ...\n foo := &pb.Foo{}\n if err\ \ := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods\ \ provided by protobuf library will by default use\n'type.googleapis.com/full.type.name'\ \ as the type URL and the unpack\nmethods only use the fully qualified type\ \ name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\"\ \ will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an\ \ `Any` value uses the regular\nrepresentation of the deserialized, embedded\ \ message, with an\nadditional field `@type` which contains the type URL. Example:\n\ \n package google.profile;\n message Person {\n string first_name\ \ = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ \ that representation will be embedded adding a field\n`value` which holds the\ \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ \ \"value\": \"1.212s\"\n }" example: '@type': "@type" additionalProperties: {} protoexamplepbFoo: type: "object" required: - "bar" properties: bar: $ref: "#/definitions/examplepbBar" rpcStatus: type: "object" properties: code: type: "integer" format: "int32" description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ \ common set of\nmessage types for APIs to use." items: $ref: "#/definitions/protobufAny" description: "The `Status` type defines a logical error model that is suitable\ \ for\ndifferent programming environments, including REST APIs and RPC APIs.\ \ It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\n\ three pieces of data: error code, error message, and error details.\n\nYou can\ \ find out more about this error model and how to work with it in the\n[API\ \ Design Guide](https://cloud.google.com/apis/design/errors)." example: code: 0 details: - '@type': "@type" - '@type': "@type" message: "message" subStringMessage: type: "object" properties: value: type: "string" The book to update.: type: "object" properties: id: type: "string" description: "Output only. The book's ID." readOnly: true createTime: type: "string" format: "date-time" description: "Output only. Creation time of the book." readOnly: true title: "The book to update." description: "The book's `name` field is used to identify the book to be updated.\n\ Format: publishers/{publisher}/books/{book}" A bit of everything: type: "object" required: - "doubleValue" - "floatValue" - "int64Value" - "requiredStringField1" - "requiredStringField2" - "requiredStringViaFieldBehaviorAnnotation" - "required_field_behavior_json_name_custom" - "required_field_schema_json_name_custom" properties: singleNested: $ref: "#/definitions/ABitOfEverythingNested" nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" externalDocs: description: "Find out more about ABitOfEverything" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: int64_value: 12 double_value: 12.3 x-a-bit-of-everything-foo: "bar" A bit of everything_1: type: "object" required: - "doubleValue" - "floatValue" - "int64Value" - "requiredStringField1" - "requiredStringField2" - "requiredStringViaFieldBehaviorAnnotation" - "required_field_behavior_json_name_custom" - "required_field_schema_json_name_custom" properties: singleNested: $ref: "#/definitions/ABitOfEverythingNested" nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" externalDocs: description: "Find out more about ABitOfEverything" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: int64_value: 12 double_value: 12.3 x-a-bit-of-everything-foo: "bar" ABitOfEverythingServiceDeepPathEchoBody_singleNested: properties: amount: type: "integer" format: "int64" ok: description: "DeepEnum description." $ref: "#/definitions/NestedDeepEnum" description: "Nested is nested type." example: "{\"ok\":\"TRUE\"}" A bit of everything_2: properties: singleNested: $ref: "#/definitions/ABitOfEverythingNested" nested: type: "array" items: $ref: "#/definitions/ABitOfEverythingNested" floatValue: type: "number" format: "float" description: "Float value field" default: 0.2 doubleValue: type: "number" format: "double" int64Value: type: "string" format: "int64" uint64Value: type: "string" format: "uint64" int32Value: type: "integer" format: "int32" fixed64Value: type: "string" format: "uint64" fixed32Value: type: "integer" format: "int64" boolValue: type: "boolean" stringValue: type: "string" bytesValue: type: "string" format: "byte" pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" uint32Value: type: "integer" format: "int64" enumValue: $ref: "#/definitions/examplepbNumericEnum" pathEnumValue: $ref: "#/definitions/pathenumPathEnum" nestedPathEnumValue: $ref: "#/definitions/MessagePathEnumNestedPathEnum" sfixed32Value: type: "integer" format: "int32" sfixed64Value: type: "string" format: "int64" sint32Value: type: "integer" format: "int32" sint64Value: type: "string" format: "int64" repeatedStringValue: type: "array" items: type: "string" oneofEmpty: type: "object" properties: {} oneofString: type: "string" mapValue: type: "object" additionalProperties: $ref: "#/definitions/examplepbNumericEnum" mappedStringValue: type: "object" additionalProperties: type: "string" mappedNestedValue: type: "object" additionalProperties: $ref: "#/definitions/ABitOfEverythingNested" nonConventionalNameValue: type: "string" timestampValue: type: "string" format: "date-time" repeatedEnumValue: type: "array" title: "repeated enum value. it is comma-separated in query" items: $ref: "#/definitions/examplepbNumericEnum" repeatedEnumAnnotation: type: "array" description: "Repeated numeric enum description." title: "Repeated numeric enum title" items: $ref: "#/definitions/examplepbNumericEnum" enumValueAnnotation: description: "Numeric enum description." title: "Numeric enum title" $ref: "#/definitions/examplepbNumericEnum" repeatedStringAnnotation: type: "array" description: "Repeated string description." title: "Repeated string title" items: type: "string" repeatedNestedAnnotation: type: "array" description: "Repeated nested object description." title: "Repeated nested object title" items: $ref: "#/definitions/ABitOfEverythingNested" nestedAnnotation: description: "Nested object description." title: "Nested object title" $ref: "#/definitions/ABitOfEverythingNested" int64OverrideType: type: "integer" format: "int64" requiredStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as required in Open API definition" outputOnlyStringViaFieldBehaviorAnnotation: type: "string" title: "mark a field as readonly in Open API definition" readOnly: true optionalStringValue: type: "string" productId: type: "array" description: "Only digits are allowed." title: "Test openapiv2 generation of repeated fields" items: type: "string" minLength: 1 maxLength: 19 pattern: "^[0-9]+$" optionalStringField: type: "string" title: "Test openapiv2 generation of required fields with annotation and jsonschema\ \ to reproduce" requiredStringField1: type: "string" requiredStringField2: type: "string" required_field_behavior_json_name_custom: type: "string" title: "Test openapiv2 handling of required json_name fields" required_field_schema_json_name_custom: type: "string" trailingOnly: type: "string" title: "Trailing only" trailingOnlyDot: type: "string" description: "Trailing only dot." trailingBoth: type: "string" description: "Trailing both." title: "Leading both" trailingMultiline: type: "string" description: "This is an example of a multi-line comment.\n\nTrailing multiline." title: "Leading multiline" uuids: type: "array" title: "Specify a custom format of repeated field items" items: type: "string" format: "uuid" description: "Intentionally complicated message type to cover many features of\ \ Protobuf." example: "{\"int64_value\":12,\"double_value\":12.3}" externalDocs: description: "More about gRPC-Gateway" url: "https://github.com/grpc-ecosystem/grpc-gateway" x-grpc-gateway-baz-list: - "one" - true x-grpc-gateway-foo: "bar" api_a_bit_of_everything.go000066400000000000000000001066771465037340600346360ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" "github.com/antihax/optional" ) // Linger please var ( _ context.Context ) type ABitOfEverythingApiService service /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuid @return interface{} */ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return interface{} */ type ABitOfEverythingServiceGetQueryOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body @return interface{} */ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/x-bar-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return string */ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue string ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/text"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } api_a_bit_of_everything_service.go000066400000000000000000010134611465037340600363430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" "github.com/antihax/optional" ) // Linger please var ( _ context.Context ) type ABitOfEverythingServiceApiService service /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param value @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalNestedPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v3/{value}:check" localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param value @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/{value}:check" localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param singleNestedName name is nested field. * @param uuid * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{singleNested.name}" localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("uuid", parameterToString(uuid, "")) localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param singleNestedOk DeepEnum description. * @param uuid * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}" localVarPath = strings.Replace(localVarPath, "{"+"singleNested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } localVarQueryParams.Add("uuid", parameterToString(uuid, "")) localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param stringValue * @param singleNested * @param uuid * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCheckPostQueryParamsOpts - Optional Parameters: * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceCheckPostQueryParamsOpts struct { Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, singleNested ABitOfEverythingNested, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckPostQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{stringValue}" localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} localVarQueryParams.Add("uuid", parameterToString(uuid, "")) localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &singleNested if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ExamplepbCheckStatusResponse */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckStatus(ctx context.Context) (ExamplepbCheckStatusResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbCheckStatusResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/checkStatus" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbCheckStatusResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService Create a new ABitOfEverything This API creates a new ABitOfEverything * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param floatValue Float value field * @param doubleValue * @param int64Value * @param uint64Value * @param int32Value * @param fixed64Value * @param fixed32Value * @param boolValue * @param stringValue * @param uint32Value * @param sfixed32Value * @param sfixed64Value * @param sint32Value * @param sint64Value * @param nonConventionalNameValue * @param enumValue * @param pathEnumValue * @param nestedPathEnumValue * @param enumValueAnnotation Numeric enum description. * @param uuid * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCreateOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "BytesValue" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceCreateOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String BytesValue optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string, uuid string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCreateOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}" localVarPath = strings.Replace(localVarPath, "{"+"floatValue"+"}", fmt.Sprintf("%v", floatValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"doubleValue"+"}", fmt.Sprintf("%v", doubleValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"int64Value"+"}", fmt.Sprintf("%v", int64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"uint64Value"+"}", fmt.Sprintf("%v", uint64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"int32Value"+"}", fmt.Sprintf("%v", int32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"fixed64Value"+"}", fmt.Sprintf("%v", fixed64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"fixed32Value"+"}", fmt.Sprintf("%v", fixed32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"boolValue"+"}", fmt.Sprintf("%v", boolValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"uint32Value"+"}", fmt.Sprintf("%v", uint32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"sfixed32Value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"sfixed64Value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"sint32Value"+"}", fmt.Sprintf("%v", sint32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"sint64Value"+"}", fmt.Sprintf("%v", sint64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"enumValue"+"}", fmt.Sprintf("%v", enumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathEnumValue"+"}", fmt.Sprintf("%v", pathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"nestedPathEnumValue"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"enumValueAnnotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("uuid", parameterToString(uuid, "")) if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body Intentionally complicated message type to cover many features of Protobuf. @return ExamplepbABitOfEverything */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService Create a book. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param parent The publisher in which to create the book. Format: `publishers/{publisher}` Example: `publishers/1257894000000000000` * @param book The book to create. * @param optional nil or *ABitOfEverythingServiceCreateBookOpts - Optional Parameters: * @param "BookId" (optional.String) - The ID to use for the book. This must start with an alphanumeric character. @return ExamplepbBook */ type ABitOfEverythingServiceCreateBookOpts struct { BookId optional.String } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBook(ctx context.Context, parent string, book ExamplepbBook, localVarOptionals *ABitOfEverythingServiceCreateBookOpts) (ExamplepbBook, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbBook ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/{parent}/books" localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.BookId.IsSet() { localVarQueryParams.Add("bookId", parameterToString(localVarOptionals.BookId.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &book if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbBook err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCustomOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceCustomOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustom(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceCustomOptionsRequestOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return interface{} */ type ABitOfEverythingServiceCustomOptionsRequestOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustomOptionsRequest(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOptionsRequestOpts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Options") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param singleNestedName name is nested field. * @param body @return ExamplepbABitOfEverything */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ABitOfEverythingServiceDeepPathEchoBody) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/deep_path/{singleNested.name}" localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceDoubleColonOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return ExamplepbABitOfEverything */ type ABitOfEverythingServiceDoubleColonOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDoubleColon(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceDoubleColonOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom:custom" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition * @param requiredStringField1 * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom * @param optional nil or *ABitOfEverythingServiceExistsOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - * @param "Int32Value" (optional.Int32) - * @param "Fixed64Value" (optional.String) - * @param "Fixed32Value" (optional.Int64) - * @param "BoolValue" (optional.Bool) - * @param "StringValue" (optional.String) - * @param "BytesValue" (optional.String) - * @param "Uint32Value" (optional.Int64) - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "PathEnumValue" (optional.String) - * @param "NestedPathEnumValue" (optional.String) - * @param "Sfixed32Value" (optional.Int32) - * @param "Sfixed64Value" (optional.String) - * @param "Sint32Value" (optional.Int32) - * @param "Sint64Value" (optional.String) - * @param "RepeatedStringValue" (optional.Interface of []string) - * @param "OneofEmpty" (optional.Interface of map[string]string) - * @param "OneofString" (optional.String) - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 * @param "NonConventionalNameValue" (optional.String) - * @param "TimestampValue" (optional.Time) - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition * @param "OptionalStringValue" (optional.String) - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce * @param "TrailingOnly" (optional.String) - Trailing only * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. * @param "TrailingBoth" (optional.String) - Leading both Trailing both. * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items @return interface{} */ type ABitOfEverythingServiceExistsOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String Int32Value optional.Int32 Fixed64Value optional.String Fixed32Value optional.Int64 BoolValue optional.Bool StringValue optional.String BytesValue optional.String Uint32Value optional.Int64 EnumValue optional.String PathEnumValue optional.String NestedPathEnumValue optional.String Sfixed32Value optional.Int32 Sfixed64Value optional.String Sint32Value optional.Int32 Sint64Value optional.String RepeatedStringValue optional.Interface OneofEmpty optional.Interface OneofString optional.String MapValue optional.Interface MappedStringValue optional.String MappedNestedValue optional.Interface NonConventionalNameValue optional.String TimestampValue optional.Time RepeatedEnumValue optional.Interface RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 OutputOnlyStringViaFieldBehaviorAnnotation optional.String OptionalStringValue optional.String ProductId optional.Interface OptionalStringField optional.String TrailingOnly optional.String TrailingOnlyDot optional.String TrailingBoth optional.String TrailingMultiline optional.String Uuids optional.Interface } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceExists(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceExistsOpts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Head") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) } localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) } if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) } if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) } localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) } if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id * @param data @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, data ExamplepbBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &data if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pathRepeatedFloatValue repeated values. they are comma-separated in path * @param pathRepeatedDoubleValue * @param pathRepeatedInt64Value * @param pathRepeatedUint64Value * @param pathRepeatedInt32Value * @param pathRepeatedFixed64Value * @param pathRepeatedFixed32Value * @param pathRepeatedBoolValue * @param pathRepeatedStringValue * @param pathRepeatedBytesValue * @param pathRepeatedUint32Value * @param pathRepeatedEnumValue * @param pathRepeatedSfixed32Value * @param pathRepeatedSfixed64Value * @param pathRepeatedSint32Value * @param pathRepeatedSint64Value @return ExamplepbABitOfEverythingRepeated */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverythingRepeated ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if len(pathRepeatedFloatValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") } if len(pathRepeatedDoubleValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") } if len(pathRepeatedInt64Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") } if len(pathRepeatedUint64Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") } if len(pathRepeatedInt32Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") } if len(pathRepeatedFixed64Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") } if len(pathRepeatedFixed32Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") } if len(pathRepeatedBoolValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") } if len(pathRepeatedStringValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") } if len(pathRepeatedBytesValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") } if len(pathRepeatedUint32Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") } if len(pathRepeatedEnumValue) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") } if len(pathRepeatedSfixed32Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") } if len(pathRepeatedSfixed64Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") } if len(pathRepeatedSint32Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") } if len(pathRepeatedSint64Value) < 1 { return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverythingRepeated err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuid @return ExamplepbABitOfEverything */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param exampleEnum @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostOneofEnum(ctx context.Context, exampleEnum OneofenumExampleEnum) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/oneofenum" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &exampleEnum if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostRequiredMessageType(ctx context.Context, body ExamplepbRequiredMessageTypeRequest) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/requiredmessagetype" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param name * @param body @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body ABitOfEverythingServicePostWithEmptyBodyBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param body @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuidName string, body ExamplepbABitOfEverythingServiceUpdateBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param bookName The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` * @param book The book to update. The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} * @param optional nil or *ABitOfEverythingServiceUpdateBookOpts - Optional Parameters: * @param "AllowMissing" (optional.Bool) - If set to true, and the book is not found, a new book will be created. In this situation, `update_mask` is ignored. @return ExamplepbBook */ type ABitOfEverythingServiceUpdateBookOpts struct { AllowMissing optional.Bool } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateBook(ctx context.Context, bookName string, book TheBookToUpdate_, localVarOptionals *ABitOfEverythingServiceUpdateBookOpts) (ExamplepbBook, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbBook ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/{book.name}" localVarPath = strings.Replace(localVarPath, "{"+"book.name"+"}", fmt.Sprintf("%v", bookName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.AllowMissing.IsSet() { localVarQueryParams.Add("allowMissing", parameterToString(localVarOptionals.AllowMissing.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &book if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbBook err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. * @param optional nil or *ABitOfEverythingServiceUpdateV2Opts - Optional Parameters: * @param "UpdateMask" (optional.String) - The paths to update. @return interface{} */ type ABitOfEverythingServiceUpdateV2Opts struct { UpdateMask optional.String } func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, uuidName string, abe ABitOfEverything, localVarOptionals *ABitOfEverythingServiceUpdateV2Opts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.UpdateMask.IsSet() { localVarQueryParams.Add("updateMask", parameterToString(localVarOptionals.UpdateMask.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &abe if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, uuidName string, abe ABitOfEverything1) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &abe if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuidName * @param body @return interface{} */ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, uuidName string, body ABitOfEverythingServiceUpdateV2Body) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{uuidName}" localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } api_camel_case_service_name.go000066400000000000000000000125771465037340600354170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" ) // Linger please var ( _ context.Context ) type CamelCaseServiceNameApiService service /* CamelCaseServiceNameApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return interface{} */ func (a *CamelCaseServiceNameApiService) CamelCaseServiceNameEmpty(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/empty" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/api_echo_rpc.go000066400000000000000000000420771465037340600324620ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" "github.com/antihax/optional" ) // Linger please var ( _ context.Context ) type EchoRpcApiService service /* EchoRpcApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param value @return SubStringMessage */ func (a *EchoRpcApiService) ABitOfEverythingServiceEcho(ctx context.Context, value string) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue SubStringMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v SubStringMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v int32 err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 503 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoRpcApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param value @return SubStringMessage */ func (a *EchoRpcApiService) ABitOfEverythingServiceEcho2(ctx context.Context, value string) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue SubStringMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/echo" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &value if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v SubStringMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v int32 err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 503 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoRpcApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *ABitOfEverythingServiceEcho3Opts - Optional Parameters: * @param "Value" (optional.String) - @return SubStringMessage */ type ABitOfEverythingServiceEcho3Opts struct { Value optional.String } func (a *EchoRpcApiService) ABitOfEverythingServiceEcho3(ctx context.Context, localVarOptionals *ABitOfEverythingServiceEcho3Opts) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue SubStringMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/echo" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Value.IsSet() { localVarQueryParams.Add("value", parameterToString(localVarOptionals.Value.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v SubStringMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v int32 err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 503 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } api_snake_enum_service.go000066400000000000000000000134601465037340600344600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" ) // Linger please var ( _ context.Context ) type SnakeEnumServiceApiService service /* SnakeEnumServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param who * @param what * @param where @return ExamplepbSnakeEnumResponse */ func (a *SnakeEnumServiceApiService) SnakeEnumServiceSnakeEnum(ctx context.Context, who string, what string, where string) (ExamplepbSnakeEnumResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSnakeEnumResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/snake/{who}/{what}/{where}" localVarPath = strings.Replace(localVarPath, "{"+"who"+"}", fmt.Sprintf("%v", who), -1) localVarPath = strings.Replace(localVarPath, "{"+"what"+"}", fmt.Sprintf("%v", what), -1) localVarPath = strings.Replace(localVarPath, "{"+"where"+"}", fmt.Sprintf("%v", where), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSnakeEnumResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 500 { var v ExamplepbErrorResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/client.go000066400000000000000000000270521465037340600313210ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" "fmt" "io" "mime/multipart" "net/http" "net/url" "os" "path/filepath" "reflect" "regexp" "strconv" "strings" "time" "unicode/utf8" "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) // APIClient manages communication with the A Bit of Everything API v1.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services ABitOfEverythingApi *ABitOfEverythingApiService ABitOfEverythingServiceApi *ABitOfEverythingServiceApiService CamelCaseServiceNameApi *CamelCaseServiceNameApiService EchoRpcApi *EchoRpcApiService SnakeEnumServiceApi *SnakeEnumServiceApiService } type service struct { client *APIClient } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.ABitOfEverythingApi = (*ABitOfEverythingApiService)(&c.common) c.ABitOfEverythingServiceApi = (*ABitOfEverythingServiceApiService)(&c.common) c.CamelCaseServiceNameApi = (*CamelCaseServiceNameApiService)(&c.common) c.EchoRpcApi = (*EchoRpcApiService)(&c.common) c.SnakeEnumServiceApi = (*SnakeEnumServiceApiService)(&c.common) return c } func atoi(in string) (int, error) { return strconv.Atoi(in) } // selectHeaderContentType select a content type from the available list. func selectHeaderContentType(contentTypes []string) string { if len(contentTypes) == 0 { return "" } if contains(contentTypes, "application/json") { return "application/json" } return contentTypes[0] // use the first content type specified in 'consumes' } // selectHeaderAccept join all accept types and return func selectHeaderAccept(accepts []string) string { if len(accepts) == 0 { return "" } if contains(accepts, "application/json") { return "application/json" } return strings.Join(accepts, ",") } // contains is a case insenstive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { if strings.ToLower(a) == strings.ToLower(needle) { return true } } return false } // Verify optional parameters are of the correct type. func typeCheckParameter(obj interface{}, expected string, name string) error { // Make sure there is an object. if obj == nil { return nil } // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) } return nil } // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { var delimiter string switch collectionFormat { case "pipes": delimiter = "|" case "ssv": delimiter = " " case "tsv": delimiter = "\t" case "csv": delimiter = "," } if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") } return fmt.Sprintf("%v", obj) } // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { return c.cfg.HTTPClient.Do(request) } // Change base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { var body *bytes.Buffer // Detect postBody type and post. if postBody != nil { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) headerParams["Content-Type"] = contentType } body, err = setBody(postBody, contentType) if err != nil { return nil, err } } // add form parameters and file if available. if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } body = &bytes.Buffer{} w := multipart.NewWriter(body) for k, v := range formParams { for _, iv := range v { if strings.HasPrefix(k, "@") { // file err = addFile(w, k[1:], iv) if err != nil { return nil, err } } else { // form value w.WriteField(k, iv) } } } if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) part, err := w.CreateFormFile("file", filepath.Base(fileName)) if err != nil { return nil, err } _, err = part.Write(fileBytes) if err != nil { return nil, err } // Set the Boundary in the Content-Type headerParams["Content-Type"] = w.FormDataContentType() } // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() } // Setup path and query parameters url, err := url.Parse(path) if err != nil { return nil, err } // Adding Query Param query := url.Query() for k, v := range queryParams { for _, iv := range v { query.Add(k, iv) } } // Encode the parameters. url.RawQuery = query.Encode() // Generate a new request if body != nil { localVarRequest, err = http.NewRequest(method, url.String(), body) } else { localVarRequest, err = http.NewRequest(method, url.String(), nil) } if err != nil { return nil, err } // add header parameters, if any if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { headers.Set(h, v) } localVarRequest.Header = headers } // Override request host, if applicable if c.cfg.Host != "" { localVarRequest.Host = c.cfg.Host } // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) if ctx != nil { // add context to the request localVarRequest = localVarRequest.WithContext(ctx) // Walk through any authentication. // OAuth2 authentication if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { return nil, err } latestToken.SetAuthHeader(localVarRequest) } // Basic HTTP Authentication if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { return err } _, err = io.Copy(part, file) return err } // Prevent trying to import "fmt" func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } // Set request body from an interface{} func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { if bodyBuf == nil { bodyBuf = &bytes.Buffer{} } if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { return nil, err } if bodyBuf.Len() == 0 { err = fmt.Errorf("Invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil } // detectContentType method is used to figure out `Request.Body` content type for request header func detectContentType(body interface{}) string { contentType := "text/plain; charset=utf-8" kind := reflect.TypeOf(body).Kind() switch kind { case reflect.Struct, reflect.Map, reflect.Ptr: contentType = "application/json; charset=utf-8" case reflect.String: contentType = "text/plain; charset=utf-8" default: if b, ok := body.([]byte); ok { contentType = http.DetectContentType(b) } else if kind == reflect.Slice { contentType = "application/json; charset=utf-8" } } return contentType } // Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go type cacheControl map[string]string func parseCacheControl(headers http.Header) cacheControl { cc := cacheControl{} ccHeader := headers.Get("Cache-Control") for _, part := range strings.Split(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue } if strings.ContainsRune(part, '=') { keyval := strings.Split(part, "=") cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") } else { cc[part] = "" } } return cc } // CacheExpires helper function to determine remaining time before repeating a request. func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time now, err := time.Parse(time.RFC1123, r.Header.Get("date")) if err != nil { return time.Now() } respCacheControl := parseCacheControl(r.Header) if maxAge, ok := respCacheControl["max-age"]; ok { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now } expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { expires, err = time.Parse(time.RFC1123, expiresHeader) if err != nil { expires = now } } } return expires } func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/configuration.go000066400000000000000000000041451465037340600327100ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "net/http" ) // contextKeys are used to identify the type of value in the context. // Since these are string, it is possible to get a short description of the // context key for logging and debugging using key.String(). type contextKey string func (c contextKey) String() string { return "auth " + string(c) } var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` } // APIKey provides API key based authentication to a request passed via context using ContextAPIKey type APIKey struct { Key string Prefix string } type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } return cfg } func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/enum_helper.go000066400000000000000000000031161465037340600323410ustar00rootroot00000000000000package abe import ( pbexamplepb "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" pbpathenum "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" ) // String returns a string representation of "NumericEnum" func (e ExamplepbNumericEnum) String() string { return pbexamplepb.NumericEnum_ONE.String() } // UnmarshalJSON does a no-op unmarshal to ExamplepbNumericEnum. // It just validates that the input is sane. func (e ExamplepbNumericEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbexamplepb.NumericEnum_value) } // String returns a string representation of "MessagePathEnum" func (e MessagePathEnumNestedPathEnum) String() string { return pbpathenum.MessagePathEnum_JKL.String() } // UnmarshalJSON does a no-op unmarshal to MessagePathEnumNestedPathEnum. // It just validates that the input is sane. func (e MessagePathEnumNestedPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.MessagePathEnum_NestedPathEnum_value) } // String returns a string representation of "PathEnum" func (e PathenumPathEnum) String() string { return pbpathenum.PathEnum_DEF.String() } // UnmarshalJSON does a no-op unmarshal to PathenumPathEnum. // It just validates that the input is sane. func (e PathenumPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.PathEnum_value) } func unmarshalJSONEnum(b []byte, enumValMap map[string]int32) error { val := string(b[1 : len(b)-1]) _, err := runtime.Enum(val, enumValMap) return err } model_a_bit_of_everything.go000066400000000000000000000075061465037340600351540ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_1.go000066400000000000000000000075071465037340600353750ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything1 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_2.go000066400000000000000000000076271465037340600354010ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything2 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue,omitempty"` DoubleValue float64 `json:"doubleValue,omitempty"` Int64Value string `json:"int64Value,omitempty"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation,omitempty"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1,omitempty"` RequiredStringField2 string `json:"requiredStringField2,omitempty"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom,omitempty"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom,omitempty"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_3.go000066400000000000000000000075071465037340600353770ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything3 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_4.go000066400000000000000000000076271465037340600354030ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything4 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue,omitempty"` DoubleValue float64 `json:"doubleValue,omitempty"` Int64Value string `json:"int64Value,omitempty"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation,omitempty"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1,omitempty"` RequiredStringField2 string `json:"requiredStringField2,omitempty"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom,omitempty"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom,omitempty"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_5.go000066400000000000000000000057151465037340600354000ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything5 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` } model_a_bit_of_everything_6.go000066400000000000000000000057151465037340600354010ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything6 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` } model_a_bit_of_everything_7.go000066400000000000000000000057151465037340600354020ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything7 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` } model_a_bit_of_everything_8.go000066400000000000000000000057151465037340600354030ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything8 struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` } model_a_bit_of_everything_nested.go000066400000000000000000000010161465037340600365040ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // Nested is nested type. type ABitOfEverythingNested struct { // name is nested field. Name string `json:"name,omitempty"` Amount int64 `json:"amount,omitempty"` // DeepEnum description. Ok *NestedDeepEnum `json:"ok,omitempty"` } model_a_bit_of_everything_service_deep_path_echo_body.go000066400000000000000000000076251465037340600427220ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverythingServiceDeepPathEchoBody struct { SingleNested *ABitOfEverythingServiceDeepPathEchoBodySingleNested `json:"singleNested,omitempty"` Uuid string `json:"uuid"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_service_deep_path_echo_body_single_nested.go000066400000000000000000000007541465037340600456210ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // Nested is nested type. type ABitOfEverythingServiceDeepPathEchoBodySingleNested struct { Amount int64 `json:"amount,omitempty"` // DeepEnum description. Ok *NestedDeepEnum `json:"ok,omitempty"` } model_a_bit_of_everything_service_post_with_empty_body_body.go000066400000000000000000000005371465037340600442410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ABitOfEverythingServicePostWithEmptyBodyBody struct { } model_a_bit_of_everything_service_update_body.go000066400000000000000000000075271465037340600412560ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverythingServiceUpdateBody struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_a_bit_of_everything_service_update_v2_body.go000066400000000000000000000007171465037340600416570ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ABitOfEverythingServiceUpdateV2Body struct { Abe *ABitOfEverything2 `json:"abe,omitempty"` // The paths to update. UpdateMask string `json:"updateMask,omitempty"` } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/model_book.go000066400000000000000000000011741465037340600321520ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // An example resource type from AIP-123 used to test the behavior described in the CreateBookRequest message. See: https://google.aip.dev/123 type Book struct { // Output only. The book's ID. Id string `json:"id,omitempty"` // Output only. Creation time of the book. CreateTime time.Time `json:"createTime,omitempty"` } model_examplepb_a_bit_of_everything.go000066400000000000000000000075521465037340600372120ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ExamplepbABitOfEverything struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Uuid string `json:"uuid"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_examplepb_a_bit_of_everything_repeated.go000066400000000000000000000030511465037340600410510ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbABitOfEverythingRepeated struct { PathRepeatedFloatValue []float32 `json:"pathRepeatedFloatValue,omitempty"` PathRepeatedDoubleValue []float64 `json:"pathRepeatedDoubleValue,omitempty"` PathRepeatedInt64Value []string `json:"pathRepeatedInt64Value,omitempty"` PathRepeatedUint64Value []string `json:"pathRepeatedUint64Value,omitempty"` PathRepeatedInt32Value []int32 `json:"pathRepeatedInt32Value,omitempty"` PathRepeatedFixed64Value []string `json:"pathRepeatedFixed64Value,omitempty"` PathRepeatedFixed32Value []int64 `json:"pathRepeatedFixed32Value,omitempty"` PathRepeatedBoolValue []bool `json:"pathRepeatedBoolValue,omitempty"` PathRepeatedStringValue []string `json:"pathRepeatedStringValue,omitempty"` PathRepeatedBytesValue []string `json:"pathRepeatedBytesValue,omitempty"` PathRepeatedUint32Value []int64 `json:"pathRepeatedUint32Value,omitempty"` PathRepeatedEnumValue []ExamplepbNumericEnum `json:"pathRepeatedEnumValue,omitempty"` PathRepeatedSfixed32Value []int32 `json:"pathRepeatedSfixed32Value,omitempty"` PathRepeatedSfixed64Value []string `json:"pathRepeatedSfixed64Value,omitempty"` PathRepeatedSint32Value []int32 `json:"pathRepeatedSint32Value,omitempty"` PathRepeatedSint64Value []string `json:"pathRepeatedSint64Value,omitempty"` } model_examplepb_a_bit_of_everything_service_update_body.go000066400000000000000000000075401465037340600433060ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // Intentionally complicated message type to cover many features of Protobuf. type ExamplepbABitOfEverythingServiceUpdateBody struct { SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` // Float value field FloatValue float32 `json:"floatValue"` DoubleValue float64 `json:"doubleValue"` Int64Value string `json:"int64Value"` Uint64Value string `json:"uint64Value,omitempty"` Int32Value int32 `json:"int32Value,omitempty"` Fixed64Value string `json:"fixed64Value,omitempty"` Fixed32Value int64 `json:"fixed32Value,omitempty"` BoolValue bool `json:"boolValue,omitempty"` StringValue string `json:"stringValue,omitempty"` BytesValue string `json:"bytesValue,omitempty"` Uint32Value int64 `json:"uint32Value,omitempty"` EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"` PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"` NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"` Sfixed32Value int32 `json:"sfixed32Value,omitempty"` Sfixed64Value string `json:"sfixed64Value,omitempty"` Sint32Value int32 `json:"sint32Value,omitempty"` Sint64Value string `json:"sint64Value,omitempty"` RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` OneofEmpty *interface{} `json:"oneofEmpty,omitempty"` OneofString string `json:"oneofString,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestampValue,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"` // Numeric enum description. EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"` // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"` // Nested object description. NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"` Int64OverrideType int64 `json:"int64OverrideType,omitempty"` RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"` OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"` OptionalStringValue string `json:"optionalStringValue,omitempty"` // Only digits are allowed. ProductId []string `json:"productId,omitempty"` OptionalStringField string `json:"optionalStringField,omitempty"` RequiredStringField1 string `json:"requiredStringField1"` RequiredStringField2 string `json:"requiredStringField2"` RequiredFieldBehaviorJsonNameCustom string `json:"required_field_behavior_json_name_custom"` RequiredFieldSchemaJsonNameCustom string `json:"required_field_schema_json_name_custom"` TrailingOnly string `json:"trailingOnly,omitempty"` // Trailing only dot. TrailingOnlyDot string `json:"trailingOnlyDot,omitempty"` // Trailing both. TrailingBoth string `json:"trailingBoth,omitempty"` // This is an example of a multi-line comment. Trailing multiline. TrailingMultiline string `json:"trailingMultiline,omitempty"` Uuids []string `json:"uuids,omitempty"` } model_examplepb_bar.go000066400000000000000000000005261465037340600337420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbBar struct { Id string `json:"id"` } model_examplepb_body.go000066400000000000000000000005451465037340600341340ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbBody struct { Name string `json:"name,omitempty"` } model_examplepb_book.go000066400000000000000000000014651465037340600341330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // An example resource type from AIP-123 used to test the behavior described in the CreateBookRequest message. See: https://google.aip.dev/123 type ExamplepbBook struct { // The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` Name string `json:"name,omitempty"` // Output only. The book's ID. Id string `json:"id,omitempty"` // Output only. Creation time of the book. CreateTime time.Time `json:"createTime,omitempty"` } model_examplepb_check_status_response.go000066400000000000000000000005741465037340600375770ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbCheckStatusResponse struct { Status *RpcStatus `json:"status,omitempty"` } model_examplepb_error_object.go000066400000000000000000000006751465037340600356620ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbErrorObject struct { // Response code Code int32 `json:"code,omitempty"` // Response message Message string `json:"message,omitempty"` } model_examplepb_error_response.go000066400000000000000000000007471465037340600362520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbErrorResponse struct { // Unique event identifier for server requests CorrelationId string `json:"correlationId,omitempty"` Error_ *ExamplepbErrorObject `json:"error,omitempty"` } model_examplepb_foo.go000066400000000000000000000005371465037340600337630ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbFoo struct { Bar *ExamplepbBar `json:"bar"` } model_examplepb_numeric_enum.go000066400000000000000000000010761465037340600356650ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // ExamplepbNumericEnum : NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1 type ExamplepbNumericEnum string // List of examplepbNumericEnum const ( ZERO_ExamplepbNumericEnum ExamplepbNumericEnum = "ZERO" ONE_ExamplepbNumericEnum ExamplepbNumericEnum = "ONE" ) model_examplepb_required_message_type_request.go000066400000000000000000000006221465037340600413300ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbRequiredMessageTypeRequest struct { Id string `json:"id"` Foo *ProtoexamplepbFoo `json:"foo"` } model_examplepb_snake_enum_response.go000066400000000000000000000005151465037340600372370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbSnakeEnumResponse struct { } model_examplepbsnake_case_0_enum.go000066400000000000000000000012001465037340600363640ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // ExamplepbsnakeCase0Enum : - value_e: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - value_f: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE type ExamplepbsnakeCase0Enum string // List of examplepbsnake_case_0_enum const ( E_ExamplepbsnakeCase0Enum ExamplepbsnakeCase0Enum = "value_e" F_ExamplepbsnakeCase0Enum ExamplepbsnakeCase0Enum = "value_f" ) model_examplepbsnake_case_enum.go000066400000000000000000000011701465037340600361530ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // ExamplepbsnakeCaseEnum : - value_c: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - value_d: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE type ExamplepbsnakeCaseEnum string // List of examplepbsnake_case_enum const ( C_ExamplepbsnakeCaseEnum ExamplepbsnakeCaseEnum = "value_c" D_ExamplepbsnakeCaseEnum ExamplepbsnakeCaseEnum = "value_d" ) model_message_path_enum_nested_path_enum.go000066400000000000000000000010221465037340600402170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type MessagePathEnumNestedPathEnum string // List of MessagePathEnumNestedPathEnum const ( GHI_MessagePathEnumNestedPathEnum MessagePathEnumNestedPathEnum = "GHI" JKL_MessagePathEnumNestedPathEnum MessagePathEnumNestedPathEnum = "JKL" ) model_nested_deep_enum.go000066400000000000000000000010341465037340600344370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // NestedDeepEnum : DeepEnum is one or zero. - FALSE: FALSE is false. - TRUE: TRUE is true. type NestedDeepEnum string // List of NestedDeepEnum const ( FALSE_NestedDeepEnum NestedDeepEnum = "FALSE" TRUE_NestedDeepEnum NestedDeepEnum = "TRUE" ) model_oneofenum_example_enum.go000066400000000000000000000010121465037340600356620ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type OneofenumExampleEnum string // List of oneofenumExampleEnum const ( UNSPECIFIED_OneofenumExampleEnum OneofenumExampleEnum = "EXAMPLE_ENUM_UNSPECIFIED" FIRST_OneofenumExampleEnum OneofenumExampleEnum = "EXAMPLE_ENUM_FIRST" ) model_pathenum_path_enum.go000066400000000000000000000007041465037340600350200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type PathenumPathEnum string // List of pathenumPathEnum const ( ABC_PathenumPathEnum PathenumPathEnum = "ABC" DEF_PathenumPathEnum PathenumPathEnum = "DEF" ) model_pathenumsnake_case_for_import.go000066400000000000000000000012251465037340600372340ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // PathenumsnakeCaseForImport : - value_x: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - value_y: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE type PathenumsnakeCaseForImport string // List of pathenumsnake_case_for_import const ( X_PathenumsnakeCaseForImport PathenumsnakeCaseForImport = "value_x" Y_PathenumsnakeCaseForImport PathenumsnakeCaseForImport = "value_y" ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/model_protobuf_any.go000066400000000000000000000073321465037340600337310ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } type ProtobufAny struct { // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. Type_ string `json:"@type,omitempty"` } model_protoexamplepb_foo.go000066400000000000000000000005441465037340600350450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ProtoexamplepbFoo struct { Bar *ExamplepbBar `json:"bar"` } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/model_rpc_status.go000066400000000000000000000024211465037340600334030ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). type RpcStatus struct { // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. Code int32 `json:"code,omitempty"` // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. Message string `json:"message,omitempty"` // A list of messages that carry the error details. There is a common set of message types for APIs to use. Details []ProtobufAny `json:"details,omitempty"` } model_sub_string_message.go000066400000000000000000000005521465037340600350230ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type SubStringMessage struct { Value string `json:"value,omitempty"` } model_the_book_to_update_.go000066400000000000000000000011531465037340600351330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} type TheBookToUpdate_ struct { // Output only. The book's ID. Id string `json:"id,omitempty"` // Output only. Creation time of the book. CreateTime time.Time `json:"createTime,omitempty"` } model_the_book_to_update__1.go000066400000000000000000000011511465037340600353510ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) // The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} type TheBookToUpdate1 struct { // Output only. The book's ID. Id string `json:"id,omitempty"` // Output only. Creation time of the book. CreateTime time.Time `json:"createTime,omitempty"` } b928ebfe2f42c1695eb8f8833279a8df4106e0ba.paxheader00006660000000000000000000000330146503734060020616xustar00rootroot00000000000000216 path=golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/model_the_book_to_update_the_books_name_field_is_used_to_identify_the_book_to_be_updated_format_publisherspublisherbooksbook.go b928ebfe2f42c1695eb8f8833279a8df4106e0ba.data000066400000000000000000000011141465037340600174550ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "time" ) type TheBookToUpdateTheBooksNameFieldIsUsedToIdentifyTheBookToBeUpdatedFormatPublisherspublisherbooksbook struct { // Output only. The book's ID. Id string `json:"id,omitempty"` // Output only. Creation time of the book. CreateTime time.Time `json:"createTime,omitempty"` } model_update_v2_request_request_for_update_includes_the_message_and_the_update_mask.go000066400000000000000000000007551465037340600510570ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask struct { Abe *ABitOfEverything4 `json:"abe,omitempty"` // The paths to update. UpdateMask string `json:"updateMask,omitempty"` } model_update_v2_request_request_for_update_includes_the_message_and_the_update_mask_1.go000066400000000000000000000007551465037340600512770ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask1 struct { Abe *ABitOfEverything8 `json:"abe,omitempty"` // The paths to update. UpdateMask string `json:"updateMask,omitempty"` } model_v1exampledeep_pathsingle_nested_name_single_nested.go000066400000000000000000000007461465037340600433700ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // Nested is nested type. type V1exampledeepPathsingleNestedNameSingleNested struct { Amount int64 `json:"amount,omitempty"` // DeepEnum description. Ok *NestedDeepEnum `json:"ok,omitempty"` } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/abe/response.go000066400000000000000000000024251465037340600316760ustar00rootroot00000000000000/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "net/http" ) type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage} return response } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/000077500000000000000000000000001465037340600276755ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/.gitignore000066400000000000000000000000061465037340600316610ustar00rootroot00000000000000/docs .swagger-codegen-ignore000066400000000000000000000000131465037340600341330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo.gitignore golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/.swagger-codegen/000077500000000000000000000000001465037340600330145ustar00rootroot00000000000000VERSION000066400000000000000000000000051465037340600340000ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/.swagger-codegen2.4.8golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/BUILD.bazel000066400000000000000000000016241465037340600315560ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") package(default_visibility = ["//visibility:public"]) go_library( name = "echo", srcs = [ "api_echo_service.go", "client.go", "configuration.go", "model_examplepb_dynamic_message.go", "model_examplepb_dynamic_message_update.go", "model_examplepb_embedded.go", "model_examplepb_nested_message.go", "model_examplepb_simple_message.go", "model_protobuf_any.go", "model_protobuf_null_value.go", "model_rpc_status.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/echo", deps = [ "@com_github_antihax_optional//:optional", "@org_golang_x_oauth2//:oauth2", ], ) alias( name = "go_default_library", actual = ":echo", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/api/000077500000000000000000000000001465037340600304465ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/api/swagger.yaml000066400000000000000000001053661465037340600330040ustar00rootroot00000000000000--- swagger: "2.0" info: description: "Echo Service API consists of a single service which returns\na message." version: "version not set" title: "Echo Service" tags: - name: "EchoService" consumes: - "application/json" produces: - "application/json" paths: /v1/example/echo/nested/{nId.nId}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo7" parameters: - name: "nId.nId" in: "path" required: true type: "string" x-exportParamName: "NIdNId" - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo/resource/{resourceId}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo6" parameters: - name: "resourceId" in: "path" required: true type: "string" x-exportParamName: "ResourceId" - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo/{id}: post: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo/{id}/{num}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo2" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "num" in: "path" required: true type: "string" format: "int64" x-exportParamName: "Num" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo/{id}/{num}/{lang}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo3" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "num" in: "path" required: true type: "string" format: "int64" x-exportParamName: "Num" - name: "lang" in: "path" required: true type: "string" x-exportParamName: "Lang" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo1/{id}/{lineNum}/{status.note}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo4" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "lineNum" in: "path" required: true type: "string" format: "int64" x-exportParamName: "LineNum" - name: "status.note" in: "path" required: true type: "string" x-exportParamName: "StatusNote" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo2/{no.note}: get: tags: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "EchoService_Echo5" parameters: - name: "no.note" in: "path" required: true type: "string" x-exportParamName: "NoNote" - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_body: post: tags: - "EchoService" summary: "EchoBody method receives a simple message and returns it." operationId: "EchoService_EchoBody" parameters: - in: "body" name: "body" description: "SimpleMessage represents a simple message sent to the Echo service." required: true schema: $ref: "#/definitions/examplepbSimpleMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_body/{id}: put: tags: - "EchoService" summary: "EchoBody method receives a simple message and returns it." operationId: "EchoService_EchoBody2" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - in: "body" name: "no" required: true schema: $ref: "#/definitions/examplepbEmbedded" x-exportParamName: "No" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_delete: delete: tags: - "EchoService" summary: "EchoDelete method receives a simple message and returns it." operationId: "EchoService_EchoDelete" parameters: - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_patch: patch: tags: - "EchoService" summary: "EchoPatch method receives a NonStandardUpdateRequest and returns it." operationId: "EchoService_EchoPatch" parameters: - in: "body" name: "body" required: true schema: $ref: "#/definitions/examplepbDynamicMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbDynamicMessageUpdate" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_unauthorized: get: tags: - "EchoService" summary: "EchoUnauthorized method receives a simple message and returns it.\ \ It must\nalways return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP\ \ Status code\nof 401." operationId: "EchoService_EchoUnauthorized" parameters: - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" required: false type: "string" format: "int64" x-exportParamName: "Num" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" definitions: examplepbDynamicMessage: type: "object" properties: structField: type: "object" properties: {} valueField: {} description: "DynamicMessage represents a message which can have its structure\n\ built dynamically using Struct and Values." example: structField: "{}" valueField: "" examplepbDynamicMessageUpdate: type: "object" properties: body: $ref: "#/definitions/examplepbDynamicMessage" updateMask: type: "string" example: body: structField: "{}" valueField: "" updateMask: "updateMask" examplepbEmbedded: type: "object" properties: progress: type: "string" format: "int64" note: type: "string" description: "Embedded represents a message embedded in SimpleMessage." example: note: "note" progress: "progress" examplepbNestedMessage: type: "object" properties: nId: type: "string" val: type: "string" example: val: "val" nId: "nId" examplepbSimpleMessage: type: "object" properties: id: type: "string" description: "Id represents the message identifier." num: type: "string" format: "int64" lineNum: type: "string" format: "int64" lang: type: "string" status: $ref: "#/definitions/examplepbEmbedded" en: type: "string" format: "int64" "no": $ref: "#/definitions/examplepbEmbedded" resourceId: type: "string" nId: $ref: "#/definitions/examplepbNestedMessage" description: "SimpleMessage represents a simple message sent to the Echo service." example: "no": note: "note" progress: "progress" resourceId: "resourceId" num: "num" nId: val: "val" nId: "nId" lineNum: "lineNum" en: "en" id: "id" lang: "lang" status: note: "note" progress: "progress" protobufAny: type: "object" properties: '@type': type: "string" description: "A URL/resource name that uniquely identifies the type of the\ \ serialized\nprotocol buffer message. This string must contain at least\n\ one \"/\" character. The last segment of the URL's path must represent\n\ the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ \nIn practice, teams usually precompile into the binary all types that they\n\ expect it to use in the context of Any. However, for URLs which use the\n\ scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ server that maps type URLs to message definitions as follows:\n\n* If no\ \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ \ an error.\n* Applications are allowed to cache lookup results based on\ \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ \ Therefore, binary compatibility needs to be preserved\n on changes to\ \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ \ this functionality is not currently available in the official\nprotobuf\ \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ \ with implementation specific semantics." description: "`Any` contains an arbitrary serialized protocol buffer message along\ \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ \ library provides support to pack/unpack Any values in the form\nof utility\ \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ \ }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ \ any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in\ \ Go\n\n foo := &pb.Foo{...}\n any, err := anypb.New(foo)\n if err\ \ != nil {\n ...\n }\n ...\n foo := &pb.Foo{}\n if err\ \ := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods\ \ provided by protobuf library will by default use\n'type.googleapis.com/full.type.name'\ \ as the type URL and the unpack\nmethods only use the fully qualified type\ \ name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\"\ \ will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an\ \ `Any` value uses the regular\nrepresentation of the deserialized, embedded\ \ message, with an\nadditional field `@type` which contains the type URL. Example:\n\ \n package google.profile;\n message Person {\n string first_name\ \ = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ \ that representation will be embedded adding a field\n`value` which holds the\ \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ \ \"value\": \"1.212s\"\n }" additionalProperties: {} protobufNullValue: type: "string" description: "`NullValue` is a singleton enumeration to represent the null value\ \ for the\n`Value` type union.\n\n The JSON representation for `NullValue` is\ \ JSON `null`.\n\n - NULL_VALUE: Null value." enum: - "NULL_VALUE" default: "NULL_VALUE" rpcStatus: type: "object" properties: code: type: "integer" format: "int32" description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ \ common set of\nmessage types for APIs to use." items: $ref: "#/definitions/protobufAny" description: "The `Status` type defines a logical error model that is suitable\ \ for\ndifferent programming environments, including REST APIs and RPC APIs.\ \ It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\n\ three pieces of data: error code, error message, and error details.\n\nYou can\ \ find out more about this error model and how to work with it in the\n[API\ \ Design Guide](https://cloud.google.com/apis/design/errors)." golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/api_echo_service.go000066400000000000000000002063361465037340600335250ustar00rootroot00000000000000/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" "github.com/antihax/optional" ) // Linger please var ( _ context.Context ) type EchoServiceApiService service /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param optional nil or *EchoServiceEchoOpts - Optional Parameters: * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEchoOpts struct { Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho(ctx context.Context, id string, localVarOptionals *EchoServiceEchoOpts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num * @param optional nil or *EchoServiceEcho2Opts - Optional Parameters: * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho2Opts struct { LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho2(ctx context.Context, id string, num string, localVarOptionals *EchoServiceEcho2Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num * @param lang * @param optional nil or *EchoServiceEcho3Opts - Optional Parameters: * @param "LineNum" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho3Opts struct { LineNum optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho3(ctx context.Context, id string, num string, lang string, localVarOptionals *EchoServiceEcho3Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}/{lang}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) localVarPath = strings.Replace(localVarPath, "{"+"lang"+"}", fmt.Sprintf("%v", lang), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param lineNum * @param statusNote * @param optional nil or *EchoServiceEcho4Opts - Optional Parameters: * @param "Num" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho4Opts struct { Num optional.String Lang optional.String StatusProgress optional.String En optional.String NoProgress optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho4(ctx context.Context, id string, lineNum string, statusNote string, localVarOptionals *EchoServiceEcho4Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo1/{id}/{lineNum}/{status.note}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarPath = strings.Replace(localVarPath, "{"+"lineNum"+"}", fmt.Sprintf("%v", lineNum), -1) localVarPath = strings.Replace(localVarPath, "{"+"status.note"+"}", fmt.Sprintf("%v", statusNote), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param noNote * @param optional nil or *EchoServiceEcho5Opts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho5Opts struct { Id optional.String Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String En optional.String NoProgress optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho5(ctx context.Context, noNote string, localVarOptionals *EchoServiceEcho5Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo2/{no.note}" localVarPath = strings.Replace(localVarPath, "{"+"no.note"+"}", fmt.Sprintf("%v", noNote), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param resourceId * @param optional nil or *EchoServiceEcho6Opts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho6Opts struct { Id optional.String Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho6(ctx context.Context, resourceId string, localVarOptionals *EchoServiceEcho6Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/resource/{resourceId}" localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", fmt.Sprintf("%v", resourceId), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param nIdNId * @param optional nil or *EchoServiceEcho7Opts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEcho7Opts struct { Id optional.String Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEcho7(ctx context.Context, nIdNId string, localVarOptionals *EchoServiceEcho7Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/nested/{nId.nId}" localVarPath = strings.Replace(localVarPath, "{"+"nId.nId"+"}", fmt.Sprintf("%v", nIdNId), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService EchoBody method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body SimpleMessage represents a simple message sent to the Echo service. @return ExamplepbSimpleMessage */ func (a *EchoServiceApiService) EchoServiceEchoBody(ctx context.Context, body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_body" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService EchoBody method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param no * @param optional nil or *EchoServiceEchoBody2Opts - Optional Parameters: * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEchoBody2Opts struct { Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEchoBody2(ctx context.Context, id string, no ExamplepbEmbedded, localVarOptionals *EchoServiceEchoBody2Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_body/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &no r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService EchoDelete method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *EchoServiceEchoDeleteOpts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEchoDeleteOpts struct { Id optional.String Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEchoDelete(ctx context.Context, localVarOptionals *EchoServiceEchoDeleteOpts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_delete" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService EchoPatch method receives a NonStandardUpdateRequest and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body @return ExamplepbDynamicMessageUpdate */ func (a *EchoServiceApiService) EchoServiceEchoPatch(ctx context.Context, body ExamplepbDynamicMessage) (ExamplepbDynamicMessageUpdate, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbDynamicMessageUpdate ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_patch" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbDynamicMessageUpdate err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* EchoServiceApiService EchoUnauthorized method receives a simple message and returns it. It must always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code of 401. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *EchoServiceEchoUnauthorizedOpts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbSimpleMessage */ type EchoServiceEchoUnauthorizedOpts struct { Id optional.String Num optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *EchoServiceApiService) EchoServiceEchoUnauthorized(ctx context.Context, localVarOptionals *EchoServiceEchoUnauthorizedOpts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_unauthorized" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Num.IsSet() { localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/client.go000066400000000000000000000260151465037340600315060ustar00rootroot00000000000000/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" "fmt" "io" "mime/multipart" "net/http" "net/url" "os" "path/filepath" "reflect" "regexp" "strconv" "strings" "time" "unicode/utf8" "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) // APIClient manages communication with the Echo Service API vversion not set // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services EchoServiceApi *EchoServiceApiService } type service struct { client *APIClient } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.EchoServiceApi = (*EchoServiceApiService)(&c.common) return c } func atoi(in string) (int, error) { return strconv.Atoi(in) } // selectHeaderContentType select a content type from the available list. func selectHeaderContentType(contentTypes []string) string { if len(contentTypes) == 0 { return "" } if contains(contentTypes, "application/json") { return "application/json" } return contentTypes[0] // use the first content type specified in 'consumes' } // selectHeaderAccept join all accept types and return func selectHeaderAccept(accepts []string) string { if len(accepts) == 0 { return "" } if contains(accepts, "application/json") { return "application/json" } return strings.Join(accepts, ",") } // contains is a case insenstive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { if strings.ToLower(a) == strings.ToLower(needle) { return true } } return false } // Verify optional parameters are of the correct type. func typeCheckParameter(obj interface{}, expected string, name string) error { // Make sure there is an object. if obj == nil { return nil } // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) } return nil } // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { var delimiter string switch collectionFormat { case "pipes": delimiter = "|" case "ssv": delimiter = " " case "tsv": delimiter = "\t" case "csv": delimiter = "," } if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") } return fmt.Sprintf("%v", obj) } // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { return c.cfg.HTTPClient.Do(request) } // Change base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { var body *bytes.Buffer // Detect postBody type and post. if postBody != nil { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) headerParams["Content-Type"] = contentType } body, err = setBody(postBody, contentType) if err != nil { return nil, err } } // add form parameters and file if available. if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } body = &bytes.Buffer{} w := multipart.NewWriter(body) for k, v := range formParams { for _, iv := range v { if strings.HasPrefix(k, "@") { // file err = addFile(w, k[1:], iv) if err != nil { return nil, err } } else { // form value w.WriteField(k, iv) } } } if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) part, err := w.CreateFormFile("file", filepath.Base(fileName)) if err != nil { return nil, err } _, err = part.Write(fileBytes) if err != nil { return nil, err } // Set the Boundary in the Content-Type headerParams["Content-Type"] = w.FormDataContentType() } // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() } // Setup path and query parameters url, err := url.Parse(path) if err != nil { return nil, err } // Adding Query Param query := url.Query() for k, v := range queryParams { for _, iv := range v { query.Add(k, iv) } } // Encode the parameters. url.RawQuery = query.Encode() // Generate a new request if body != nil { localVarRequest, err = http.NewRequest(method, url.String(), body) } else { localVarRequest, err = http.NewRequest(method, url.String(), nil) } if err != nil { return nil, err } // add header parameters, if any if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { headers.Set(h, v) } localVarRequest.Header = headers } // Override request host, if applicable if c.cfg.Host != "" { localVarRequest.Host = c.cfg.Host } // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) if ctx != nil { // add context to the request localVarRequest = localVarRequest.WithContext(ctx) // Walk through any authentication. // OAuth2 authentication if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { return nil, err } latestToken.SetAuthHeader(localVarRequest) } // Basic HTTP Authentication if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { return err } _, err = io.Copy(part, file) return err } // Prevent trying to import "fmt" func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } // Set request body from an interface{} func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { if bodyBuf == nil { bodyBuf = &bytes.Buffer{} } if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { return nil, err } if bodyBuf.Len() == 0 { err = fmt.Errorf("Invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil } // detectContentType method is used to figure out `Request.Body` content type for request header func detectContentType(body interface{}) string { contentType := "text/plain; charset=utf-8" kind := reflect.TypeOf(body).Kind() switch kind { case reflect.Struct, reflect.Map, reflect.Ptr: contentType = "application/json; charset=utf-8" case reflect.String: contentType = "text/plain; charset=utf-8" default: if b, ok := body.([]byte); ok { contentType = http.DetectContentType(b) } else if kind == reflect.Slice { contentType = "application/json; charset=utf-8" } } return contentType } // Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go type cacheControl map[string]string func parseCacheControl(headers http.Header) cacheControl { cc := cacheControl{} ccHeader := headers.Get("Cache-Control") for _, part := range strings.Split(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue } if strings.ContainsRune(part, '=') { keyval := strings.Split(part, "=") cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") } else { cc[part] = "" } } return cc } // CacheExpires helper function to determine remaining time before repeating a request. func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time now, err := time.Parse(time.RFC1123, r.Header.Get("date")) if err != nil { return time.Now() } respCacheControl := parseCacheControl(r.Header) if maxAge, ok := respCacheControl["max-age"]; ok { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now } expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { expires, err = time.Parse(time.RFC1123, expiresHeader) if err != nil { expires = now } } } return expires } func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/configuration.go000066400000000000000000000040601465037340600330730ustar00rootroot00000000000000/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo import ( "net/http" ) // contextKeys are used to identify the type of value in the context. // Since these are string, it is possible to get a short description of the // context key for logging and debugging using key.String(). type contextKey string func (c contextKey) String() string { return "auth " + string(c) } var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` } // APIKey provides API key based authentication to a request passed via context using ContextAPIKey type APIKey struct { Key string Prefix string } type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } return cfg } func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } model_examplepb_dynamic_message.go000066400000000000000000000007631465037340600365200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // DynamicMessage represents a message which can have its structure built dynamically using Struct and Values. type ExamplepbDynamicMessage struct { StructField *interface{} `json:"structField,omitempty"` ValueField *interface{} `json:"valueField,omitempty"` } model_examplepb_dynamic_message_update.go000066400000000000000000000006021465037340600400520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo type ExamplepbDynamicMessageUpdate struct { Body *ExamplepbDynamicMessage `json:"body,omitempty"` UpdateMask string `json:"updateMask,omitempty"` } model_examplepb_embedded.go000066400000000000000000000006341465037340600351160ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // Embedded represents a message embedded in SimpleMessage. type ExamplepbEmbedded struct { Progress string `json:"progress,omitempty"` Note string `json:"note,omitempty"` } model_examplepb_nested_message.go000066400000000000000000000005311465037340600363470ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo type ExamplepbNestedMessage struct { NId string `json:"nId,omitempty"` Val string `json:"val,omitempty"` } model_examplepb_simple_message.go000066400000000000000000000014001465037340600363520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // SimpleMessage represents a simple message sent to the Echo service. type ExamplepbSimpleMessage struct { // Id represents the message identifier. Id string `json:"id,omitempty"` Num string `json:"num,omitempty"` LineNum string `json:"lineNum,omitempty"` Lang string `json:"lang,omitempty"` Status *ExamplepbEmbedded `json:"status,omitempty"` En string `json:"en,omitempty"` No *ExamplepbEmbedded `json:"no,omitempty"` ResourceId string `json:"resourceId,omitempty"` NId *ExamplepbNestedMessage `json:"nId,omitempty"` } model_protobuf_any.go000066400000000000000000000072441465037340600340430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } type ProtobufAny struct { // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. Type_ string `json:"@type,omitempty"` } model_protobuf_null_value.go000066400000000000000000000010741465037340600354150ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // ProtobufNullValue : `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. type ProtobufNullValue string // List of protobufNullValue const ( NULL_VALUE_ProtobufNullValue ProtobufNullValue = "NULL_VALUE" ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/model_rpc_status.go000066400000000000000000000023331465037340600335740ustar00rootroot00000000000000/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). type RpcStatus struct { // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. Code int32 `json:"code,omitempty"` // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. Message string `json:"message,omitempty"` // A list of messages that carry the error details. There is a common set of message types for APIs to use. Details []ProtobufAny `json:"details,omitempty"` } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/echo/response.go000066400000000000000000000023371465037340600320670ustar00rootroot00000000000000/* * Echo Service * * Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo import ( "net/http" ) type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage} return response } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/000077500000000000000000000000001465037340600335305ustar00rootroot00000000000000.gitignore000066400000000000000000000000061465037340600354350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/docs .swagger-codegen-ignore000066400000000000000000000000131465037340600377660ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods.gitignore .swagger-codegen/000077500000000000000000000000001465037340600365705ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethodsVERSION000066400000000000000000000000051465037340600376330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/.swagger-codegen2.4.8BUILD.bazel000066400000000000000000000013671465037340600353360ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethodsload("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "generateunboundmethods", srcs = [ "api_generate_unbound_methods_echo_service.go", "client.go", "configuration.go", "model_examplepb_generate_unbound_methods_simple_message.go", "model_protobuf_any.go", "model_rpc_status.go", "model_runtime_error.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/generateunboundmethods", visibility = ["//examples:__subpackages__"], deps = ["@org_golang_x_oauth2//:oauth2"], ) alias( name = "go_default_library", actual = ":generateunboundmethods", visibility = ["//examples:__subpackages__"], ) api/000077500000000000000000000000001465037340600342225ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethodsswagger.yaml000066400000000000000000000105051465037340600365460ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/api--- swagger: "2.0" info: description: "Generate Unannotated Methods Echo Service\nSimilar to echo_service.proto\ \ but without annotations and without external configuration.\n\nGenerate Unannotated\ \ Methods Echo Service API consists of a single service which returns\na message." version: "version not set" title: "examples/internal/proto/examplepb/generate_unbound_methods.proto" tags: - name: "GenerateUnboundMethodsEchoService" consumes: - "application/json" produces: - "application/json" paths: /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo: post: tags: - "GenerateUnboundMethodsEchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." operationId: "GenerateUnboundMethodsEchoService_Echo" parameters: - in: "body" name: "body" description: "GenerateUnboundMethodsSimpleMessage represents a simple message\ \ sent to the unannotated GenerateUnboundMethodsEchoService service." required: true schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody: post: tags: - "GenerateUnboundMethodsEchoService" summary: "EchoBody method receives a simple message and returns it." operationId: "GenerateUnboundMethodsEchoService_EchoBody" parameters: - in: "body" name: "body" description: "GenerateUnboundMethodsSimpleMessage represents a simple message\ \ sent to the unannotated GenerateUnboundMethodsEchoService service." required: true schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete: post: tags: - "GenerateUnboundMethodsEchoService" summary: "EchoDelete method receives a simple message and returns it." operationId: "GenerateUnboundMethodsEchoService_EchoDelete" parameters: - in: "body" name: "body" description: "GenerateUnboundMethodsSimpleMessage represents a simple message\ \ sent to the unannotated GenerateUnboundMethodsEchoService service." required: true schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" definitions: examplepbGenerateUnboundMethodsSimpleMessage: type: "object" properties: id: type: "string" description: "Id represents the message identifier." num: type: "string" format: "int64" duration: type: "string" description: "GenerateUnboundMethodsSimpleMessage represents a simple message\ \ sent to the unannotated GenerateUnboundMethodsEchoService service." example: duration: "duration" num: "num" id: "id" protobufAny: type: "object" properties: '@type': type: "string" additionalProperties: {} rpcStatus: type: "object" properties: code: type: "integer" format: "int32" message: type: "string" details: type: "array" items: $ref: "#/definitions/protobufAny" api_generate_unbound_methods_echo_service.go000066400000000000000000000274071465037340600444300ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods import ( "context" "io/ioutil" "net/http" "net/url" "strings" ) // Linger please var ( _ context.Context ) type GenerateUnboundMethodsEchoServiceApiService service /* GenerateUnboundMethodsEchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. @return ExamplepbGenerateUnboundMethodsSimpleMessage */ func (a *GenerateUnboundMethodsEchoServiceApiService) GenerateUnboundMethodsEchoServiceEcho(ctx context.Context, body ExamplepbGenerateUnboundMethodsSimpleMessage) (ExamplepbGenerateUnboundMethodsSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbGenerateUnboundMethodsSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbGenerateUnboundMethodsSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* GenerateUnboundMethodsEchoServiceApiService EchoBody method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. @return ExamplepbGenerateUnboundMethodsSimpleMessage */ func (a *GenerateUnboundMethodsEchoServiceApiService) GenerateUnboundMethodsEchoServiceEchoBody(ctx context.Context, body ExamplepbGenerateUnboundMethodsSimpleMessage) (ExamplepbGenerateUnboundMethodsSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbGenerateUnboundMethodsSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbGenerateUnboundMethodsSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* GenerateUnboundMethodsEchoServiceApiService EchoDelete method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. @return ExamplepbGenerateUnboundMethodsSimpleMessage */ func (a *GenerateUnboundMethodsEchoServiceApiService) GenerateUnboundMethodsEchoServiceEchoDelete(ctx context.Context, body ExamplepbGenerateUnboundMethodsSimpleMessage) (ExamplepbGenerateUnboundMethodsSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbGenerateUnboundMethodsSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbGenerateUnboundMethodsSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } client.go000066400000000000000000000266011465037340600352630ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" "fmt" "io" "mime/multipart" "net/http" "net/url" "os" "path/filepath" "reflect" "regexp" "strconv" "strings" "time" "unicode/utf8" "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) // APIClient manages communication with the examples/internal/proto/examplepb/generate_unbound_methods.proto API vversion not set // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services GenerateUnboundMethodsEchoServiceApi *GenerateUnboundMethodsEchoServiceApiService } type service struct { client *APIClient } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.GenerateUnboundMethodsEchoServiceApi = (*GenerateUnboundMethodsEchoServiceApiService)(&c.common) return c } func atoi(in string) (int, error) { return strconv.Atoi(in) } // selectHeaderContentType select a content type from the available list. func selectHeaderContentType(contentTypes []string) string { if len(contentTypes) == 0 { return "" } if contains(contentTypes, "application/json") { return "application/json" } return contentTypes[0] // use the first content type specified in 'consumes' } // selectHeaderAccept join all accept types and return func selectHeaderAccept(accepts []string) string { if len(accepts) == 0 { return "" } if contains(accepts, "application/json") { return "application/json" } return strings.Join(accepts, ",") } // contains is a case insenstive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { if strings.ToLower(a) == strings.ToLower(needle) { return true } } return false } // Verify optional parameters are of the correct type. func typeCheckParameter(obj interface{}, expected string, name string) error { // Make sure there is an object. if obj == nil { return nil } // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) } return nil } // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { var delimiter string switch collectionFormat { case "pipes": delimiter = "|" case "ssv": delimiter = " " case "tsv": delimiter = "\t" case "csv": delimiter = "," } if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") } return fmt.Sprintf("%v", obj) } // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { return c.cfg.HTTPClient.Do(request) } // Change base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { var body *bytes.Buffer // Detect postBody type and post. if postBody != nil { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) headerParams["Content-Type"] = contentType } body, err = setBody(postBody, contentType) if err != nil { return nil, err } } // add form parameters and file if available. if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } body = &bytes.Buffer{} w := multipart.NewWriter(body) for k, v := range formParams { for _, iv := range v { if strings.HasPrefix(k, "@") { // file err = addFile(w, k[1:], iv) if err != nil { return nil, err } } else { // form value w.WriteField(k, iv) } } } if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) part, err := w.CreateFormFile("file", filepath.Base(fileName)) if err != nil { return nil, err } _, err = part.Write(fileBytes) if err != nil { return nil, err } // Set the Boundary in the Content-Type headerParams["Content-Type"] = w.FormDataContentType() } // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() } // Setup path and query parameters url, err := url.Parse(path) if err != nil { return nil, err } // Adding Query Param query := url.Query() for k, v := range queryParams { for _, iv := range v { query.Add(k, iv) } } // Encode the parameters. url.RawQuery = query.Encode() // Generate a new request if body != nil { localVarRequest, err = http.NewRequest(method, url.String(), body) } else { localVarRequest, err = http.NewRequest(method, url.String(), nil) } if err != nil { return nil, err } // add header parameters, if any if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { headers.Set(h, v) } localVarRequest.Header = headers } // Override request host, if applicable if c.cfg.Host != "" { localVarRequest.Host = c.cfg.Host } // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) if ctx != nil { // add context to the request localVarRequest = localVarRequest.WithContext(ctx) // Walk through any authentication. // OAuth2 authentication if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { return nil, err } latestToken.SetAuthHeader(localVarRequest) } // Basic HTTP Authentication if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { return err } _, err = io.Copy(part, file) return err } // Prevent trying to import "fmt" func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } // Set request body from an interface{} func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { if bodyBuf == nil { bodyBuf = &bytes.Buffer{} } if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { return nil, err } if bodyBuf.Len() == 0 { err = fmt.Errorf("Invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil } // detectContentType method is used to figure out `Request.Body` content type for request header func detectContentType(body interface{}) string { contentType := "text/plain; charset=utf-8" kind := reflect.TypeOf(body).Kind() switch kind { case reflect.Struct, reflect.Map, reflect.Ptr: contentType = "application/json; charset=utf-8" case reflect.String: contentType = "text/plain; charset=utf-8" default: if b, ok := body.([]byte); ok { contentType = http.DetectContentType(b) } else if kind == reflect.Slice { contentType = "application/json; charset=utf-8" } } return contentType } // Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go type cacheControl map[string]string func parseCacheControl(headers http.Header) cacheControl { cc := cacheControl{} ccHeader := headers.Get("Cache-Control") for _, part := range strings.Split(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue } if strings.ContainsRune(part, '=') { keyval := strings.Split(part, "=") cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") } else { cc[part] = "" } } return cc } // CacheExpires helper function to determine remaining time before repeating a request. func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time now, err := time.Parse(time.RFC1123, r.Header.Get("date")) if err != nil { return time.Now() } respCacheControl := parseCacheControl(r.Header) if maxAge, ok := respCacheControl["max-age"]; ok { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now } expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { expires, err = time.Parse(time.RFC1123, expiresHeader) if err != nil { expires = now } } } return expires } func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }configuration.go000066400000000000000000000044301465037340600366500ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods import ( "net/http" ) // contextKeys are used to identify the type of value in the context. // Since these are string, it is possible to get a short description of the // context key for logging and debugging using key.String(). type contextKey string func (c contextKey) String() string { return "auth " + string(c) } var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` } // APIKey provides API key based authentication to a request passed via context using ContextAPIKey type APIKey struct { Key string Prefix string } type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } return cfg } func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } docs/000077500000000000000000000000001465037340600344015ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethodsExamplepbGenerateUnboundMethodsSimpleMessage.md000066400000000000000000000010201465037340600456420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/docs# ExamplepbGenerateUnboundMethodsSimpleMessage ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **string** | Id represents the message identifier. | [optional] [default to null] **Num** | **string** | | [optional] [default to null] **Duration** | **string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) GenerateUnboundMethodsEchoServiceApi.md000066400000000000000000000106111465037340600441050ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/docs# \GenerateUnboundMethodsEchoServiceApi All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**GenerateUnboundMethodsEchoServiceEcho**](GenerateUnboundMethodsEchoServiceApi.md#GenerateUnboundMethodsEchoServiceEcho) | **Post** /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo | Echo method receives a simple message and returns it. [**GenerateUnboundMethodsEchoServiceEchoBody**](GenerateUnboundMethodsEchoServiceApi.md#GenerateUnboundMethodsEchoServiceEchoBody) | **Post** /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody | EchoBody method receives a simple message and returns it. [**GenerateUnboundMethodsEchoServiceEchoDelete**](GenerateUnboundMethodsEchoServiceApi.md#GenerateUnboundMethodsEchoServiceEchoDelete) | **Post** /grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete | EchoDelete method receives a simple message and returns it. # **GenerateUnboundMethodsEchoServiceEcho** > ExamplepbGenerateUnboundMethodsSimpleMessage GenerateUnboundMethodsEchoServiceEcho(ctx, body) Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **body** | [**ExamplepbGenerateUnboundMethodsSimpleMessage**](ExamplepbGenerateUnboundMethodsSimpleMessage.md)| GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. | ### Return type [**ExamplepbGenerateUnboundMethodsSimpleMessage**](examplepbGenerateUnboundMethodsSimpleMessage.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GenerateUnboundMethodsEchoServiceEchoBody** > ExamplepbGenerateUnboundMethodsSimpleMessage GenerateUnboundMethodsEchoServiceEchoBody(ctx, body) EchoBody method receives a simple message and returns it. ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **body** | [**ExamplepbGenerateUnboundMethodsSimpleMessage**](ExamplepbGenerateUnboundMethodsSimpleMessage.md)| GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. | ### Return type [**ExamplepbGenerateUnboundMethodsSimpleMessage**](examplepbGenerateUnboundMethodsSimpleMessage.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GenerateUnboundMethodsEchoServiceEchoDelete** > ExamplepbGenerateUnboundMethodsSimpleMessage GenerateUnboundMethodsEchoServiceEchoDelete(ctx, body) EchoDelete method receives a simple message and returns it. ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **body** | [**ExamplepbGenerateUnboundMethodsSimpleMessage**](ExamplepbGenerateUnboundMethodsSimpleMessage.md)| GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. | ### Return type [**ExamplepbGenerateUnboundMethodsSimpleMessage**](examplepbGenerateUnboundMethodsSimpleMessage.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) ProtobufAny.md000066400000000000000000000005321465037340600371730ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/docs# ProtobufAny ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Type_** | **string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) RuntimeError.md000066400000000000000000000010421465037340600373550ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/docs# RuntimeError ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Error_** | **string** | | [optional] [default to null] **Code** | **int32** | | [optional] [default to null] **Message** | **string** | | [optional] [default to null] **Details** | [**[]ProtobufAny**](protobufAny.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) model_examplepb_generate_unbound_methods_simple_message.go000066400000000000000000000014621465037340600473440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods // GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. type ExamplepbGenerateUnboundMethodsSimpleMessage struct { // Id represents the message identifier. Id string `json:"id,omitempty"` Num string `json:"num,omitempty"` Duration string `json:"duration,omitempty"` } model_protobuf_any.go000066400000000000000000000010271465037340600376670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods type ProtobufAny struct { Type_ string `json:"@type,omitempty"` } model_rpc_status.go000066400000000000000000000011571465037340600373530ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods type RpcStatus struct { Code int32 `json:"code,omitempty"` Message string `json:"message,omitempty"` Details []ProtobufAny `json:"details,omitempty"` } model_runtime_error.go000066400000000000000000000012321465037340600400520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods type RuntimeError struct { Error_ string `json:"error,omitempty"` Code int32 `json:"code,omitempty"` Message string `json:"message,omitempty"` Details []ProtobufAny `json:"details,omitempty"` } response.go000066400000000000000000000027071465037340600356440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/generateunboundmethods/* * examples/internal/proto/examplepb/generate_unbound_methods.proto * * Generate Unannotated Methods Echo Service Similar to echo_service.proto but without annotations and without external configuration. Generate Unannotated Methods Echo Service API consists of a single service which returns a message. * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package generateunboundmethods import ( "net/http" ) type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage} return response } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/000077500000000000000000000000001465037340600314735ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/.gitignore000066400000000000000000000004121465037340600334600ustar00rootroot00000000000000# Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a *.so # Folders _obj _test # Architecture specific extensions/prefixes *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export.* _testmain.go *.exe *.test *.prof .swagger-codegen-ignore000066400000000000000000000020061465037340600357350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody# Swagger Codegen Ignore # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen # Use this file to prevent files from being overwritten by the generator. # The patterns follow closely to .gitignore or .dockerignore. # As an example, the C# client generator defines ApiClient.cs. # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: #ApiClient.cs # You can match any string of characters against a directory, file or extension with a single asterisk (*): #foo/*/qux # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md .swagger-codegen/000077500000000000000000000000001465037340600345335ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebodyVERSION000066400000000000000000000000051465037340600355760ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/.swagger-codegen2.4.8golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/BUILD.bazel000066400000000000000000000017421465037340600333550ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "responsebody", srcs = [ "api_response_body_service.go", "client.go", "configuration.go", "model_examplepb_repeated_response_body_out.go", "model_examplepb_repeated_response_body_out_response.go", "model_examplepb_repeated_response_strings.go", "model_examplepb_response_body_out.go", "model_examplepb_response_body_out_response.go", "model_protobuf_any.go", "model_response_response_type.go", "model_rpc_status.go", "model_stream_result_of_examplepb_response_body_out.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/responsebody", visibility = ["//visibility:public"], deps = ["@org_golang_x_oauth2//:oauth2"], ) alias( name = "go_default_library", actual = ":responsebody", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/api/000077500000000000000000000000001465037340600322445ustar00rootroot00000000000000swagger.yaml000066400000000000000000000227571465037340600345250ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/api--- swagger: "2.0" info: version: "version not set" title: "examples/internal/proto/examplepb/response_body_service.proto" tags: - name: "ResponseBodyService" consumes: - "application/json" produces: - "application/json" paths: /responsebodies/{data}: get: tags: - "ResponseBodyService" operationId: "ResponseBodyService_ListResponseBodies" parameters: - name: "data" in: "path" required: true type: "string" x-exportParamName: "Data" responses: 200: description: "" schema: type: "array" items: $ref: "#/definitions/examplepbRepeatedResponseBodyOutResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /responsebody/stream/{data}: get: tags: - "ResponseBodyService" operationId: "ResponseBodyService_GetResponseBodyStream" parameters: - name: "data" in: "path" required: true type: "string" x-exportParamName: "Data" responses: 200: description: "(streaming responses)" schema: type: "object" properties: result: $ref: "#/definitions/examplepbResponseBodyOutResponse" error: $ref: "#/definitions/rpcStatus" title: "Stream result of examplepbResponseBodyOut" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /responsebody/{data}: get: tags: - "ResponseBodyService" operationId: "ResponseBodyService_GetResponseBody" parameters: - name: "data" in: "path" required: true type: "string" x-exportParamName: "Data" responses: 200: description: "" schema: $ref: "#/definitions/examplepbResponseBodyOutResponse" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /responsestrings/{data}: get: tags: - "ResponseBodyService" operationId: "ResponseBodyService_ListResponseStrings" parameters: - name: "data" in: "path" required: true type: "string" x-exportParamName: "Data" responses: 200: description: "" schema: type: "array" items: type: "string" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" definitions: ResponseResponseType: type: "string" title: "- UNKNOWN: UNKNOWN\n - A: A is 1\n - B: B is 2" enum: - "UNKNOWN" - "A" - "B" default: "UNKNOWN" examplepbRepeatedResponseBodyOut: type: "object" properties: response: type: "array" items: $ref: "#/definitions/examplepbRepeatedResponseBodyOutResponse" examplepbRepeatedResponseBodyOutResponse: type: "object" properties: data: type: "string" type: $ref: "#/definitions/ResponseResponseType" example: data: "data" type: {} examplepbRepeatedResponseStrings: type: "object" properties: values: type: "array" items: type: "string" examplepbResponseBodyOut: type: "object" properties: response: $ref: "#/definitions/examplepbResponseBodyOutResponse" examplepbResponseBodyOutResponse: type: "object" properties: data: type: "string" example: data: "data" protobufAny: type: "object" properties: '@type': type: "string" description: "A URL/resource name that uniquely identifies the type of the\ \ serialized\nprotocol buffer message. This string must contain at least\n\ one \"/\" character. The last segment of the URL's path must represent\n\ the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ \nIn practice, teams usually precompile into the binary all types that they\n\ expect it to use in the context of Any. However, for URLs which use the\n\ scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ server that maps type URLs to message definitions as follows:\n\n* If no\ \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ \ an error.\n* Applications are allowed to cache lookup results based on\ \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ \ Therefore, binary compatibility needs to be preserved\n on changes to\ \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ \ this functionality is not currently available in the official\nprotobuf\ \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ \ with implementation specific semantics." description: "`Any` contains an arbitrary serialized protocol buffer message along\ \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ \ library provides support to pack/unpack Any values in the form\nof utility\ \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ \ }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ \ any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in\ \ Go\n\n foo := &pb.Foo{...}\n any, err := anypb.New(foo)\n if err\ \ != nil {\n ...\n }\n ...\n foo := &pb.Foo{}\n if err\ \ := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods\ \ provided by protobuf library will by default use\n'type.googleapis.com/full.type.name'\ \ as the type URL and the unpack\nmethods only use the fully qualified type\ \ name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\"\ \ will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an\ \ `Any` value uses the regular\nrepresentation of the deserialized, embedded\ \ message, with an\nadditional field `@type` which contains the type URL. Example:\n\ \n package google.profile;\n message Person {\n string first_name\ \ = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ \ that representation will be embedded adding a field\n`value` which holds the\ \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ \ \"value\": \"1.212s\"\n }" example: '@type': "@type" additionalProperties: {} rpcStatus: type: "object" properties: code: type: "integer" format: "int32" description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ \ common set of\nmessage types for APIs to use." items: $ref: "#/definitions/protobufAny" description: "The `Status` type defines a logical error model that is suitable\ \ for\ndifferent programming environments, including REST APIs and RPC APIs.\ \ It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\n\ three pieces of data: error code, error message, and error details.\n\nYou can\ \ find out more about this error model and how to work with it in the\n[API\ \ Design Guide](https://cloud.google.com/apis/design/errors)." example: code: 0 details: - '@type': "@type" - '@type': "@type" message: "message" Stream result of examplepbResponseBodyOut: properties: result: $ref: "#/definitions/examplepbResponseBodyOutResponse" error: $ref: "#/definitions/rpcStatus" example: result: data: "data" error: code: 0 details: - '@type': "@type" - '@type': "@type" message: "message" api_response_body_service.go000066400000000000000000000337061465037340600372000ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" ) // Linger please var ( _ context.Context ) type ResponseBodyServiceApiService service /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param data @return ExamplepbResponseBodyOutResponse */ func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBody(ctx context.Context, data string) (ExamplepbResponseBodyOutResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbResponseBodyOutResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/responsebody/{data}" localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbResponseBodyOutResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param data @return StreamResultOfExamplepbResponseBodyOut */ func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBodyStream(ctx context.Context, data string) (StreamResultOfExamplepbResponseBodyOut, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue StreamResultOfExamplepbResponseBodyOut ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/responsebody/stream/{data}" localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v StreamResultOfExamplepbResponseBodyOut err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param data @return []ExamplepbRepeatedResponseBodyOutResponse */ func (a *ResponseBodyServiceApiService) ResponseBodyServiceListResponseBodies(ctx context.Context, data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue []ExamplepbRepeatedResponseBodyOutResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/responsebodies/{data}" localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []ExamplepbRepeatedResponseBodyOutResponse err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param data @return []string */ func (a *ResponseBodyServiceApiService) ResponseBodyServiceListResponseStrings(ctx context.Context, data string) ([]string, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue []string ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/responsestrings/{data}" localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/client.go000066400000000000000000000262661465037340600333140ustar00rootroot00000000000000/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" "fmt" "io" "mime/multipart" "net/http" "net/url" "os" "path/filepath" "reflect" "regexp" "strconv" "strings" "time" "unicode/utf8" "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) // APIClient manages communication with the examples/internal/proto/examplepb/response_body_service.proto API vversion not set // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services ResponseBodyServiceApi *ResponseBodyServiceApiService } type service struct { client *APIClient } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.ResponseBodyServiceApi = (*ResponseBodyServiceApiService)(&c.common) return c } func atoi(in string) (int, error) { return strconv.Atoi(in) } // selectHeaderContentType select a content type from the available list. func selectHeaderContentType(contentTypes []string) string { if len(contentTypes) == 0 { return "" } if contains(contentTypes, "application/json") { return "application/json" } return contentTypes[0] // use the first content type specified in 'consumes' } // selectHeaderAccept join all accept types and return func selectHeaderAccept(accepts []string) string { if len(accepts) == 0 { return "" } if contains(accepts, "application/json") { return "application/json" } return strings.Join(accepts, ",") } // contains is a case insenstive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { if strings.ToLower(a) == strings.ToLower(needle) { return true } } return false } // Verify optional parameters are of the correct type. func typeCheckParameter(obj interface{}, expected string, name string) error { // Make sure there is an object. if obj == nil { return nil } // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) } return nil } // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { var delimiter string switch collectionFormat { case "pipes": delimiter = "|" case "ssv": delimiter = " " case "tsv": delimiter = "\t" case "csv": delimiter = "," } if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") } return fmt.Sprintf("%v", obj) } // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { return c.cfg.HTTPClient.Do(request) } // Change base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { var body *bytes.Buffer // Detect postBody type and post. if postBody != nil { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) headerParams["Content-Type"] = contentType } body, err = setBody(postBody, contentType) if err != nil { return nil, err } } // add form parameters and file if available. if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } body = &bytes.Buffer{} w := multipart.NewWriter(body) for k, v := range formParams { for _, iv := range v { if strings.HasPrefix(k, "@") { // file err = addFile(w, k[1:], iv) if err != nil { return nil, err } } else { // form value w.WriteField(k, iv) } } } if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) part, err := w.CreateFormFile("file", filepath.Base(fileName)) if err != nil { return nil, err } _, err = part.Write(fileBytes) if err != nil { return nil, err } // Set the Boundary in the Content-Type headerParams["Content-Type"] = w.FormDataContentType() } // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() } // Setup path and query parameters url, err := url.Parse(path) if err != nil { return nil, err } // Adding Query Param query := url.Query() for k, v := range queryParams { for _, iv := range v { query.Add(k, iv) } } // Encode the parameters. url.RawQuery = query.Encode() // Generate a new request if body != nil { localVarRequest, err = http.NewRequest(method, url.String(), body) } else { localVarRequest, err = http.NewRequest(method, url.String(), nil) } if err != nil { return nil, err } // add header parameters, if any if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { headers.Set(h, v) } localVarRequest.Header = headers } // Override request host, if applicable if c.cfg.Host != "" { localVarRequest.Host = c.cfg.Host } // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) if ctx != nil { // add context to the request localVarRequest = localVarRequest.WithContext(ctx) // Walk through any authentication. // OAuth2 authentication if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { return nil, err } latestToken.SetAuthHeader(localVarRequest) } // Basic HTTP Authentication if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { return err } _, err = io.Copy(part, file) return err } // Prevent trying to import "fmt" func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } // Set request body from an interface{} func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { if bodyBuf == nil { bodyBuf = &bytes.Buffer{} } if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { return nil, err } if bodyBuf.Len() == 0 { err = fmt.Errorf("Invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil } // detectContentType method is used to figure out `Request.Body` content type for request header func detectContentType(body interface{}) string { contentType := "text/plain; charset=utf-8" kind := reflect.TypeOf(body).Kind() switch kind { case reflect.Struct, reflect.Map, reflect.Ptr: contentType = "application/json; charset=utf-8" case reflect.String: contentType = "text/plain; charset=utf-8" default: if b, ok := body.([]byte); ok { contentType = http.DetectContentType(b) } else if kind == reflect.Slice { contentType = "application/json; charset=utf-8" } } return contentType } // Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go type cacheControl map[string]string func parseCacheControl(headers http.Header) cacheControl { cc := cacheControl{} ccHeader := headers.Get("Cache-Control") for _, part := range strings.Split(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue } if strings.ContainsRune(part, '=') { keyval := strings.Split(part, "=") cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") } else { cc[part] = "" } } return cc } // CacheExpires helper function to determine remaining time before repeating a request. func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time now, err := time.Parse(time.RFC1123, r.Header.Get("date")) if err != nil { return time.Now() } respCacheControl := parseCacheControl(r.Header) if maxAge, ok := respCacheControl["max-age"]; ok { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now } expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { expires, err = time.Parse(time.RFC1123, expiresHeader) if err != nil { expires = now } } } return expires } func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }configuration.go000066400000000000000000000042101465037340600346070ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody import ( "net/http" ) // contextKeys are used to identify the type of value in the context. // Since these are string, it is possible to get a short description of the // context key for logging and debugging using key.String(). type contextKey string func (c contextKey) String() string { return "auth " + string(c) } var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` } // APIKey provides API key based authentication to a request passed via context using ContextAPIKey type APIKey struct { Key string Prefix string } type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } return cfg } func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs/000077500000000000000000000000001465037340600324235ustar00rootroot00000000000000ExamplepbRepeatedResponseBodyOut.md000066400000000000000000000007051465037340600413040ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbRepeatedResponseBodyOut ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Response** | [**[]ExamplepbRepeatedResponseBodyOutResponse**](examplepbRepeatedResponseBodyOutResponse.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbRepeatedResponseBodyOutResponse.md000066400000000000000000000007311465037340600430220ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbRepeatedResponseBodyOutResponse ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] **Type_** | [***ResponseResponseType**](ResponseResponseType.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbRepeatedResponseStrings.md000066400000000000000000000005621465037340600413510ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbRepeatedResponseStrings ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Values** | **[]string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbResponseBodyMessage.md000066400000000000000000000007621465037340600404520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbResponseBodyMessage ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Request** | **string** | | [optional] [default to null] **Response** | [**ExamplepbResponseBodyMessageResponse**](examplepbResponseBodyMessageResponse.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbResponseBodyMessageResponse.md000066400000000000000000000005621465037340600421670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbResponseBodyMessageResponse ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbResponseBodyOut.md000066400000000000000000000006541465037340600376350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbResponseBodyOut ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Response** | [***ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbResponseBodyOutResponse.md000066400000000000000000000005561465037340600413550ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbResponseBodyOutResponse ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ExamplepbResponseBodyReq.md000066400000000000000000000005461465037340600376150ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ExamplepbResponseBodyReq ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ProtobufAny.md000066400000000000000000000033411465037340600351370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ProtobufAny ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Type_** | **string** | A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) ResponseBodyServiceApi.md000066400000000000000000000075531465037340600372670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# \ResponseBodyServiceApi All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**ResponseBodyServiceGetResponseBody**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBody) | **Get** /responsebody/{data} | [**ResponseBodyServiceGetResponseBodyStream**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBodyStream) | **Get** /responsebody/stream/{data} | [**ResponseBodyServiceListResponseBodies**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseBodies) | **Get** /responsebodies/{data} | [**ResponseBodyServiceListResponseStrings**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseStrings) | **Get** /responsestrings/{data} | # **ResponseBodyServiceGetResponseBody** > ExamplepbResponseBodyOutResponse ResponseBodyServiceGetResponseBody(ctx, data) ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **data** | **string**| | ### Return type [**ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **ResponseBodyServiceGetResponseBodyStream** > StreamResultOfExamplepbResponseBodyOut ResponseBodyServiceGetResponseBodyStream(ctx, data) ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **data** | **string**| | ### Return type [**StreamResultOfExamplepbResponseBodyOut**](Stream result of examplepbResponseBodyOut.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **ResponseBodyServiceListResponseBodies** > []ExamplepbRepeatedResponseBodyOutResponse ResponseBodyServiceListResponseBodies(ctx, data) ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **data** | **string**| | ### Return type [**[]ExamplepbRepeatedResponseBodyOutResponse**](examplepbRepeatedResponseBodyOutResponse.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **ResponseBodyServiceListResponseStrings** > []string ResponseBodyServiceListResponseStrings(ctx, data) ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **data** | **string**| | ### Return type **[]string** ### Authorization No authorization required ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) ResponseResponseType.md000066400000000000000000000004521465037340600370460ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# ResponseResponseType ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) RpcStatus.md000066400000000000000000000015741465037340600346250ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# RpcStatus ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Code** | **int32** | The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. | [optional] [default to null] **Message** | **string** | A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. | [optional] [default to null] **Details** | [**[]ProtobufAny**](protobufAny.md) | A list of messages that carry the error details. There is a common set of message types for APIs to use. | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) RuntimeError.md000066400000000000000000000010421465037340600353200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# RuntimeError ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Error_** | **string** | | [optional] [default to null] **Code** | **int32** | | [optional] [default to null] **Message** | **string** | | [optional] [default to null] **Details** | [**[]ProtobufAny**](protobufAny.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) StreamResultOfExamplepbResponseBodyOut.md000066400000000000000000000010061465037340600424650ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/docs# StreamResultOfExamplepbResponseBodyOut ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Result** | [***ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] **Error_** | [***RpcStatus**](rpcStatus.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) model_examplepb_repeated_response_body_out.go000066400000000000000000000007061465037340600425760ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseBodyOut struct { Response []ExamplepbRepeatedResponseBodyOutResponse `json:"response,omitempty"` } model_examplepb_repeated_response_body_out_response.go000066400000000000000000000007271465037340600445170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseBodyOutResponse struct { Data string `json:"data,omitempty"` Type_ *ResponseResponseType `json:"type,omitempty"` } model_examplepb_repeated_response_strings.go000066400000000000000000000006401465037340600424400ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseStrings struct { Values []string `json:"values,omitempty"` } model_examplepb_response_body_out.go000066400000000000000000000006651465037340600407310ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbResponseBodyOut struct { Response *ExamplepbResponseBodyOutResponse `json:"response,omitempty"` } model_examplepb_response_body_out_response.go000066400000000000000000000006321465037340600426410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbResponseBodyOutResponse struct { Data string `json:"data,omitempty"` } model_protobuf_any.go000066400000000000000000000073741465037340600356450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody // `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } type ProtobufAny struct { // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. Type_ string `json:"@type,omitempty"` } model_response_response_type.go000066400000000000000000000010651465037340600377420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ResponseResponseType string // List of ResponseResponseType const ( UNKNOWN_ResponseResponseType ResponseResponseType = "UNKNOWN" A_ResponseResponseType ResponseResponseType = "A" B_ResponseResponseType ResponseResponseType = "B" ) model_rpc_status.go000066400000000000000000000024631465037340600353170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody // The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). type RpcStatus struct { // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. Code int32 `json:"code,omitempty"` // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. Message string `json:"message,omitempty"` // A list of messages that carry the error details. There is a common set of message types for APIs to use. Details []ProtobufAny `json:"details,omitempty"` } model_stream_result_of_examplepb_response_body_out.go000066400000000000000000000007531465037340600443640ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type StreamResultOfExamplepbResponseBodyOut struct { Result *ExamplepbResponseBodyOutResponse `json:"result,omitempty"` Error_ *RpcStatus `json:"error,omitempty"` } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/responsebody/response.go000066400000000000000000000024671465037340600336710ustar00rootroot00000000000000/* * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: version not set * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody import ( "net/http" ) type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage} return response } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/staticcheck.conf000066400000000000000000000000221465037340600321050ustar00rootroot00000000000000checks = ["-all"] golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/000077500000000000000000000000001465037340600321365ustar00rootroot00000000000000.gitignore000066400000000000000000000000061465037340600340430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/docs .swagger-codegen-ignore000066400000000000000000000000131465037340600363740ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho.gitignore .swagger-codegen/000077500000000000000000000000001465037340600351765ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedechoVERSION000066400000000000000000000000051465037340600362410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/.swagger-codegen2.4.8BUILD.bazel000066400000000000000000000016051465037340600337370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedechoload("@io_bazel_rules_go//go:def.bzl", "go_library") package(default_visibility = ["//visibility:public"]) go_library( name = "unannotatedecho", srcs = [ "api_unannotated_echo_service.go", "client.go", "configuration.go", "model_examplepb_numeric_enum.go", "model_examplepb_unannotated_embedded.go", "model_examplepb_unannotated_nested_message.go", "model_examplepb_unannotated_simple_message.go", "model_protobuf_any.go", "model_rpc_status.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/unannotatedecho", deps = [ "@com_github_antihax_optional//:optional", "@org_golang_x_oauth2//:oauth2", ], ) alias( name = "go_default_library", actual = ":unannotatedecho", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/api/000077500000000000000000000000001465037340600327075ustar00rootroot00000000000000swagger.yaml000066400000000000000000000346641465037340600351700ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/api--- swagger: "2.0" info: description: "Unannotated Echo Service\nSimilar to echo_service.proto but without\ \ annotations. See\nunannotated_echo_service.yaml for the equivalent of the annotations\ \ in\ngRPC API configuration format.\n\nEcho Service API consists of a single\ \ service which returns\na message." version: "1.0" title: "Unannotated Echo" contact: name: "gRPC-Gateway project" url: "https://github.com/grpc-ecosystem/grpc-gateway" email: "none@example.com" license: name: "BSD 3-Clause License" url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE" x-something-something: "yadda" tags: - name: "Echo" description: "Echo description" - name: "Internal" description: "Internal description" x-traitTag: true - name: "UnannotatedEchoService" description: "UnannotatedEchoService description -- which should not be used in\ \ place of the documentation comment!" externalDocs: description: "Find out more about UnannotatedEchoService" url: "https://github.com/grpc-ecosystem/grpc-gateway" schemes: - "http" - "https" - "wss" consumes: - "application/json" - "application/x-foo-mime" produces: - "application/json" - "application/x-foo-mime" security: - ApiKeyAuth: [] BasicAuth: [] - ApiKeyAuth: [] OAuth2: - "read" - "write" paths: /v1/example/echo/{id}: post: tags: - "UnannotatedEchoService" summary: "Summary: Echo rpc" description: "Description Echo" operationId: "UnannotatedEchoService_Echo" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "num" in: "query" description: "Int value field" required: true type: "string" default: "42" format: "int64" x-exportParamName: "Num" - name: "duration" in: "query" required: false type: "string" x-exportParamName: "Duration" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." examples: application/json: value: "the input value" schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "integer" format: "integer" 503: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" /v1/example/echo/{id}/{num}: get: tags: - "UnannotatedEchoService" summary: "Summary: Echo rpc" description: "Description Echo" operationId: "UnannotatedEchoService_Echo2" parameters: - name: "id" in: "path" description: "Id represents the message identifier." required: true type: "string" x-exportParamName: "Id" - name: "num" in: "path" description: "Int value field" required: true type: "string" default: "42" format: "int64" x-exportParamName: "Num" - name: "duration" in: "query" required: false type: "string" x-exportParamName: "Duration" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." examples: application/json: value: "the input value" schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "integer" format: "integer" 503: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" /v1/example/echo_body: post: tags: - "UnannotatedEchoService" summary: "EchoBody method receives a simple message and returns it." operationId: "UnannotatedEchoService_EchoBody" parameters: - in: "body" name: "body" description: "A simple message with many types" required: true schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" x-exportParamName: "Body" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" /v1/example/echo_delete: delete: tags: - "UnannotatedEchoService" summary: "EchoDelete method receives a simple message and returns it." operationId: "UnannotatedEchoService_EchoDelete" parameters: - name: "id" in: "query" description: "Id represents the message identifier." required: false type: "string" x-exportParamName: "Id" x-optionalDataType: "String" - name: "num" in: "query" description: "Int value field" required: true type: "string" default: "42" format: "int64" x-exportParamName: "Num" - name: "duration" in: "query" required: false type: "string" x-exportParamName: "Duration" x-optionalDataType: "String" - name: "lineNum" in: "query" required: false type: "string" format: "int64" x-exportParamName: "LineNum" x-optionalDataType: "String" - name: "lang" in: "query" required: false type: "string" x-exportParamName: "Lang" x-optionalDataType: "String" - name: "status.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "StatusProgress" x-optionalDataType: "String" - name: "status.note" in: "query" required: false type: "string" x-exportParamName: "StatusNote" x-optionalDataType: "String" - name: "en" in: "query" required: false type: "string" format: "int64" x-exportParamName: "En" x-optionalDataType: "String" - name: "no.progress" in: "query" required: false type: "string" format: "int64" x-exportParamName: "NoProgress" x-optionalDataType: "String" - name: "no.note" in: "query" required: false type: "string" x-exportParamName: "NoNote" x-optionalDataType: "String" - name: "resourceId" in: "query" required: false type: "string" x-exportParamName: "ResourceId" x-optionalDataType: "String" - name: "nId.nId" in: "query" required: false type: "string" x-exportParamName: "NIdNId" x-optionalDataType: "String" - name: "nId.val" in: "query" required: false type: "string" x-exportParamName: "NIdVal" x-optionalDataType: "String" responses: 200: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" 403: description: "Returned when the user does not have permission to access\ \ the resource." schema: {} 404: description: "Returned when the resource does not exist." schema: type: "string" format: "string" default: description: "An unexpected error response." schema: $ref: "#/definitions/rpcStatus" securityDefinitions: ApiKeyAuth: type: "apiKey" name: "X-API-Key" in: "header" x-amazon-apigateway-authorizer: authorizerResultTtlInSeconds: 60 type: "token" x-amazon-apigateway-authtype: "oauth2" BasicAuth: type: "basic" definitions: examplepbUnannotatedEmbedded: type: "object" properties: progress: type: "string" format: "int64" note: type: "string" description: "Embedded represents a message embedded in SimpleMessage." examplepbUnannotatedNestedMessage: type: "object" properties: nId: type: "string" val: type: "string" examplepbUnannotatedSimpleMessage: type: "object" required: - "id" - "num" properties: id: type: "string" description: "Id represents the message identifier." num: type: "string" format: "int64" description: "Int value field" default: "42" duration: type: "string" lineNum: type: "string" format: "int64" lang: type: "string" status: $ref: "#/definitions/examplepbUnannotatedEmbedded" en: type: "string" format: "int64" "no": $ref: "#/definitions/examplepbUnannotatedEmbedded" resourceId: type: "string" nId: $ref: "#/definitions/examplepbUnannotatedNestedMessage" externalDocs: description: "Find out more about UnannotatedSimpleMessage" url: "https://github.com/grpc-ecosystem/grpc-gateway" title: "A bit of everything" description: "A simple message with many types" example: id: "myid" protobufAny: type: "object" properties: '@type': type: "string" additionalProperties: {} rpcStatus: type: "object" properties: code: type: "integer" format: "int32" message: type: "string" details: type: "array" items: $ref: "#/definitions/protobufAny" externalDocs: description: "More about gRPC-Gateway" url: "https://github.com/grpc-ecosystem/grpc-gateway" x-grpc-gateway-baz-list: - "one" - true x-grpc-gateway-foo: "bar" api_unannotated_echo_service.go000066400000000000000000000677511465037340600403150ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho import ( "context" "io/ioutil" "net/http" "net/url" "strings" "fmt" "github.com/antihax/optional" ) // Linger please var ( _ context.Context ) type UnannotatedEchoServiceApiService service /* UnannotatedEchoServiceApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num Int value field * @param optional nil or *UnannotatedEchoServiceEchoOpts - Optional Parameters: * @param "Duration" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbUnannotatedSimpleMessage */ type UnannotatedEchoServiceEchoOpts struct { Duration optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEcho(ctx context.Context, id string, num string, localVarOptionals *UnannotatedEchoServiceEchoOpts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbUnannotatedSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} localVarQueryParams.Add("num", parameterToString(num, "")) if localVarOptionals != nil && localVarOptionals.Duration.IsSet() { localVarQueryParams.Add("duration", parameterToString(localVarOptionals.Duration.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbUnannotatedSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v int32 err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 503 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* UnannotatedEchoServiceApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num Int value field * @param optional nil or *UnannotatedEchoServiceEcho2Opts - Optional Parameters: * @param "Duration" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbUnannotatedSimpleMessage */ type UnannotatedEchoServiceEcho2Opts struct { Duration optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEcho2(ctx context.Context, id string, num string, localVarOptionals *UnannotatedEchoServiceEcho2Opts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbUnannotatedSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Duration.IsSet() { localVarQueryParams.Add("duration", parameterToString(localVarOptionals.Duration.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbUnannotatedSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v int32 err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 503 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* UnannotatedEchoServiceApiService EchoBody method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body A simple message with many types @return ExamplepbUnannotatedSimpleMessage */ func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEchoBody(ctx context.Context, body ExamplepbUnannotatedSimpleMessage) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbUnannotatedSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_body" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbUnannotatedSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } /* UnannotatedEchoServiceApiService EchoDelete method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param num Int value field * @param optional nil or *UnannotatedEchoServiceEchoDeleteOpts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Duration" (optional.String) - * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - * @param "En" (optional.String) - * @param "NoProgress" (optional.String) - * @param "NoNote" (optional.String) - * @param "ResourceId" (optional.String) - * @param "NIdNId" (optional.String) - * @param "NIdVal" (optional.String) - @return ExamplepbUnannotatedSimpleMessage */ type UnannotatedEchoServiceEchoDeleteOpts struct { Id optional.String Duration optional.String LineNum optional.String Lang optional.String StatusProgress optional.String StatusNote optional.String En optional.String NoProgress optional.String NoNote optional.String ResourceId optional.String NIdNId optional.String NIdVal optional.String } func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEchoDelete(ctx context.Context, num string, localVarOptionals *UnannotatedEchoServiceEchoDeleteOpts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue ExamplepbUnannotatedSimpleMessage ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v1/example/echo_delete" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if localVarOptionals != nil && localVarOptionals.Id.IsSet() { localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) } localVarQueryParams.Add("num", parameterToString(num, "")) if localVarOptionals != nil && localVarOptionals.Duration.IsSet() { localVarQueryParams.Add("duration", parameterToString(localVarOptionals.Duration.Value(), "")) } if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { localVarQueryParams.Add("lineNum", parameterToString(localVarOptionals.LineNum.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.En.IsSet() { localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) } if localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() { localVarQueryParams.Add("resourceId", parameterToString(localVarOptionals.ResourceId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdNId.IsSet() { localVarQueryParams.Add("nId.nId", parameterToString(localVarOptionals.NIdNId.Value(), "")) } if localVarOptionals != nil && localVarOptionals.NIdVal.IsSet() { localVarQueryParams.Add("nId.val", parameterToString(localVarOptionals.NIdVal.Value(), "")) } // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ExamplepbUnannotatedSimpleMessage err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RpcStatus err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/client.go000066400000000000000000000264141465037340600337520ustar00rootroot00000000000000/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho import ( "bytes" "context" "encoding/json" "encoding/xml" "errors" "fmt" "io" "mime/multipart" "net/http" "net/url" "os" "path/filepath" "reflect" "regexp" "strconv" "strings" "time" "unicode/utf8" "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) // APIClient manages communication with the Unannotated Echo API v1.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services UnannotatedEchoServiceApi *UnannotatedEchoServiceApiService } type service struct { client *APIClient } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.UnannotatedEchoServiceApi = (*UnannotatedEchoServiceApiService)(&c.common) return c } func atoi(in string) (int, error) { return strconv.Atoi(in) } // selectHeaderContentType select a content type from the available list. func selectHeaderContentType(contentTypes []string) string { if len(contentTypes) == 0 { return "" } if contains(contentTypes, "application/json") { return "application/json" } return contentTypes[0] // use the first content type specified in 'consumes' } // selectHeaderAccept join all accept types and return func selectHeaderAccept(accepts []string) string { if len(accepts) == 0 { return "" } if contains(accepts, "application/json") { return "application/json" } return strings.Join(accepts, ",") } // contains is a case insenstive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { if strings.ToLower(a) == strings.ToLower(needle) { return true } } return false } // Verify optional parameters are of the correct type. func typeCheckParameter(obj interface{}, expected string, name string) error { // Make sure there is an object. if obj == nil { return nil } // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) } return nil } // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { var delimiter string switch collectionFormat { case "pipes": delimiter = "|" case "ssv": delimiter = " " case "tsv": delimiter = "\t" case "csv": delimiter = "," } if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") } return fmt.Sprintf("%v", obj) } // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { return c.cfg.HTTPClient.Do(request) } // Change base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { var body *bytes.Buffer // Detect postBody type and post. if postBody != nil { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) headerParams["Content-Type"] = contentType } body, err = setBody(postBody, contentType) if err != nil { return nil, err } } // add form parameters and file if available. if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } body = &bytes.Buffer{} w := multipart.NewWriter(body) for k, v := range formParams { for _, iv := range v { if strings.HasPrefix(k, "@") { // file err = addFile(w, k[1:], iv) if err != nil { return nil, err } } else { // form value w.WriteField(k, iv) } } } if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) part, err := w.CreateFormFile("file", filepath.Base(fileName)) if err != nil { return nil, err } _, err = part.Write(fileBytes) if err != nil { return nil, err } // Set the Boundary in the Content-Type headerParams["Content-Type"] = w.FormDataContentType() } // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() } // Setup path and query parameters url, err := url.Parse(path) if err != nil { return nil, err } // Adding Query Param query := url.Query() for k, v := range queryParams { for _, iv := range v { query.Add(k, iv) } } // Encode the parameters. url.RawQuery = query.Encode() // Generate a new request if body != nil { localVarRequest, err = http.NewRequest(method, url.String(), body) } else { localVarRequest, err = http.NewRequest(method, url.String(), nil) } if err != nil { return nil, err } // add header parameters, if any if len(headerParams) > 0 { headers := http.Header{} for h, v := range headerParams { headers.Set(h, v) } localVarRequest.Header = headers } // Override request host, if applicable if c.cfg.Host != "" { localVarRequest.Host = c.cfg.Host } // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) if ctx != nil { // add context to the request localVarRequest = localVarRequest.WithContext(ctx) // Walk through any authentication. // OAuth2 authentication if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { return nil, err } latestToken.SetAuthHeader(localVarRequest) } // Basic HTTP Authentication if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } return localVarRequest, nil } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/xml") { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } else if strings.Contains(contentType, "application/json") { if err = json.Unmarshal(b, v); err != nil { return err } return nil } return errors.New("undefined response type") } // Add a file to the multipart request func addFile(w *multipart.Writer, fieldName, path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { return err } _, err = io.Copy(part, file) return err } // Prevent trying to import "fmt" func reportError(format string, a ...interface{}) error { return fmt.Errorf(format, a...) } // Set request body from an interface{} func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { if bodyBuf == nil { bodyBuf = &bytes.Buffer{} } if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { return nil, err } if bodyBuf.Len() == 0 { err = fmt.Errorf("Invalid body type %s\n", contentType) return nil, err } return bodyBuf, nil } // detectContentType method is used to figure out `Request.Body` content type for request header func detectContentType(body interface{}) string { contentType := "text/plain; charset=utf-8" kind := reflect.TypeOf(body).Kind() switch kind { case reflect.Struct, reflect.Map, reflect.Ptr: contentType = "application/json; charset=utf-8" case reflect.String: contentType = "text/plain; charset=utf-8" default: if b, ok := body.([]byte); ok { contentType = http.DetectContentType(b) } else if kind == reflect.Slice { contentType = "application/json; charset=utf-8" } } return contentType } // Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go type cacheControl map[string]string func parseCacheControl(headers http.Header) cacheControl { cc := cacheControl{} ccHeader := headers.Get("Cache-Control") for _, part := range strings.Split(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue } if strings.ContainsRune(part, '=') { keyval := strings.Split(part, "=") cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") } else { cc[part] = "" } } return cc } // CacheExpires helper function to determine remaining time before repeating a request. func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time now, err := time.Parse(time.RFC1123, r.Header.Get("date")) if err != nil { return time.Now() } respCacheControl := parseCacheControl(r.Header) if maxAge, ok := respCacheControl["max-age"]; ok { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now } expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { expires, err = time.Parse(time.RFC1123, expiresHeader) if err != nil { expires = now } } } return expires } func strlen(s string) int { return utf8.RuneCountInString(s) } // GenericSwaggerError Provides access to the body, error and model on returned errors. type GenericSwaggerError struct { body []byte error string model interface{} } // Error returns non-empty string if there was an error. func (e GenericSwaggerError) Error() string { return e.error } // Body returns the raw bytes of the response func (e GenericSwaggerError) Body() []byte { return e.body } // Model returns the unpacked model of the error func (e GenericSwaggerError) Model() interface{} { return e.model }configuration.go000066400000000000000000000044121465037340600352560ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho import ( "net/http" ) // contextKeys are used to identify the type of value in the context. // Since these are string, it is possible to get a short description of the // context key for logging and debugging using key.String(). type contextKey string func (c contextKey) String() string { return "auth " + string(c) } var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` } // APIKey provides API key based authentication to a request passed via context using ContextAPIKey type APIKey struct { Key string Prefix string } type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } return cfg } func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } model_examplepb_numeric_enum.go000066400000000000000000000013431465037340600403120ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho // ExamplepbNumericEnum : NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1 type ExamplepbNumericEnum string // List of examplepbNumericEnum const ( ZERO_ExamplepbNumericEnum ExamplepbNumericEnum = "ZERO" ONE_ExamplepbNumericEnum ExamplepbNumericEnum = "ONE" ) model_examplepb_unannotated_embedded.go000066400000000000000000000012021465037340600417470ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho // Embedded represents a message embedded in SimpleMessage. type ExamplepbUnannotatedEmbedded struct { Progress string `json:"progress,omitempty"` Note string `json:"note,omitempty"` } model_examplepb_unannotated_nested_message.go000066400000000000000000000010771465037340600432160ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho type ExamplepbUnannotatedNestedMessage struct { NId string `json:"nId,omitempty"` Val string `json:"val,omitempty"` } model_examplepb_unannotated_simple_message.go000066400000000000000000000020211465037340600432130ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho // A simple message with many types type ExamplepbUnannotatedSimpleMessage struct { // Id represents the message identifier. Id string `json:"id"` // Int value field Num string `json:"num"` Duration string `json:"duration,omitempty"` LineNum string `json:"lineNum,omitempty"` Lang string `json:"lang,omitempty"` Status *ExamplepbUnannotatedEmbedded `json:"status,omitempty"` En string `json:"en,omitempty"` No *ExamplepbUnannotatedEmbedded `json:"no,omitempty"` ResourceId string `json:"resourceId,omitempty"` NId *ExamplepbUnannotatedNestedMessage `json:"nId,omitempty"` } model_protobuf_any.go000066400000000000000000000010121465037340600362670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho type ProtobufAny struct { Type_ string `json:"@type,omitempty"` } model_rpc_status.go000066400000000000000000000011421465037340600357530ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho type RpcStatus struct { Code int32 `json:"code,omitempty"` Message string `json:"message,omitempty"` Details []ProtobufAny `json:"details,omitempty"` } response.go000066400000000000000000000026721465037340600342530ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/clients/unannotatedecho/* * Unannotated Echo * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho import ( "net/http" ) type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage} return response } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/000077500000000000000000000000001465037340600260615ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-gateway-server/000077500000000000000000000000001465037340600324575ustar00rootroot00000000000000BUILD.bazel000066400000000000000000000010311465037340600342510ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-gateway-serverload("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "example-gateway-server_lib", srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-gateway-server", visibility = ["//visibility:private"], deps = [ "//examples/internal/gateway", "@org_golang_google_grpc//grpclog", ], ) go_binary( name = "example-gateway-server", embed = [":example-gateway-server_lib"], visibility = ["//visibility:public"], ) main.go000066400000000000000000000016111465037340600336520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-gateway-server/* Command example-gateway-server is an example reverse-proxy implementation whose HTTP handler is generated by grpc-gateway. */ package main import ( "context" "flag" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway" "google.golang.org/grpc/grpclog" ) var ( endpoint = flag.String("endpoint", "localhost:9090", "endpoint of the gRPC service") network = flag.String("network", "tcp", `one of "tcp" or "unix". Must be consistent to -endpoint`) openAPIDir = flag.String("openapi_dir", "examples/internal/proto/examplepb", "path to the directory which contains OpenAPI definitions") ) func main() { flag.Parse() ctx := context.Background() opts := gateway.Options{ Addr: ":8080", GRPCServer: gateway.Endpoint{ Network: *network, Addr: *endpoint, }, OpenAPIDir: *openAPIDir, } if err := gateway.Run(ctx, opts); err != nil { grpclog.Fatal(err) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-grpc-server/000077500000000000000000000000001465037340600317515ustar00rootroot00000000000000BUILD.bazel000066400000000000000000000010241465037340600335450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-grpc-serverload("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//visibility:private"]) go_library( name = "example-grpc-server_lib", srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-grpc-server", deps = [ "//examples/internal/server", "@org_golang_google_grpc//grpclog", ], ) go_binary( name = "example-server", embed = [":example-grpc-server_lib"], visibility = ["//visibility:public"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/cmd/example-grpc-server/main.go000066400000000000000000000010671465037340600332300ustar00rootroot00000000000000/* Command example-grpc-server is an example grpc server to be called by example-gateway-server. */ package main import ( "context" "flag" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server" "google.golang.org/grpc/grpclog" ) var ( addr = flag.String("addr", ":9090", "endpoint of the gRPC service") network = flag.String("network", "tcp", "a valid network type which is consistent to -addr") ) func main() { flag.Parse() ctx := context.Background() if err := server.Run(ctx, *network, *addr); err != nil { grpclog.Fatal(err) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/000077500000000000000000000000001465037340600267575ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/BUILD.bazel000066400000000000000000000015171465037340600306410ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "gateway", srcs = [ "doc.go", "gateway.go", "handlers.go", "main.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway", visibility = ["//visibility:public"], deps = [ "//examples/internal/proto/examplepb", "//examples/internal/proto/standalone", "//runtime", "@org_golang_google_genproto_googleapis_rpc//errdetails", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//connectivity", "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//grpclog", ], ) alias( name = "go_default_library", actual = ":gateway", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/doc.go000066400000000000000000000001101465037340600300430ustar00rootroot00000000000000// Package gateway is an example of gRPC-Gateway server package gateway golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/gateway.go000066400000000000000000000040211465037340600307440ustar00rootroot00000000000000package gateway import ( "context" "fmt" "net" "net/http" "google.golang.org/grpc/credentials/insecure" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" standalone "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/standalone" gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" _ "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" ) // newGateway returns a new gateway server which translates HTTP into gRPC. func newGateway(ctx context.Context, conn *grpc.ClientConn, opts []gwruntime.ServeMuxOption) (http.Handler, error) { mux := gwruntime.NewServeMux(opts...) for _, f := range []func(context.Context, *gwruntime.ServeMux, *grpc.ClientConn) error{ examplepb.RegisterEchoServiceHandler, standalone.RegisterUnannotatedEchoServiceHandler, examplepb.RegisterStreamServiceHandler, examplepb.RegisterABitOfEverythingServiceHandler, examplepb.RegisterFlowCombinationHandler, examplepb.RegisterNonStandardServiceHandler, examplepb.RegisterResponseBodyServiceHandler, } { if err := f(ctx, mux, conn); err != nil { return nil, err } } return mux, nil } func dial(network, addr string) (*grpc.ClientConn, error) { switch network { case "tcp": return dialTCP(addr) case "unix": return dialUnix(addr) default: return nil, fmt.Errorf("unsupported network type %q", network) } } // dialTCP creates a client connection via TCP. // "addr" must be a valid TCP address with a port number. func dialTCP(addr string) (*grpc.ClientConn, error) { return grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) } // dialUnix creates a client connection via a unix domain socket. // "addr" must be a valid path to the socket. func dialUnix(addr string) (*grpc.ClientConn, error) { d := func(ctx context.Context, addr string) (net.Conn, error) { return (&net.Dialer{}).DialContext(ctx, "unix", addr) } return grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(d)) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/handlers.go000066400000000000000000000066451465037340600311210ustar00rootroot00000000000000package gateway import ( "bytes" "fmt" "io" "net/http" "path" "strings" "google.golang.org/grpc" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" ) // openAPIServer returns OpenAPI specification files located under "/openapiv2/" func openAPIServer(dir string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if !strings.HasSuffix(r.URL.Path, ".swagger.json") { grpclog.Errorf("Not Found: %s", r.URL.Path) http.NotFound(w, r) return } grpclog.Infof("Serving %s", r.URL.Path) p := strings.TrimPrefix(r.URL.Path, "/openapiv2/") p = path.Join(dir, p) http.ServeFile(w, r, p) } } // allowCORS allows Cross Origin Resource Sharing from any origin. // Don't do this without consideration in production systems. func allowCORS(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if origin := r.Header.Get("Origin"); origin != "" { w.Header().Set("Access-Control-Allow-Origin", origin) if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" { preflightHandler(w, r) return } } h.ServeHTTP(w, r) }) } // preflightHandler adds the necessary headers in order to serve // CORS from any origin using the methods "GET", "HEAD", "POST", "PUT", "DELETE" // We insist, don't do this without consideration in production systems. func preflightHandler(w http.ResponseWriter, r *http.Request) { headers := []string{"Content-Type", "Accept", "Authorization"} w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",")) grpclog.Infof("Preflight request for %s", r.URL.Path) } // healthzServer returns a simple health handler which returns ok. func healthzServer(conn *grpc.ClientConn) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") if s := conn.GetState(); s != connectivity.Ready { http.Error(w, fmt.Sprintf("grpc server is %s", s), http.StatusBadGateway) return } fmt.Fprintln(w, "ok") } } type logResponseWriter struct { http.ResponseWriter statusCode int } func (rsp *logResponseWriter) WriteHeader(code int) { rsp.statusCode = code rsp.ResponseWriter.WriteHeader(code) } // Unwrap returns the original http.ResponseWriter. This is necessary // to expose Flush() and Push() on the underlying response writer. func (rsp *logResponseWriter) Unwrap() http.ResponseWriter { return rsp.ResponseWriter } func newLogResponseWriter(w http.ResponseWriter) *logResponseWriter { return &logResponseWriter{w, http.StatusOK} } // logRequestBody logs the request body when the response status code is not 200. // This addresses the issue of being unable to retrieve the request body in the customErrorHandler middleware. func logRequestBody(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { lw := newLogResponseWriter(w) body, err := io.ReadAll(r.Body) if err != nil { http.Error(w, fmt.Sprintf("grpc server read request body err %+v", err), http.StatusBadRequest) return } clonedR := r.Clone(r.Context()) clonedR.Body = io.NopCloser(bytes.NewReader(body)) h.ServeHTTP(lw, clonedR) if lw.statusCode != http.StatusOK { grpclog.Errorf("http error %+v request body %+v", lw.statusCode, string(body)) } }) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/gateway/main.go000066400000000000000000000035251465037340600302370ustar00rootroot00000000000000package gateway import ( "context" "net/http" gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc/grpclog" ) // Endpoint describes a gRPC endpoint type Endpoint struct { Network, Addr string } // Options is a set of options to be passed to Run type Options struct { // Addr is the address to listen Addr string // GRPCServer defines an endpoint of a gRPC service GRPCServer Endpoint // OpenAPIDir is a path to a directory from which the server // serves OpenAPI specs. OpenAPIDir string // Mux is a list of options to be passed to the gRPC-Gateway multiplexer Mux []gwruntime.ServeMuxOption } // Run starts a HTTP server and blocks while running if successful. // The server will be shutdown when "ctx" is canceled. func Run(ctx context.Context, opts Options) error { ctx, cancel := context.WithCancel(ctx) defer cancel() conn, err := dial(opts.GRPCServer.Network, opts.GRPCServer.Addr) if err != nil { return err } go func() { <-ctx.Done() if err := conn.Close(); err != nil { grpclog.Errorf("Failed to close a client connection to the gRPC server: %v", err) } }() mux := http.NewServeMux() mux.HandleFunc("/openapiv2/", openAPIServer(opts.OpenAPIDir)) mux.HandleFunc("/healthz", healthzServer(conn)) gw, err := newGateway(ctx, conn, opts.Mux) if err != nil { return err } mux.Handle("/", gw) s := &http.Server{ Addr: opts.Addr, Handler: logRequestBody(allowCORS(mux)), } go func() { <-ctx.Done() grpclog.Infof("Shutting down the http server") if err := s.Shutdown(context.Background()); err != nil { grpclog.Errorf("Failed to shutdown http server: %v", err) } }() grpclog.Infof("Starting listening at %s", opts.Addr) if err := s.ListenAndServe(); err != http.ErrServerClosed { grpclog.Errorf("Failed to listen and serve: %v", err) return err } return nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/000077500000000000000000000000001465037340600274715ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/BUILD.bazel000066400000000000000000000025261465037340600313540ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") # gazelle:exclude helloworld.pb.gw.go # gazelle:exclude helloworld_grpc.pb.go # gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc, //protoc-gen-grpc-gateway:go_gen_grpc_gateway proto_library( name = "helloworld_proto", srcs = ["helloworld.proto"], visibility = ["//visibility:public"], deps = [ "@com_google_protobuf//:wrappers_proto", "@googleapis//google/api:annotations_proto", ], ) go_proto_library( name = "helloworld_go_proto", compilers = [ "//:go_apiv2", "//:go_grpc", "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld", proto = ":helloworld_proto", visibility = ["//visibility:public"], deps = [ "@org_golang_google_genproto_googleapis_api//annotations", ], ) go_library( name = "helloworld", embed = [":helloworld_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld", visibility = ["//examples:__subpackages__"], ) alias( name = "go_default_library", actual = ":helloworld", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/helloworld.pb.go000066400000000000000000000425131465037340600326000ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/helloworld/helloworld.proto package helloworld import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 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 HelloRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` StrVal *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=strVal,proto3" json:"strVal,omitempty"` FloatVal *wrapperspb.FloatValue `protobuf:"bytes,3,opt,name=floatVal,proto3" json:"floatVal,omitempty"` DoubleVal *wrapperspb.DoubleValue `protobuf:"bytes,4,opt,name=doubleVal,proto3" json:"doubleVal,omitempty"` BoolVal *wrapperspb.BoolValue `protobuf:"bytes,5,opt,name=boolVal,proto3" json:"boolVal,omitempty"` BytesVal *wrapperspb.BytesValue `protobuf:"bytes,6,opt,name=bytesVal,proto3" json:"bytesVal,omitempty"` Int32Val *wrapperspb.Int32Value `protobuf:"bytes,7,opt,name=int32Val,proto3" json:"int32Val,omitempty"` Uint32Val *wrapperspb.UInt32Value `protobuf:"bytes,8,opt,name=uint32Val,proto3" json:"uint32Val,omitempty"` Int64Val *wrapperspb.Int64Value `protobuf:"bytes,9,opt,name=int64Val,proto3" json:"int64Val,omitempty"` Uint64Val *wrapperspb.UInt64Value `protobuf:"bytes,10,opt,name=uint64Val,proto3" json:"uint64Val,omitempty"` } func (x *HelloRequest) Reset() { *x = HelloRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_helloworld_helloworld_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HelloRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*HelloRequest) ProtoMessage() {} func (x *HelloRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_helloworld_helloworld_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 HelloRequest.ProtoReflect.Descriptor instead. func (*HelloRequest) Descriptor() ([]byte, []int) { return file_examples_internal_helloworld_helloworld_proto_rawDescGZIP(), []int{0} } func (x *HelloRequest) GetName() string { if x != nil { return x.Name } return "" } func (x *HelloRequest) GetStrVal() *wrapperspb.StringValue { if x != nil { return x.StrVal } return nil } func (x *HelloRequest) GetFloatVal() *wrapperspb.FloatValue { if x != nil { return x.FloatVal } return nil } func (x *HelloRequest) GetDoubleVal() *wrapperspb.DoubleValue { if x != nil { return x.DoubleVal } return nil } func (x *HelloRequest) GetBoolVal() *wrapperspb.BoolValue { if x != nil { return x.BoolVal } return nil } func (x *HelloRequest) GetBytesVal() *wrapperspb.BytesValue { if x != nil { return x.BytesVal } return nil } func (x *HelloRequest) GetInt32Val() *wrapperspb.Int32Value { if x != nil { return x.Int32Val } return nil } func (x *HelloRequest) GetUint32Val() *wrapperspb.UInt32Value { if x != nil { return x.Uint32Val } return nil } func (x *HelloRequest) GetInt64Val() *wrapperspb.Int64Value { if x != nil { return x.Int64Val } return nil } func (x *HelloRequest) GetUint64Val() *wrapperspb.UInt64Value { if x != nil { return x.Uint64Val } return nil } type HelloReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` } func (x *HelloReply) Reset() { *x = HelloReply{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_helloworld_helloworld_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HelloReply) String() string { return protoimpl.X.MessageStringOf(x) } func (*HelloReply) ProtoMessage() {} func (x *HelloReply) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_helloworld_helloworld_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 HelloReply.ProtoReflect.Descriptor instead. func (*HelloReply) Descriptor() ([]byte, []int) { return file_examples_internal_helloworld_helloworld_proto_rawDescGZIP(), []int{1} } func (x *HelloReply) GetMessage() string { if x != nil { return x.Message } return "" } var File_examples_internal_helloworld_helloworld_proto protoreflect.FileDescriptor var file_examples_internal_helloworld_helloworld_proto_rawDesc = []byte{ 0x0a, 0x2d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa6, 0x04, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x56, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x73, 0x74, 0x72, 0x56, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x12, 0x3a, 0x0a, 0x09, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x12, 0x34, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x08, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x12, 0x3a, 0x0a, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x12, 0x3a, 0x0a, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x22, 0x26, 0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x99, 0x03, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x12, 0x8d, 0x03, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x90, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x89, 0x02, 0x5a, 0x16, 0x12, 0x14, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x73, 0x74, 0x72, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1c, 0x12, 0x1a, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x18, 0x12, 0x16, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x62, 0x6f, 0x6f, 0x6c, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1c, 0x12, 0x1a, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x7d, 0x5a, 0x1c, 0x12, 0x1a, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x76, 0x61, 0x6c, 0x2f, 0x7b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x7d, 0x12, 0x0b, 0x2f, 0x73, 0x61, 0x79, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_helloworld_helloworld_proto_rawDescOnce sync.Once file_examples_internal_helloworld_helloworld_proto_rawDescData = file_examples_internal_helloworld_helloworld_proto_rawDesc ) func file_examples_internal_helloworld_helloworld_proto_rawDescGZIP() []byte { file_examples_internal_helloworld_helloworld_proto_rawDescOnce.Do(func() { file_examples_internal_helloworld_helloworld_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_helloworld_helloworld_proto_rawDescData) }) return file_examples_internal_helloworld_helloworld_proto_rawDescData } var file_examples_internal_helloworld_helloworld_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_examples_internal_helloworld_helloworld_proto_goTypes = []interface{}{ (*HelloRequest)(nil), // 0: grpc.gateway.examples.internal.helloworld.HelloRequest (*HelloReply)(nil), // 1: grpc.gateway.examples.internal.helloworld.HelloReply (*wrapperspb.StringValue)(nil), // 2: google.protobuf.StringValue (*wrapperspb.FloatValue)(nil), // 3: google.protobuf.FloatValue (*wrapperspb.DoubleValue)(nil), // 4: google.protobuf.DoubleValue (*wrapperspb.BoolValue)(nil), // 5: google.protobuf.BoolValue (*wrapperspb.BytesValue)(nil), // 6: google.protobuf.BytesValue (*wrapperspb.Int32Value)(nil), // 7: google.protobuf.Int32Value (*wrapperspb.UInt32Value)(nil), // 8: google.protobuf.UInt32Value (*wrapperspb.Int64Value)(nil), // 9: google.protobuf.Int64Value (*wrapperspb.UInt64Value)(nil), // 10: google.protobuf.UInt64Value } var file_examples_internal_helloworld_helloworld_proto_depIdxs = []int32{ 2, // 0: grpc.gateway.examples.internal.helloworld.HelloRequest.strVal:type_name -> google.protobuf.StringValue 3, // 1: grpc.gateway.examples.internal.helloworld.HelloRequest.floatVal:type_name -> google.protobuf.FloatValue 4, // 2: grpc.gateway.examples.internal.helloworld.HelloRequest.doubleVal:type_name -> google.protobuf.DoubleValue 5, // 3: grpc.gateway.examples.internal.helloworld.HelloRequest.boolVal:type_name -> google.protobuf.BoolValue 6, // 4: grpc.gateway.examples.internal.helloworld.HelloRequest.bytesVal:type_name -> google.protobuf.BytesValue 7, // 5: grpc.gateway.examples.internal.helloworld.HelloRequest.int32Val:type_name -> google.protobuf.Int32Value 8, // 6: grpc.gateway.examples.internal.helloworld.HelloRequest.uint32Val:type_name -> google.protobuf.UInt32Value 9, // 7: grpc.gateway.examples.internal.helloworld.HelloRequest.int64Val:type_name -> google.protobuf.Int64Value 10, // 8: grpc.gateway.examples.internal.helloworld.HelloRequest.uint64Val:type_name -> google.protobuf.UInt64Value 0, // 9: grpc.gateway.examples.internal.helloworld.Greeter.SayHello:input_type -> grpc.gateway.examples.internal.helloworld.HelloRequest 1, // 10: grpc.gateway.examples.internal.helloworld.Greeter.SayHello:output_type -> grpc.gateway.examples.internal.helloworld.HelloReply 10, // [10:11] is the sub-list for method output_type 9, // [9:10] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name 9, // [9:9] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name } func init() { file_examples_internal_helloworld_helloworld_proto_init() } func file_examples_internal_helloworld_helloworld_proto_init() { if File_examples_internal_helloworld_helloworld_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_helloworld_helloworld_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HelloRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_helloworld_helloworld_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HelloReply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_helloworld_helloworld_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_helloworld_helloworld_proto_goTypes, DependencyIndexes: file_examples_internal_helloworld_helloworld_proto_depIdxs, MessageInfos: file_examples_internal_helloworld_helloworld_proto_msgTypes, }.Build() File_examples_internal_helloworld_helloworld_proto = out.File file_examples_internal_helloworld_helloworld_proto_rawDesc = nil file_examples_internal_helloworld_helloworld_proto_goTypes = nil file_examples_internal_helloworld_helloworld_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/helloworld.pb.gw.go000066400000000000000000001433421465037340600332160ustar00rootroot00000000000000// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/helloworld/helloworld.proto /* Package helloworld is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package helloworld import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_Greeter_SayHello_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } protoReq.Name, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_0(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } protoReq.Name, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_1 = &utilities.DoubleArray{Encoding: map[string]int{"strVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_1(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["strVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "strVal") } protoReq.StrVal, err = runtime.StringValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "strVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_1(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["strVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "strVal") } protoReq.StrVal, err = runtime.StringValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "strVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_2 = &utilities.DoubleArray{Encoding: map[string]int{"floatVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_2(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["floatVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "floatVal") } protoReq.FloatVal, err = runtime.FloatValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "floatVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_2(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["floatVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "floatVal") } protoReq.FloatVal, err = runtime.FloatValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "floatVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_3 = &utilities.DoubleArray{Encoding: map[string]int{"doubleVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_3(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["doubleVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "doubleVal") } protoReq.DoubleVal, err = runtime.DoubleValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "doubleVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_3(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["doubleVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "doubleVal") } protoReq.DoubleVal, err = runtime.DoubleValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "doubleVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_4 = &utilities.DoubleArray{Encoding: map[string]int{"boolVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_4(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["boolVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "boolVal") } protoReq.BoolVal, err = runtime.BoolValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "boolVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_4(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["boolVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "boolVal") } protoReq.BoolVal, err = runtime.BoolValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "boolVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_5 = &utilities.DoubleArray{Encoding: map[string]int{"bytesVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_5(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["bytesVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bytesVal") } protoReq.BytesVal, err = runtime.BytesValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bytesVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_5(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["bytesVal"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bytesVal") } protoReq.BytesVal, err = runtime.BytesValue(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bytesVal", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_6 = &utilities.DoubleArray{Encoding: map[string]int{"int32Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_6(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["int32Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32Val") } protoReq.Int32Val, err = runtime.Int32Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_6(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["int32Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32Val") } protoReq.Int32Val, err = runtime.Int32Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_7 = &utilities.DoubleArray{Encoding: map[string]int{"uint32Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_7(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uint32Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32Val") } protoReq.Uint32Val, err = runtime.UInt32Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_7); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_7(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uint32Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32Val") } protoReq.Uint32Val, err = runtime.UInt32Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_7); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_8 = &utilities.DoubleArray{Encoding: map[string]int{"int64Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_8(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["int64Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64Val") } protoReq.Int64Val, err = runtime.Int64Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_8); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_8(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["int64Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64Val") } protoReq.Int64Val, err = runtime.Int64Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_8); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } var ( filter_Greeter_SayHello_9 = &utilities.DoubleArray{Encoding: map[string]int{"uint64Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Greeter_SayHello_9(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uint64Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64Val") } protoReq.Uint64Val, err = runtime.UInt64Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_9); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Greeter_SayHello_9(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq HelloRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uint64Val"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64Val") } protoReq.Uint64Val, err = runtime.UInt64Value(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64Val", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_9); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.SayHello(ctx, &protoReq) return msg, metadata, err } // RegisterGreeterHandlerServer registers the http handlers for service Greeter to "mux". // UnaryRPC :call GreeterServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGreeterHandlerFromEndpoint instead. func RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error { mux.Handle("GET", pattern_Greeter_SayHello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/strval/{strVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/floatval/{floatVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/doubleval/{doubleVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_3(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/boolval/{boolVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_4(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/bytesval/{bytesVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_5(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/int32val/{int32Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_6(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_7, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/uint32val/{uint32Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_7(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_7(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_8, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/int64val/{int64Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_8(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_8(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_9, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/uint64val/{uint64Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Greeter_SayHello_9(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_9(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterGreeterHandlerFromEndpoint is same as RegisterGreeterHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterGreeterHandler(ctx, mux, conn) } // RegisterGreeterHandler registers the http handlers for service Greeter to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterGreeterHandlerClient(ctx, mux, NewGreeterClient(conn)) } // RegisterGreeterHandlerClient registers the http handlers for service Greeter // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GreeterClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GreeterClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "GreeterClient" to call the correct interceptors. func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error { mux.Handle("GET", pattern_Greeter_SayHello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/strval/{strVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/floatval/{floatVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/doubleval/{doubleVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_3(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/boolval/{boolVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_4(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/bytesval/{bytesVal}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_5(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/int32val/{int32Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_6(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_7, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/uint32val/{uint32Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_7(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_7(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_8, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/int64val/{int64Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_8(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_8(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Greeter_SayHello_9, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", runtime.WithHTTPPathPattern("/say/uint64val/{uint64Val}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Greeter_SayHello_9(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Greeter_SayHello_9(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_Greeter_SayHello_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"say", "name"}, "")) pattern_Greeter_SayHello_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "strval", "strVal"}, "")) pattern_Greeter_SayHello_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "floatval", "floatVal"}, "")) pattern_Greeter_SayHello_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "doubleval", "doubleVal"}, "")) pattern_Greeter_SayHello_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "boolval", "boolVal"}, "")) pattern_Greeter_SayHello_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "bytesval", "bytesVal"}, "")) pattern_Greeter_SayHello_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "int32val", "int32Val"}, "")) pattern_Greeter_SayHello_7 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "uint32val", "uint32Val"}, "")) pattern_Greeter_SayHello_8 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "int64val", "int64Val"}, "")) pattern_Greeter_SayHello_9 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "uint64val", "uint64Val"}, "")) ) var ( forward_Greeter_SayHello_0 = runtime.ForwardResponseMessage forward_Greeter_SayHello_1 = runtime.ForwardResponseMessage forward_Greeter_SayHello_2 = runtime.ForwardResponseMessage forward_Greeter_SayHello_3 = runtime.ForwardResponseMessage forward_Greeter_SayHello_4 = runtime.ForwardResponseMessage forward_Greeter_SayHello_5 = runtime.ForwardResponseMessage forward_Greeter_SayHello_6 = runtime.ForwardResponseMessage forward_Greeter_SayHello_7 = runtime.ForwardResponseMessage forward_Greeter_SayHello_8 = runtime.ForwardResponseMessage forward_Greeter_SayHello_9 = runtime.ForwardResponseMessage ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/helloworld.proto000066400000000000000000000026141465037340600327340ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.helloworld; import "google/api/annotations.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld"; service Greeter { rpc SayHello(HelloRequest) returns (HelloReply) { option (google.api.http) = { get: "/say/{name}" additional_bindings: {get: "/say/strval/{strVal}"} additional_bindings: {get: "/say/floatval/{floatVal}"} additional_bindings: {get: "/say/doubleval/{doubleVal}"} additional_bindings: {get: "/say/boolval/{boolVal}"} additional_bindings: {get: "/say/bytesval/{bytesVal}"} additional_bindings: {get: "/say/int32val/{int32Val}"} additional_bindings: {get: "/say/uint32val/{uint32Val}"} additional_bindings: {get: "/say/int64val/{int64Val}"} additional_bindings: {get: "/say/uint64val/{uint64Val}"} }; } } message HelloRequest { string name = 1; google.protobuf.StringValue strVal = 2; google.protobuf.FloatValue floatVal = 3; google.protobuf.DoubleValue doubleVal = 4; google.protobuf.BoolValue boolVal = 5; google.protobuf.BytesValue bytesVal = 6; google.protobuf.Int32Value int32Val = 7; google.protobuf.UInt32Value uint32Val = 8; google.protobuf.Int64Value int64Val = 9; google.protobuf.UInt64Value uint64Val = 10; } message HelloReply { string message = 1; } helloworld.swagger.json000066400000000000000000000556161465037340600341330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld{ "swagger": "2.0", "info": { "title": "examples/internal/helloworld/helloworld.proto", "version": "version not set" }, "tags": [ { "name": "Greeter" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/say/boolval/{boolVal}": { "get": { "operationId": "Greeter_SayHello5", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "boolVal", "in": "path", "required": true, "type": "boolean" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/bytesval/{bytesVal}": { "get": { "operationId": "Greeter_SayHello6", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "bytesVal", "in": "path", "required": true, "type": "string", "format": "byte" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/doubleval/{doubleVal}": { "get": { "operationId": "Greeter_SayHello4", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "doubleVal", "in": "path", "required": true, "type": "number", "format": "double" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/floatval/{floatVal}": { "get": { "operationId": "Greeter_SayHello3", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "floatVal", "in": "path", "required": true, "type": "number", "format": "float" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/int32val/{int32Val}": { "get": { "operationId": "Greeter_SayHello7", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "int32Val", "in": "path", "required": true, "type": "integer", "format": "int32" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/int64val/{int64Val}": { "get": { "operationId": "Greeter_SayHello9", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "int64Val", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/strval/{strVal}": { "get": { "operationId": "Greeter_SayHello2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "strVal", "in": "path", "required": true, "type": "string" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/uint32val/{uint32Val}": { "get": { "operationId": "Greeter_SayHello8", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uint32Val", "in": "path", "required": true, "type": "integer", "format": "int64" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } }, "/say/uint64val/{uint64Val}": { "get": { "operationId": "Greeter_SayHello10", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uint64Val", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "name", "in": "query", "required": false, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" } ], "tags": [ "Greeter" ] } }, "/say/{name}": { "get": { "operationId": "Greeter_SayHello", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/helloworldHelloReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "name", "in": "path", "required": true, "type": "string" }, { "name": "strVal", "in": "query", "required": false, "type": "string" }, { "name": "floatVal", "in": "query", "required": false, "type": "number", "format": "float" }, { "name": "doubleVal", "in": "query", "required": false, "type": "number", "format": "double" }, { "name": "boolVal", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesVal", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "int32Val", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "uint32Val", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64Val", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "uint64Val", "in": "query", "required": false, "type": "string", "format": "uint64" } ], "tags": [ "Greeter" ] } } }, "definitions": { "helloworldHelloReply": { "type": "object", "properties": { "message": { "type": "string" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/helloworld/helloworld_grpc.pb.go000066400000000000000000000067221465037340600336150ustar00rootroot00000000000000// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/helloworld/helloworld.proto package helloworld import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // GreeterClient is the client API for Greeter service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type GreeterClient interface { SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) } type greeterClient struct { cc grpc.ClientConnInterface } func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient { return &greeterClient{cc} } func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { out := new(HelloReply) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", in, out, opts...) if err != nil { return nil, err } return out, nil } // GreeterServer is the server API for Greeter service. // All implementations should embed UnimplementedGreeterServer // for forward compatibility type GreeterServer interface { SayHello(context.Context, *HelloRequest) (*HelloReply, error) } // UnimplementedGreeterServer should be embedded to have forward compatible implementations. type UnimplementedGreeterServer struct { } func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) { return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") } // UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GreeterServer will // result in compilation errors. type UnsafeGreeterServer interface { mustEmbedUnimplementedGreeterServer() } func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) { s.RegisterService(&Greeter_ServiceDesc, srv) } func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HelloRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(GreeterServer).SayHello(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) } return interceptor(ctx, in, info, handler) } // Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.helloworld.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _Greeter_SayHello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/helloworld/helloworld.proto", } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/integration/000077500000000000000000000000001465037340600276415ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/integration/BUILD.bazel000066400000000000000000000022311465037340600315150ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_test") go_test( name = "integration_test", srcs = [ "client_test.go", "integration_test.go", "main_test.go", ], deps = [ "//examples/internal/clients/abe", "//examples/internal/clients/echo", "//examples/internal/clients/unannotatedecho", "//examples/internal/gateway", "//examples/internal/proto/examplepb", "//examples/internal/proto/pathenum", "//examples/internal/proto/sub", "//examples/internal/server", "//runtime", "@com_github_google_go_cmp//cmp", "@com_github_rogpeppe_fastuuid//:fastuuid", "@org_golang_google_genproto_googleapis_rpc//status", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//testing/protocmp", "@org_golang_google_protobuf//types/known/emptypb", "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/structpb", ], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/integration/client_test.go000066400000000000000000000154321465037340600325120ustar00rootroot00000000000000package integration_test import ( "context" "fmt" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/abe" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/echo" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/unannotatedecho" "github.com/rogpeppe/fastuuid" ) var uuidgen = fastuuid.MustNewGenerator() func TestEchoClient(t *testing.T) { if testing.Short() { t.Skip() return } cfg := echo.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) resp, _, err := cl.EchoServiceApi.EchoServiceEcho(context.Background(), "foo", nil) if err != nil { t.Errorf(`cl.EchoServiceApi.Echo("foo") failed with %v; want success`, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) } } func TestEchoBodyClient(t *testing.T) { if testing.Short() { t.Skip() return } cfg := echo.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) req := echo.ExamplepbSimpleMessage{Id: "foo"} resp, _, err := cl.EchoServiceApi.EchoServiceEchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) } } func TestEchoBody2Client(t *testing.T) { if testing.Short() { t.Skip() return } cfg := echo.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) req := echo.ExamplepbEmbedded{Note: "note"} resp, _, err := cl.EchoServiceApi.EchoServiceEchoBody2(context.Background(), "foo", req, nil) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) } } func TestAbitOfEverythingClient(t *testing.T) { if testing.Short() { t.Skip() return } cfg := abe.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := abe.NewAPIClient(cfg) testABEClientCreate(t, cl) } func testABEClientCreate(t *testing.T, cl *abe.APIClient) { enumZero := abe.ZERO_ExamplepbNumericEnum enumPath := abe.ABC_PathenumPathEnum messagePath := abe.JKL_MessagePathEnumNestedPathEnum want := &abe.ExamplepbABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: "4294967296", Uint64Value: "9223372036854775807", Int32Value: -2147483648, Fixed64Value: "9223372036854775807", Fixed32Value: 4294967295, BoolValue: true, StringValue: "strprefix/foo", Uint32Value: 4294967295, Sfixed32Value: 2147483647, Sfixed64Value: "-4611686018427387904", Sint32Value: 2147483647, Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", EnumValue: &enumZero, PathEnumValue: &enumPath, NestedPathEnumValue: &messagePath, EnumValueAnnotation: &enumZero, Uuid: fmt.Sprintf("%x", uuidgen.Next()), RequiredFieldBehaviorJsonNameCustom: "test", RequiredFieldSchemaJsonNameCustom: "test", } resp, _, err := cl.ABitOfEverythingServiceApi.ABitOfEverythingServiceCreate( context.Background(), want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue.String(), want.PathEnumValue.String(), want.NestedPathEnumValue.String(), want.EnumValueAnnotation.String(), want.Uuid, want.RequiredStringViaFieldBehaviorAnnotation, want.StringValue, want.StringValue, want.RequiredFieldBehaviorJsonNameCustom, want.RequiredFieldSchemaJsonNameCustom, nil, ) if err != nil { t.Fatalf("cl.Create(%#v) failed with %v; want success", want, err) } if resp.Uuid == "" { t.Errorf("resp.Uuid is empty; want not empty") } resp.Uuid = "" if resp.FloatValue != want.FloatValue { t.Error("float") } if resp.DoubleValue != want.DoubleValue { t.Error("double") } if resp.Int64Value != want.Int64Value { t.Error("double") } if resp.Uint64Value != want.Uint64Value { t.Error("double") } if resp.Int32Value != want.Int32Value { t.Error("double") } if resp.Fixed32Value != want.Fixed32Value { t.Error("bool") } if resp.Fixed64Value != want.Fixed64Value { t.Error("bool") } if resp.BoolValue != want.BoolValue { t.Error("bool") } if resp.StringValue != want.StringValue { t.Error("bool") } if resp.Uint32Value != want.Uint32Value { t.Error("bool") } if resp.Sfixed32Value != want.Sfixed32Value { t.Error("bool") } if resp.Sfixed64Value != want.Sfixed64Value { t.Error("bool") } if resp.Sint32Value != want.Sint32Value { t.Error("bool") } if resp.Sint64Value != want.Sint64Value { t.Error("enum") } if resp.NonConventionalNameValue != want.NonConventionalNameValue { t.Error("enum") } if resp.EnumValue.String() != want.EnumValue.String() { t.Error("enum") } if resp.PathEnumValue.String() != want.PathEnumValue.String() { t.Error("path enum") } if resp.NestedPathEnumValue.String() != want.NestedPathEnumValue.String() { t.Error("nested path enum") } if resp.NestedPathEnumValue.String() != want.NestedPathEnumValue.String() { t.Error("nested path enum") } } func TestUnannotatedEchoClient(t *testing.T) { if testing.Short() { t.Skip() return } cfg := unannotatedecho.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := unannotatedecho.NewAPIClient(cfg) resp, _, err := cl.UnannotatedEchoServiceApi.UnannotatedEchoServiceEcho(context.Background(), "foo", "1", nil) if err != nil { t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) } } func TestUnannotatedEchoBodyClient(t *testing.T) { if testing.Short() { t.Skip() return } cfg := unannotatedecho.NewConfiguration() cfg.BasePath = "http://localhost:8088" cl := unannotatedecho.NewAPIClient(cfg) req := unannotatedecho.ExamplepbUnannotatedSimpleMessage{Id: "foo", Num: "1"} resp, _, err := cl.UnannotatedEchoServiceApi.UnannotatedEchoServiceEchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/integration/integration_test.go000066400000000000000000002234241465037340600335610ustar00rootroot00000000000000package integration_test import ( "bufio" "bytes" "context" "encoding/base64" "encoding/json" "fmt" "io" "net/http" "net/url" "reflect" "strconv" "strings" "sync" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/emptypb" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/structpb" ) var marshaler = &runtime.JSONPb{} func TestEcho(t *testing.T) { if testing.Short() { t.Skip() return } for _, apiPrefix := range []string{"v1", "v2"} { t.Run(apiPrefix, func(t *testing.T) { testEcho(t, 8088, apiPrefix, "application/json") testEchoOneof(t, 8088, apiPrefix, "application/json") testEchoOneof1(t, 8088, apiPrefix, "application/json") testEchoOneof2(t, 8088, apiPrefix, "application/json") testEchoPathParamOverwrite(t, 8088) testEchoNested(t, 8088) testEchoNestedOverride(t, 8088) testEchoBody(t, 8088, apiPrefix, true) testEchoBody(t, 8088, apiPrefix, false) // Use SendHeader/SetTrailer without gRPC server https://github.com/grpc-ecosystem/grpc-gateway/issues/517#issuecomment-684625645 testEchoBody(t, 8089, apiPrefix, true) testEchoBody(t, 8089, apiPrefix, false) testEchoWithNonASCIIHeaderValues(t, 8088, apiPrefix) testEchoWithInvalidHeaderKey(t, 8088, apiPrefix) }) } } func TestEchoUnauthorized(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v1/example/echo_unauthorized" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } msg := new(statuspb.Status) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := resp.StatusCode, http.StatusUnauthorized; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } if value := resp.Header.Get("WWW-Authenticate"); value == "" { t.Errorf("WWW-Authenticate header should not be empty") } } func TestEchoPatch(t *testing.T) { if testing.Short() { t.Skip() return } sent := examplepb.DynamicMessage{ StructField: &structpb.Struct{Fields: map[string]*structpb.Value{ "struct_key": {Kind: &structpb.Value_StructValue{ StructValue: &structpb.Struct{Fields: map[string]*structpb.Value{ "layered_struct_key": {Kind: &structpb.Value_StringValue{StringValue: "struct_val"}}, }}, }}, }}, ValueField: &structpb.Value{Kind: &structpb.Value_StructValue{ StructValue: &structpb.Struct{Fields: map[string]*structpb.Value{ "value_struct_key": {Kind: &structpb.Value_StringValue{StringValue: "value_struct_val"}}, }}, }}, } payload, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(&sent) if err != nil { t.Fatalf("marshaler.Marshal(%#v) failed with %v; want success", payload, err) } apiURL := "http://localhost:8088/v1/example/echo_patch" req, err := http.NewRequest("PATCH", apiURL, bytes.NewReader(payload)) if err != nil { t.Errorf("http.NewRequest(PATCH, %q) failed with %v; want success", apiURL, err) return } resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.Post(%#v) failed with %v; want success", req, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var received examplepb.DynamicMessageUpdate if err := marshaler.Unmarshal(buf, &received); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if diff := cmp.Diff(received.Body, sent, protocmp.Transform()); diff != "" { t.Errorf(diff) } if diff := cmp.Diff(received.UpdateMask, fieldmaskpb.FieldMask{Paths: []string{ "struct_field.struct_key.layered_struct_key", "value_field.value_struct_key", }}, protocmp.Transform(), protocmp.SortRepeatedFields(received.UpdateMask, "paths")); diff != "" { t.Errorf(diff) } } func TestForwardResponseOption(t *testing.T) { if testing.Short() { t.Skip() return } ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() port := 7079 go func() { if err := runGateway( ctx, fmt.Sprintf(":%d", port), runtime.WithForwardResponseOption( func(_ context.Context, w http.ResponseWriter, _ proto.Message) error { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json") return nil }, ), ); err != nil { t.Errorf("runGateway() failed with %v; want success", err) return } }() if err := waitForGateway(ctx, uint16(port)); err != nil { t.Errorf("waitForGateway(ctx, %d) failed with %v; want success", port, err) } testEcho(t, port, "v1", "application/vnd.docker.plugins.v1.1+json") } func TestForwardResponseOptionHTTPPathPattern(t *testing.T) { if testing.Short() { t.Skip() return } ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() port := 7080 go func() { if err := runGateway( ctx, fmt.Sprintf(":%d", port), runtime.WithForwardResponseOption( func(ctx context.Context, w http.ResponseWriter, _ proto.Message) error { path, _ := runtime.HTTPPathPattern(ctx) w.Header().Set("Content-Type", path) return nil }, ), ); err != nil { t.Errorf("runGateway() failed with %v; want success", err) return } }() if err := waitForGateway(ctx, uint16(port)); err != nil { t.Errorf("waitForGateway(ctx, %d) failed with %v; want success", port, err) } testEcho(t, port, "v1", "/v1/example/echo/{id}") } func testEcho(t *testing.T, port int, apiPrefix string, contentType string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo/myid", port, apiPrefix) resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.Id, "myid"; got != want { t.Errorf("msg.Id = %q; want %q", got, want) } if value := resp.Header.Get("Content-Type"); value != contentType { t.Errorf("Content-Type was %s, wanted %s", value, contentType) } } func testEchoOneof(t *testing.T, port int, apiPrefix string, contentType string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo/myid/10/golang", port, apiPrefix) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.GetLang(), "golang"; got != want { t.Errorf("msg.GetLang() = %q; want %q", got, want) } if value := resp.Header.Get("Content-Type"); value != contentType { t.Errorf("Content-Type was %s, wanted %s", value, contentType) } } func testEchoOneof1(t *testing.T, port int, apiPrefix string, contentType string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo1/myid/10/golang", port, apiPrefix) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.GetStatus().GetNote(), "golang"; got != want { t.Errorf("msg.GetStatus().GetNote() = %q; want %q", got, want) } if value := resp.Header.Get("Content-Type"); value != contentType { t.Errorf("Content-Type was %s, wanted %s", value, contentType) } } func testEchoOneof2(t *testing.T, port int, apiPrefix string, contentType string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo2/golang", port, apiPrefix) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.GetNo().GetNote(), "golang"; got != want { t.Errorf("msg.GetNo().GetNote() = %q; want %q", got, want) } if value := resp.Header.Get("Content-Type"); value != contentType { t.Errorf("Content-Type was %s, wanted %s", value, contentType) } } func testEchoPathParamOverwrite(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo/resource/my_resource_id?resourceId=bad_resource_id", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.GetResourceId(), "my_resource_id"; got != want { t.Errorf("msg.GetResourceId() = %q; want %q", got, want) } } func testEchoNested(t *testing.T, port int) { resp, err := http.Get(fmt.Sprintf("http://localhost:%d/v1/example/echo/nested/my_nested_id?n_id.val=foo", port)) if err != nil { t.Errorf("http.Get() failed with %v; want success", err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.NId.Val, "foo"; got != want { t.Errorf("msg.NId.Val = %q; want %q", got, want) } } func testEchoNestedOverride(t *testing.T, port int) { resp, err := http.Get(fmt.Sprintf("http://localhost:%d/v1/example/echo/nested/my_nested_id?nId.nId=bad_id", port)) if err != nil { t.Errorf("http.Get() failed with %v; want success", err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.NId.NId, "my_nested_id"; got != want { t.Errorf("msg.NId.NId = %q; want %q", got, want) } } func testEchoBody(t *testing.T, port int, apiPrefix string, useTrailers bool) { sent := examplepb.UnannotatedSimpleMessage{Id: "example"} payload, err := marshaler.Marshal(&sent) if err != nil { t.Fatalf("marshaler.Marshal(%#v) failed with %v; want success", payload, err) } apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo_body", port, apiPrefix) req, err := http.NewRequest("POST", apiURL, bytes.NewReader(payload)) if err != nil { t.Errorf("http.NewRequest() failed with %v; want success", err) return } if useTrailers { req.Header.Set("TE", "trailers") } resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("client.Do(%v) failed with %v; want success", req, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var received examplepb.UnannotatedSimpleMessage if err := marshaler.Unmarshal(buf, &received); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if diff := cmp.Diff(&received, &sent, protocmp.Transform()); diff != "" { t.Errorf(diff) } if got, want := resp.Header.Get("Grpc-Metadata-Foo"), "foo1"; got != want { t.Errorf("Grpc-Metadata-Foo was %q, wanted %q", got, want) } if got, want := resp.Header.Get("Grpc-Metadata-Bar"), "bar1"; got != want { t.Errorf("Grpc-Metadata-Bar was %q, wanted %q", got, want) } wantedTrailers := map[bool]map[string]string{ true: { "Grpc-Trailer-Foo": "foo2", "Grpc-Trailer-Bar": "bar2", }, false: {}, } for trailer, want := range wantedTrailers[useTrailers] { if got := resp.Trailer.Get(trailer); got != want { t.Errorf("%s was %q, wanted %q", trailer, got, want) } } } func TestABE(t *testing.T) { if testing.Short() { t.Skip() return } testABECreate(t, 8088) testABECreateBody(t, 8088) testABEBulkCreate(t, 8088, true) testABEBulkCreate(t, 8088, false) testABEBulkCreateWithError(t, 8088) testABELookup(t, 8088) testABELookupNotFound(t, 8088, true) testABELookupNotFound(t, 8088, false) testABEList(t, 8088) testABEDownload(t, 8088) testABEBulkEcho(t, 8088) testABEBulkEchoZeroLength(t, 8088) testAdditionalBindings(t, 8088) testABERepeated(t, 8088) testABEExists(t, 8088) testABEExistsNotFound(t, 8088) testABEOptions(t, 8088) testABETrace(t, 8088) } func testABECreate(t *testing.T, port int) { want := &examplepb.ABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: 4294967296, Uint64Value: 9223372036854775807, Int32Value: -2147483648, Fixed64Value: 9223372036854775807, Fixed32Value: 4294967295, BoolValue: true, StringValue: "strprefix/foo", Uint32Value: 4294967295, Sfixed32Value: 2147483647, Sfixed64Value: -4611686018427387904, Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", EnumValue: examplepb.NumericEnum_ZERO, PathEnumValue: pathenum.PathEnum_DEF, NestedPathEnumValue: pathenum.MessagePathEnum_JKL, EnumValueAnnotation: examplepb.NumericEnum_ONE, } apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s/%s/%s/%s/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue, want.PathEnumValue, want.NestedPathEnumValue, want.EnumValueAnnotation) resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if msg.Uuid == "" { t.Error("msg.Uuid is empty; want not empty") } msg.Uuid = "" if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func testABECreateBody(t *testing.T, port int) { optionalStrVal := "optional-str" want := &examplepb.ABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: 4294967296, Uint64Value: 9223372036854775807, Int32Value: -2147483648, Fixed64Value: 9223372036854775807, Fixed32Value: 4294967295, BoolValue: true, StringValue: "strprefix/foo", Uint32Value: 4294967295, Sfixed32Value: 2147483647, Sfixed64Value: -4611686018427387904, Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", EnumValue: examplepb.NumericEnum_ONE, PathEnumValue: pathenum.PathEnum_ABC, NestedPathEnumValue: pathenum.MessagePathEnum_GHI, Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "bar", Amount: 10, }, { Name: "baz", Amount: 20, }, }, RepeatedStringValue: []string{"a", "b", "c"}, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "x", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, MappedStringValue: map[string]string{ "a": "x", "b": "y", }, MappedNestedValue: map[string]*examplepb.ABitOfEverything_Nested{ "a": {Name: "x", Amount: 1}, "b": {Name: "y", Amount: 2}, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{ examplepb.NumericEnum_ONE, examplepb.NumericEnum_ZERO, }, EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{ "a", "b", }, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{ { Name: "hoge", Amount: 10, }, { Name: "fuga", Amount: 20, }, }, NestedAnnotation: &examplepb.ABitOfEverything_Nested{ Name: "hoge", Amount: 10, }, OptionalStringValue: &optionalStrVal, } apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) payload, err := marshaler.Marshal(want) if err != nil { t.Fatalf("marshaler.Marshal(%#v) failed with %v; want success", want, err) } resp, err := http.Post(apiURL, "application/json", bytes.NewReader(payload)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if msg.Uuid == "" { t.Error("msg.Uuid is empty; want not empty") } msg.Uuid = "" if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func testABEBulkCreate(t *testing.T, port int, useTrailers bool) { count := 0 r, w := io.Pipe() go func(w io.WriteCloser) { defer func() { if cerr := w.Close(); cerr != nil { t.Errorf("w.Close() failed with %v; want success", cerr) } }() for _, val := range []string{ "foo", "bar", "baz", "qux", "quux", } { strVal := fmt.Sprintf("strprefix/%s", val) want := &examplepb.ABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: 4294967296, Uint64Value: 9223372036854775807, Int32Value: -2147483648, Fixed64Value: 9223372036854775807, Fixed32Value: 4294967295, BoolValue: true, StringValue: strVal, Uint32Value: 4294967295, Sfixed32Value: 2147483647, Sfixed64Value: -4611686018427387904, Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", EnumValue: examplepb.NumericEnum_ONE, PathEnumValue: pathenum.PathEnum_ABC, NestedPathEnumValue: pathenum.MessagePathEnum_GHI, Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "hoge", Amount: 10, }, { Name: "fuga", Amount: 20, }, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{ examplepb.NumericEnum_ONE, examplepb.NumericEnum_ZERO, }, EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{ "a", "b", }, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{ { Name: "hoge", Amount: 10, }, { Name: "fuga", Amount: 20, }, }, NestedAnnotation: &examplepb.ABitOfEverything_Nested{ Name: "hoge", Amount: 10, }, OptionalStringValue: &strVal, } out, err := marshaler.Marshal(want) if err != nil { t.Errorf("marshaler.Marshal(%#v, w) failed with %v; want success", want, err) return } if _, err := w.Write(out); err != nil { t.Errorf("w.Write() failed with %v; want success", err) return } if _, err := io.WriteString(w, "\n"); err != nil { t.Errorf("w.Write(%q) failed with %v; want success", "\n", err) return } count++ } }(w) apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) req, err := http.NewRequest("POST", apiURL, r) if err != nil { t.Errorf("http.NewRequest() failed with %v; want success", err) return } req.Header.Set("Content-Type", "application/json") if useTrailers { req.Header.Set("TE", "trailers") } resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("client.Do(%v) failed with %v; want success", req, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(emptypb.Empty) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := resp.Header.Get("Grpc-Metadata-Count"), fmt.Sprintf("%d", count); got != want { t.Errorf("Grpc-Metadata-Count was %q, wanted %q", got, want) } wantedTrailers := map[bool]map[string]string{ true: { "Grpc-Trailer-Foo": "foo2", "Grpc-Trailer-Bar": "bar2", }, false: {}, } for trailer, want := range wantedTrailers[useTrailers] { if got := resp.Trailer.Get(trailer); got != want { t.Errorf("%s was %q, wanted %q", trailer, got, want) } } } func testABEBulkCreateWithError(t *testing.T, port int) { count := 0 r, w := io.Pipe() go func(w io.WriteCloser) { defer func() { if cerr := w.Close(); cerr != nil { t.Errorf("w.Close() failed with %v; want success", cerr) } }() for _, val := range []string{ "foo", "bar", "baz", "qux", "quux", } { time.Sleep(1 * time.Millisecond) want := &examplepb.ABitOfEverything{ StringValue: fmt.Sprintf("strprefix/%s", val), } out, err := marshaler.Marshal(want) if err != nil { t.Errorf("marshaler.Marshal(%#v, w) failed with %v; want success", want, err) return } if _, err := w.Write(out); err != nil { t.Errorf("w.Write() failed with %v; want success", err) return } if _, err := io.WriteString(w, "\n"); err != nil { t.Errorf("w.Write(%q) failed with %v; want success", "\n", err) return } count++ } }(w) apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) request, err := http.NewRequest("POST", apiURL, r) if err != nil { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "POST", apiURL, err) } request.Header.Add("Grpc-Metadata-error", "some error") resp, err := http.DefaultClient.Do(request) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusBadRequest; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(statuspb.Status) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Fatalf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) } } func testABELookup(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) cresp, err := http.Post(apiURL, "application/json", strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer cresp.Body.Close() buf, err := io.ReadAll(cresp.Body) if err != nil { t.Errorf("io.ReadAll(cresp.Body) failed with %v; want success", err) return } if got, want := cresp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) return } want := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, want); err != nil { t.Errorf("marshaler.Unmarshal(%s, want) failed with %v; want success", buf, err) return } apiURL = fmt.Sprintf("%s/%s", apiURL, want.Uuid) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err = io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } msg := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), want.Uuid; got != want { t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) } } // TestABEPatch demonstrates partially updating a resource. // First, we'll create an ABE resource with known values for string_value and int32_value // Then, issue a PATCH request updating only the string_value // Then, GET the resource and verify that string_value is changed, but int32_value isn't func TestABEPatch(t *testing.T) { if testing.Short() { t.Skip() return } port := 8088 // create a record with a known string_value and int32_value uuid := postABE(t, port, &examplepb.ABitOfEverything{StringValue: "strprefix/bar", Int32Value: 32}) // issue PATCH request, only updating string_value req, err := http.NewRequest( http.MethodPatch, fmt.Sprintf("http://localhost:%d/v2/example/a_bit_of_everything/%s", port, uuid), strings.NewReader(`{"string_value": "strprefix/foo"}`), ) if err != nil { t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) } patchResp, err := http.DefaultClient.Do(req) if err != nil { t.Fatalf("failed to issue PATCH request: %v", err) } if got, want := patchResp.StatusCode, http.StatusOK; got != want { if body, err := io.ReadAll(patchResp.Body); err != nil { t.Errorf("patchResp body couldn't be read: %v", err) } else { t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) } } // issue GET request, verifying that string_value is changed and int32_value is not getRestatuspbody := getABE(t, port, uuid) if got, want := getRestatuspbody.StringValue, "strprefix/foo"; got != want { t.Errorf("string_value= %q; want %q", got, want) } if got, want := getRestatuspbody.Int32Value, int32(32); got != want { t.Errorf("int_32_value= %d; want %d", got, want) } } // TestABEPatchBody demonstrates the ability to specify an update mask within the request body. // This binding does not use an automatically generated update_mask. func TestABEPatchBody(t *testing.T) { if testing.Short() { t.Skip() return } port := 8088 for _, tc := range []struct { name string originalValue *examplepb.ABitOfEverything input *examplepb.UpdateV2Request want *examplepb.ABitOfEverything }{ { name: "with fieldmask provided", originalValue: &examplepb.ABitOfEverything{ Int32Value: 42, StringValue: "rabbit", SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "some value that will get overwritten", Amount: 345, }, }, input: &examplepb.UpdateV2Request{ Abe: &examplepb.ABitOfEverything{ StringValue: "some value that won't get updated because it's not in the field mask", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 456, }, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"single_nested"}}, }, want: &examplepb.ABitOfEverything{ Int32Value: 42, StringValue: "rabbit", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 456, }, }, }, { // N.B. This case passes the empty field mask to the UpdateV2 method so falls back to PUT semantics as per the implementation. name: "with empty fieldmask", originalValue: &examplepb.ABitOfEverything{ Int32Value: 42, StringValue: "some value that will get overwritten", SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "value that will get empty", Amount: 345, }, }, input: &examplepb.UpdateV2Request{ Abe: &examplepb.ABitOfEverything{ StringValue: "some updated value because the fieldMask is nil", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 456, }, }, UpdateMask: &fieldmaskpb.FieldMask{}, }, want: &examplepb.ABitOfEverything{ StringValue: "some updated value because the fieldMask is nil", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 456, }, }, }, { // N.B. This case passes the nil field mask to the UpdateV2 method so falls back to PUT semantics as per the implementation. name: "with nil fieldmask", originalValue: &examplepb.ABitOfEverything{ Int32Value: 42, StringValue: "some value that will get overwritten", SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "value that will get empty", Amount: 123, }, }, input: &examplepb.UpdateV2Request{ Abe: &examplepb.ABitOfEverything{ StringValue: "some updated value because the fieldMask is nil", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 657, }, }, UpdateMask: nil, }, want: &examplepb.ABitOfEverything{ StringValue: "some updated value because the fieldMask is nil", SingleNested: &examplepb.ABitOfEverything_Nested{ Amount: 657, }, }, }, } { t.Run(tc.name, func(t *testing.T) { originalABE := tc.originalValue uuid := postABE(t, port, originalABE) patchBody := tc.input patchReq, err := http.NewRequest( http.MethodPatch, fmt.Sprintf("http://localhost:%d/v2a/example/a_bit_of_everything/%s", port, uuid), strings.NewReader(mustMarshal(t, patchBody)), ) if err != nil { t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) } patchResp, err := http.DefaultClient.Do(patchReq) if err != nil { t.Fatalf("failed to issue PATCH request: %v", err) } if got, want := patchResp.StatusCode, http.StatusOK; got != want { if body, err := io.ReadAll(patchResp.Body); err != nil { t.Errorf("patchResp body couldn't be read: %v", err) } else { t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) } } want, got := tc.want, getABE(t, port, uuid) got.Uuid = "" // empty out uuid so we don't need to worry about it in comparisons if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } }) } } // mustMarshal marshals the given object into a json string, calling t.Fatal if an error occurs. Useful in testing to // inline marshalling whenever you don't expect the marshalling to return an error func mustMarshal(t *testing.T, i interface{}) string { b, err := marshaler.Marshal(i) if err != nil { t.Fatalf("failed to marshal %#v: %v", i, err) } return string(b) } // postABE conveniently creates a new ABE record for ease in testing func postABE(t *testing.T, port int, abe *examplepb.ABitOfEverything) (uuid string) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) postResp, err := http.Post(apiURL, "application/json", strings.NewReader(mustMarshal(t, abe))) if err != nil { t.Fatalf("http.Post(%q) failed with %v; want success", apiURL, err) return } body, err := io.ReadAll(postResp.Body) if err != nil { t.Fatalf("postResp body couldn't be read: %v", err) } var f struct { UUID string `json:"uuid"` } if err := marshaler.Unmarshal(body, &f); err != nil { t.Fatalf("postResp body couldn't be unmarshalled: %v. body: %s", err, string(body)) } if f.UUID == "" { t.Fatalf("want uuid from postResp, but got none. body: %s", string(body)) } return f.UUID } // getABE conveniently fetches an ABE record for ease in testing func getABE(t *testing.T, port int, uuid string) *examplepb.ABitOfEverything { gURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%s", port, uuid) getResp, err := http.Get(gURL) if err != nil { t.Fatalf("http.Get(%s) failed with %v; want success", gURL, err) } defer getResp.Body.Close() if got, want := getResp.StatusCode, http.StatusOK; got != want { t.Fatalf("getResp.StatusCode= %d, want %d. resp: %v", got, want, getResp) } var getRestatuspbody examplepb.ABitOfEverything body, err := io.ReadAll(getResp.Body) if err != nil { t.Fatalf("getResp body couldn't be read: %v", err) } if err := marshaler.Unmarshal(body, &getRestatuspbody); err != nil { t.Fatalf("getResp body couldn't be unmarshalled: %v body: %s", err, string(body)) } return &getRestatuspbody } func testABELookupNotFound(t *testing.T, port int, useTrailers bool) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) uuid := "not_exist" apiURL = fmt.Sprintf("%s/%s", apiURL, uuid) req, err := http.NewRequest("GET", apiURL, nil) if err != nil { t.Errorf("http.NewRequest() failed with %v; want success", err) return } if useTrailers { req.Header.Set("TE", "trailers") } resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("client.Do(%v) failed with %v; want success", req, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusNotFound; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) return } msg := new(statuspb.Status) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.Code, int32(codes.NotFound); got != want { t.Errorf("msg.Code = %d; want %d", got, want) return } if got, want := msg.Message, "not found"; got != want { t.Errorf("msg.Message = %s; want %s", got, want) return } if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want { t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) } trailers := map[bool]map[string]string{ true: { "Grpc-Trailer-Foo": "foo2", "Grpc-Trailer-Bar": "bar2", }, false: { "Grpc-Trailer-Foo": "", "Grpc-Trailer-Bar": "", }, } for trailer, want := range trailers[useTrailers] { if got := resp.Trailer.Get(trailer); got != want { t.Errorf("%s was %q, wanted %q", trailer, got, want) } } } func testABEList(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() dec := marshaler.NewDecoder(resp.Body) var i int for i = 0; ; i++ { var item struct { Result json.RawMessage `json:"result"` Error map[string]interface{} `json:"error"` } err := dec.Decode(&item) if err == io.EOF { break } if err != nil { t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) } if len(item.Error) != 0 { t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) continue } msg := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(item.Result, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", item.Result, err) } } if i <= 0 { t.Errorf("i == %d; want > 0", i) } value := resp.Header.Get("Grpc-Metadata-Count") if value == "" { t.Errorf("Grpc-Metadata-Count should not be empty") } count, err := strconv.Atoi(value) if err != nil { t.Errorf("failed to Atoi %q: %v", value, err) } if count <= 0 { t.Errorf("count == %d; want > 0", count) } } func testABEDownload(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/download", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() wantHeader := "text/html" if value := resp.Header.Get("Content-Type"); value != wantHeader { t.Fatalf("testABEDownload() Content-Type failed: got %s, want %s", value, wantHeader) } body, err := readAll(resp.Body) if err != nil { t.Fatalf("readAll(resp.Body) failed with %v; want success", err) } want := []string{"Hello 1", "Hello 2"} if !reflect.DeepEqual(body, want) { t.Errorf("testABEDownload() failed: got %v, want %v", body, want) } } func testABEBulkEcho(t *testing.T, port int) { reqr, reqw := io.Pipe() var wg sync.WaitGroup var want []*sub.StringMessage wg.Add(1) go func() { defer wg.Done() defer reqw.Close() for i := 0; i < 10; i++ { s := fmt.Sprintf("message %d", i) msg := &sub.StringMessage{Value: &s} buf, err := marshaler.Marshal(msg) if err != nil { t.Errorf("marshaler.Marshal(%v) failed with %v; want success", msg, err) return } if _, err = reqw.Write(buf); err != nil { t.Errorf("reqw.Write(%q) failed with %v; want success", string(buf), err) return } want = append(want, msg) } }() apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) req, err := http.NewRequest("POST", apiURL, reqr) if err != nil { t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", apiURL, err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Transfer-Encoding", "chunked") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.Post(%q, %q, req) failed with %v; want success", apiURL, "application/json", err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } var got []*sub.StringMessage wg.Add(1) go func() { defer wg.Done() dec := marshaler.NewDecoder(resp.Body) for i := 0; ; i++ { var item struct { Result json.RawMessage `json:"result"` Error map[string]interface{} `json:"error"` } err := dec.Decode(&item) if err == io.EOF { break } if err != nil { t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) } if len(item.Error) != 0 { t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) continue } msg := new(sub.StringMessage) if err := marshaler.Unmarshal(item.Result, msg); err != nil { t.Errorf("marshaler.Unmarshal(%q, msg) failed with %v; want success", item.Result, err) } got = append(got, msg) } }() wg.Wait() if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func testABEBulkEchoZeroLength(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) req, err := http.NewRequest("POST", apiURL, bytes.NewReader(nil)) if err != nil { t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", apiURL, err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Transfer-Encoding", "chunked") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.Post(%q, %q, req) failed with %v; want success", apiURL, "application/json", err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } dec := marshaler.NewDecoder(resp.Body) var item struct { Result json.RawMessage `json:"result"` Error map[string]interface{} `json:"error"` } if err := dec.Decode(&item); err == nil { t.Errorf("dec.Decode(&item) succeeded; want io.EOF; item = %#v", item) } else if err != io.EOF { t.Errorf("dec.Decode(&item) failed with %v; want success", err) return } } func testAdditionalBindings(t *testing.T, port int) { for i, f := range []func() *http.Response{ func() *http.Response { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo/hello", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return nil } return resp }, func() *http.Response { apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) resp, err := http.Post(apiURL, "application/json", strings.NewReader(`"hello"`)) if err != nil { t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", apiURL, "application/json", `"hello"`, err) return nil } return resp }, func() *http.Response { r, w := io.Pipe() go func() { defer w.Close() w.Write([]byte(`"hello"`)) }() apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) resp, err := http.Post(apiURL, "application/json", r) if err != nil { t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", apiURL, "application/json", `"hello"`, err) return nil } return resp }, func() *http.Response { apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo?value=hello", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return nil } return resp }, } { resp := f() if resp == nil { continue } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success; i=%d", err, i) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d; i=%d", got, want, i) t.Logf("%s", buf) } msg := new(sub.StringMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success; %d", buf, err, i) return } if got, want := msg.GetValue(), "hello"; got != want { t.Errorf("msg.GetValue() = %q; want %q", got, want) } } } func testABERepeated(t *testing.T, port int) { f := func(v reflect.Value) string { var f func(v reflect.Value, idx int) string s := make([]string, v.Len()) switch v.Index(0).Kind() { case reflect.Slice: f = func(v reflect.Value, idx int) string { t := v.Index(idx).Type().Elem().Kind() if t == reflect.Uint8 { return base64.URLEncoding.EncodeToString(v.Index(idx).Interface().([]byte)) } // Could handle more elegantly panic("unknown slice of type: " + t.String()) } default: f = func(v reflect.Value, idx int) string { return fmt.Sprintf("%v", v.Index(idx).Interface()) } } for i := 0; i < v.Len(); i++ { s[i] = f(v, i) } return strings.Join(s, ",") } want := &examplepb.ABitOfEverythingRepeated{ PathRepeatedFloatValue: []float32{ 1.5, -1.5, }, PathRepeatedDoubleValue: []float64{ 2.5, -2.5, }, PathRepeatedInt64Value: []int64{ 4294967296, -4294967296, }, PathRepeatedUint64Value: []uint64{ 0, 9223372036854775807, }, PathRepeatedInt32Value: []int32{ 2147483647, -2147483648, }, PathRepeatedFixed64Value: []uint64{ 0, 9223372036854775807, }, PathRepeatedFixed32Value: []uint32{ 0, 4294967295, }, PathRepeatedBoolValue: []bool{ true, false, }, PathRepeatedStringValue: []string{ "foo", "bar", }, PathRepeatedBytesValue: [][]byte{ {0x00}, {0xFF}, }, PathRepeatedUint32Value: []uint32{ 0, 4294967295, }, PathRepeatedEnumValue: []examplepb.NumericEnum{ examplepb.NumericEnum_ZERO, examplepb.NumericEnum_ONE, }, PathRepeatedSfixed32Value: []int32{ 2147483647, -2147483648, }, PathRepeatedSfixed64Value: []int64{ 4294967296, -4294967296, }, PathRepeatedSint32Value: []int32{ 2147483647, -2147483648, }, PathRepeatedSint64Value: []int64{ 4611686018427387903, -4611686018427387904, }, } apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything_repeated/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s", port, f(reflect.ValueOf(want.PathRepeatedFloatValue)), f(reflect.ValueOf(want.PathRepeatedDoubleValue)), f(reflect.ValueOf(want.PathRepeatedInt64Value)), f(reflect.ValueOf(want.PathRepeatedUint64Value)), f(reflect.ValueOf(want.PathRepeatedInt32Value)), f(reflect.ValueOf(want.PathRepeatedFixed64Value)), f(reflect.ValueOf(want.PathRepeatedFixed32Value)), f(reflect.ValueOf(want.PathRepeatedBoolValue)), f(reflect.ValueOf(want.PathRepeatedStringValue)), f(reflect.ValueOf(want.PathRepeatedBytesValue)), f(reflect.ValueOf(want.PathRepeatedUint32Value)), f(reflect.ValueOf(want.PathRepeatedEnumValue)), f(reflect.ValueOf(want.PathRepeatedSfixed32Value)), f(reflect.ValueOf(want.PathRepeatedSfixed64Value)), f(reflect.ValueOf(want.PathRepeatedSint32Value)), f(reflect.ValueOf(want.PathRepeatedSint64Value))) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.ABitOfEverythingRepeated) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if diff := cmp.Diff(msg, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func TestTimeout(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v2/example/timeout" req, err := http.NewRequest("GET", apiURL, nil) if err != nil { t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, apiURL, err) return } req.Header.Set("Grpc-Timeout", "10m") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.DefaultClient.Do(%#v) failed with %v; want success", req, err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusGatewayTimeout; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } } func TestInvalidTimeout(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v2/example/timeout" req, err := http.NewRequest("GET", apiURL, nil) if err != nil { t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, apiURL, err) return } req.Header.Set("Grpc-Timeout", "INVALID") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.DefaultClient.Do(%#v) failed with %v; want success", req, err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusBadRequest; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } } func TestPostWithEmptyBody(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v2/example/postwithemptybody/name" rep, err := http.Post(apiURL, "application/json", nil) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } if rep.StatusCode != http.StatusOK { t.Errorf("http.Post(%q) response code is %d; want %d", apiURL, rep.StatusCode, http.StatusOK) return } } func TestUnknownPath(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088" resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusNotFound; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } } func TestNotImplemented(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v1/example/echo/myid" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusNotImplemented; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } } func TestInvalidArgument(t *testing.T) { if testing.Short() { t.Skip() return } apiURL := "http://localhost:8088/v1/example/echo/myid/not_int64" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusBadRequest; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } } func TestResponseBody(t *testing.T) { if testing.Short() { t.Skip() return } testResponseBody(t, 8088) testResponseBodies(t, 8088) testResponseStrings(t, 8088) } func testResponseBody(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) resp, err := http.Get(apiURL) if err != nil { t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Fatalf("io.ReadAll(resp.Body) failed with %v; want success", err) } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } if diff := cmp.Diff(string(buf), `{"data":"foo"}`); diff != "" { t.Errorf(diff) } } func TestResponseBodyStream(t *testing.T) { apiURL := "http://localhost:8088/responsebody/stream/foo" resp, err := http.Get(apiURL) if err != nil { t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) } defer resp.Body.Close() body, err := readAll(resp.Body) if err != nil { t.Fatalf("readAll(resp.Body) failed with %v; want success", err) } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } if diff := cmp.Diff(body, []string{`{"result":{"data":"first foo"}}`, `{"result":{"data":"second foo"}}`}); diff != "" { t.Errorf(diff) } } func TestResponseBodyStreamHttpBody(t *testing.T) { apiURL := "http://localhost:8088/v1/example/download" resp, err := http.Get(apiURL) if err != nil { t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) } defer resp.Body.Close() body, err := readAll(resp.Body) if err != nil { t.Fatalf("readAll(resp.Body) failed with %v; want success", err) } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } if diff := cmp.Diff(body, []string{"Hello 1", "Hello 2"}); diff != "" { t.Errorf(diff) } } func TestResponseBodyStreamHttpBodyError(t *testing.T) { apiURL := "http://localhost:8088/v1/example/download?error=true" resp, err := http.Get(apiURL) if err != nil { t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) } defer resp.Body.Close() body, err := readAll(resp.Body) if err != nil { t.Fatalf("readAll(resp.Body) failed with %v; want success", err) } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } if diff := cmp.Diff(body, []string{"Hello 1", "Hello 2", `{"error":{"code":3,"message":"error","details":[]}}`}); diff != "" { t.Errorf(diff) } } func readAll(body io.ReadCloser) ([]string, error) { var b []string reader := bufio.NewReader(body) for { l, err := reader.ReadBytes('\n') switch { case err == io.EOF: return b, nil case err != nil: return nil, err } b = append(b, string(bytes.TrimSpace(l))) } } func testResponseBodies(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/responsebodies/foo", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var got []*examplepb.RepeatedResponseBodyOut_Response err = marshaler.Unmarshal(buf, &got) if err != nil { t.Errorf("marshaler.Unmarshal failed with %v; want success", err) return } want := []*examplepb.RepeatedResponseBodyOut_Response{ { Data: "foo", Type: examplepb.RepeatedResponseBodyOut_Response_UNKNOWN, }, } if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func testResponseStrings(t *testing.T, port int) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() port = 8087 // Run Secondary server with different marshalling ch := make(chan error) go func() { err := runGateway( ctx, fmt.Sprintf(":%d", port), ) if err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() if err := waitForGateway(ctx, uint16(port)); err != nil { t.Fatalf("waitForGateway(ctx, %d) failed with %v; want success", port, err) } t.Run("Response strings", func(t *testing.T) { apiURL := fmt.Sprintf("http://localhost:%d/responsestrings/foo", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var got []string err = marshaler.Unmarshal(buf, &got) if err != nil { t.Errorf("marshaler.Unmarshal failed with %v; want success", err) return } want := []string{"hello", "foo"} if diff := cmp.Diff(got, want); diff != "" { t.Errorf(diff) } }) t.Run("Empty response strings", func(t *testing.T) { apiURL := fmt.Sprintf("http://localhost:%d/responsestrings/empty", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var got []string err = marshaler.Unmarshal(buf, &got) if err != nil { t.Errorf("marshaler.Unmarshal failed with %v; want success", err) return } want := []string{} if diff := cmp.Diff(got, want); diff != "" { t.Errorf(diff) } }) t.Run("Response bodies", func(t *testing.T) { apiURL := fmt.Sprintf("http://localhost:%d/responsebodies/foo", port) resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } var got []*examplepb.RepeatedResponseBodyOut_Response err = marshaler.Unmarshal(buf, &got) if err != nil { t.Errorf("marshaler.Unmarshal failed with %v; want success", err) return } want := []*examplepb.RepeatedResponseBodyOut_Response{ { Data: "foo", Type: examplepb.RepeatedResponseBodyOut_Response_UNKNOWN, }, } if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } }) } func TestRequestQueryParams(t *testing.T) { testRequestQueryParams(t, 8088) } func TestRequestQueryParamsInProcessGateway(t *testing.T) { testRequestQueryParams(t, 8089) } func testRequestQueryParams(t *testing.T, port int) { if testing.Short() { t.Skip() return } formValues := url.Values{} formValues.Set("string_value", "hello-world") formValues.Add("repeated_string_value", "demo1") formValues.Add("repeated_string_value", "demo2") formValues.Add("optional_string_value", "optional-val") mappedStringValueStr := fmt.Sprintf("mapped_string_value[%v]=%v", "map_key", "map_value") testCases := []struct { name string httpMethod string contentType string apiURL string wantContent *examplepb.ABitOfEverything requestContent io.Reader }{ { name: "get url query values", httpMethod: "GET", contentType: "application/json", apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/foo?double_value=%v&bool_value=%v&%v", port, 1234.56, true, mappedStringValueStr), wantContent: &examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "foo", }, DoubleValue: 1234.56, BoolValue: true, MappedStringValue: map[string]string{ "map_key": "map_value", }, }, }, { name: "get nested enum url parameter", httpMethod: "GET", contentType: "application/json", // If nested_enum.OK were FALSE, the content of single_nested would be {} due to how 0 values are serialized apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/nested_enum/TRUE", port), wantContent: &examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{ Ok: examplepb.ABitOfEverything_Nested_TRUE, }, }, }, { name: "post url query values", httpMethod: "POST", contentType: "application/json", apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/post/hello-world?double_value=%v&bool_value=%v", port, 1234.56, true), wantContent: &examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "foo", Amount: 100, }, DoubleValue: 1234.56, BoolValue: true, StringValue: "hello-world", }, requestContent: strings.NewReader(`{"name":"foo","amount":100}`), }, { name: "post form and url query values", httpMethod: "POST", contentType: "application/x-www-form-urlencoded", apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/foo?double_value=%v&bool_value=%v", port, 1234.56, true), wantContent: &examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{ Name: "foo", }, DoubleValue: 1234.56, BoolValue: true, StringValue: "hello-world", RepeatedStringValue: []string{"demo1", "demo2"}, OptionalStringValue: func() *string { val := formValues.Get("optional_string_value") return &val }(), }, requestContent: strings.NewReader(formValues.Encode()), }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { req, err := http.NewRequest(tc.httpMethod, tc.apiURL, tc.requestContent) if err != nil { t.Errorf("http.method (%q) http.url (%q) failed with %v; want success", tc.httpMethod, tc.apiURL, err) return } req.Header.Add("Content-Type", tc.contentType) resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.method (%q) http.url (%q) failed with %v; want success", tc.httpMethod, tc.apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if gotCode, wantCode := resp.StatusCode, http.StatusOK; gotCode != wantCode { t.Errorf("resp.StatusCode = %d; want %d", gotCode, wantCode) t.Logf("%s", buf) } got := new(examplepb.ABitOfEverything) err = marshaler.Unmarshal(buf, &got) if err != nil { t.Errorf("marshaler.Unmarshal(buf, got) failed with %v; want success", err) return } if diff := cmp.Diff(got, tc.wantContent, protocmp.Transform()); diff != "" { t.Errorf("http.method (%q) http.url (%q)\n%s", tc.httpMethod, tc.apiURL, diff) } }) } } func TestNonStandardNames(t *testing.T) { if testing.Short() { t.Skip() return } ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() go func() { marshaler := &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseEnumNumbers: false, EmitUnpopulated: true, UseProtoNames: true, }, } err := runGateway( ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, marshaler), ) if err != nil { t.Errorf("runGateway() failed with %v; want success", err) return } }() go func() { err := runGateway( ctx, ":8082", ) if err != nil { t.Errorf("runGateway() failed with %v; want success", err) return } }() if err := waitForGateway(ctx, 8081); err != nil { t.Errorf("waitForGateway(ctx, 8081) failed with %v; want success", err) } if err := waitForGateway(ctx, 8082); err != nil { t.Errorf("waitForGateway(ctx, 8082) failed with %v; want success", err) } for _, tc := range []struct { name string port int method string jsonBody string want proto.Message }{ { "Test standard update method", 8081, "update", `{ "id": "foo", "Num": "1", "line_num": "42", "langIdent": "English", "STATUS": "good", "en_GB": "1", "no": "yes", "thing": { "subThing": { "sub_value": "hi" } } }`, &examplepb.NonStandardMessage{ Id: "foo", Num: 1, LineNum: 42, LangIdent: "English", STATUS: "good", En_GB: 1, No: "yes", Thing: &examplepb.NonStandardMessage_Thing{ SubThing: &examplepb.NonStandardMessage_Thing_SubThing{ SubValue: "hi", }, }, }, }, { "Test update method using json_names in message", 8081, "update_with_json_names", // N.B. json_names have no effect if not using UseProtoNames: false `{ "id": "foo", "Num": "1", "line_num": "42", "langIdent": "English", "STATUS": "good", "en_GB": "1", "no": "yes", "thing": { "subThing": { "sub_value": "hi" } } }`, &examplepb.NonStandardMessageWithJSONNames{ Id: "foo", Num: 1, LineNum: 42, LangIdent: "English", STATUS: "good", En_GB: 1, No: "yes", Thing: &examplepb.NonStandardMessageWithJSONNames_Thing{ SubThing: &examplepb.NonStandardMessageWithJSONNames_Thing_SubThing{ SubValue: "hi", }, }, }, }, { "Test standard update method with UseProtoNames: false marshaller option", 8082, "update", `{ "id": "foo", "Num": "1", "lineNum": "42", "langIdent": "English", "STATUS": "good", "enGB": "1", "no": "yes", "thing": { "subThing": { "subValue": "hi" } } }`, &examplepb.NonStandardMessage{ Id: "foo", Num: 1, LineNum: 42, LangIdent: "English", STATUS: "good", En_GB: 1, No: "yes", Thing: &examplepb.NonStandardMessage_Thing{ SubThing: &examplepb.NonStandardMessage_Thing_SubThing{ SubValue: "hi", }, }, }, }, { "Test update method using json_names in message with UseProtoNames: false marshaller option", 8082, "update_with_json_names", `{ "ID": "foo", "Num": "1", "LineNum": "42", "langIdent": "English", "status": "good", "En_GB": "1", "yes": "yes", "Thingy": { "SubThing": { "sub_Value": "hi" } } }`, &examplepb.NonStandardMessageWithJSONNames{ Id: "foo", Num: 1, LineNum: 42, LangIdent: "English", STATUS: "good", En_GB: 1, No: "yes", Thing: &examplepb.NonStandardMessageWithJSONNames_Thing{ SubThing: &examplepb.NonStandardMessageWithJSONNames_Thing_SubThing{ SubValue: "hi", }, }, }, }, } { t.Run(tc.name, func(t *testing.T) { testNonStandardNames(t, tc.port, tc.method, tc.jsonBody, tc.want) }) } } func testNonStandardNames(t *testing.T, port int, method string, jsonBody string, want proto.Message) { req, err := http.NewRequest( http.MethodPatch, fmt.Sprintf("http://localhost:%d/v1/example/non_standard/%s", port, method), strings.NewReader(jsonBody), ) if err != nil { t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) } patchResp, err := http.DefaultClient.Do(req) if err != nil { t.Fatalf("failed to issue PATCH request: %v", err) } body, err := io.ReadAll(patchResp.Body) if err != nil { t.Errorf("patchResp body couldn't be read: %v", err) } t.Log(string(body)) if got, want := patchResp.StatusCode, http.StatusOK; got != want { t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) } got := want.ProtoReflect().New().Interface() err = marshaler.Unmarshal(body, got) if err != nil { t.Fatalf("marshaler.Unmarshal failed: %v", err) } if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func testABEExists(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) cresp, err := http.Post(apiURL, "application/json", strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer cresp.Body.Close() buf, err := io.ReadAll(cresp.Body) if err != nil { t.Errorf("io.ReadAll(cresp.Body) failed with %v; want success", err) return } if got, want := cresp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) return } want := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, want); err != nil { t.Errorf("marshaler.Unmarshal(%s, want) failed with %v; want success", buf, err) return } apiURL = fmt.Sprintf("%s/%s", apiURL, want.Uuid) resp, err := http.Head(apiURL) if err != nil { t.Errorf("http.Head(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } } func testABEExistsNotFound(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) apiURL = fmt.Sprintf("%s/%s", apiURL, "not_exist") resp, err := http.Head(apiURL) if err != nil { t.Errorf("http.Head(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusNotFound; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) return } } func testABEOptions(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/test", port) req, err := http.NewRequest(http.MethodOptions, apiURL, strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) req.Header.Set("Content-Type", "application/json") if err != nil { t.Errorf("http.NewRequest(http.MethodTrace, %q, ...) failed with %v; want success", apiURL, err) return } client := &http.Client{} resp, err := client.Do(req) if err != nil { t.Fatal(err) } defer resp.Body.Close() if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) return } value := resp.Header.Get("Grpc-Metadata-Allow") if value != "OPTIONS, GET, HEAD, POST, PUT, TRACE" { t.Errorf("Grpc-Metadata-Allow does not have the expected HTTP methods") t.Logf("%s", value) } } func testABETrace(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/test", port) req, err := http.NewRequest(http.MethodTrace, apiURL, strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) req.Header.Set("Content-Type", "application/json") if err != nil { t.Errorf("http.NewRequest(http.MethodTrace, %q, ...) failed with %v; want success", apiURL, err) return } client := &http.Client{} resp, err := client.Do(req) if err != nil { t.Fatal(err) } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(cresp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) return } want := new(examplepb.ABitOfEverything) if err := marshaler.Unmarshal(buf, want); err != nil { t.Errorf("marshaler.Unmarshal(%s, want) failed with %v; want success", buf, err) return } } func testEchoWithNonASCIIHeaderValues(t *testing.T, port int, apiPrefix string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo/myid", port, apiPrefix) req, err := http.NewRequest("POST", apiURL, strings.NewReader("{}")) if err != nil { t.Errorf("http.NewRequest() = err: %v", err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Grpc-Metadata-Location", "Gjøvik") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.Id, "myid"; got != want { t.Errorf("msg.Id = %q; want %q", got, want) } } func testEchoWithInvalidHeaderKey(t *testing.T, port int, apiPrefix string) { apiURL := fmt.Sprintf("http://localhost:%d/%s/example/echo/myid", port, apiPrefix) req, err := http.NewRequest("POST", apiURL, strings.NewReader("{}")) if err != nil { t.Errorf("http.NewRequest() = err: %v", err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Grpc-Metadata-Foo+Bar", "Hello") resp, err := http.DefaultClient.Do(req) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() buf, err := io.ReadAll(resp.Body) if err != nil { t.Errorf("io.ReadAll(resp.Body) failed with %v; want success", err) return } if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) t.Logf("%s", buf) } msg := new(examplepb.UnannotatedSimpleMessage) if err := marshaler.Unmarshal(buf, msg); err != nil { t.Errorf("marshaler.Unmarshal(%s, msg) failed with %v; want success", buf, err) return } if got, want := msg.Id, "myid"; got != want { t.Errorf("msg.Id = %q; want %q", got, want) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/integration/main_test.go000066400000000000000000000045361465037340600321630ustar00rootroot00000000000000package integration_test import ( "context" "flag" "fmt" "net/http" "os" "testing" "time" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server" gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc/grpclog" ) var ( endpoint = flag.String("endpoint", "localhost:9090", "endpoint of the gRPC service") network = flag.String("network", "tcp", `one of "tcp" or "unix". Must be consistent to -endpoint`) openAPIDir = flag.String("openapi_dir", "examples/internal/proto/examplepb", "path to the directory which contains OpenAPI definitions") ) func runGateway(ctx context.Context, addr string, opts ...gwruntime.ServeMuxOption) error { return gateway.Run(ctx, gateway.Options{ Addr: addr, GRPCServer: gateway.Endpoint{ Network: *network, Addr: *endpoint, }, OpenAPIDir: *openAPIDir, Mux: opts, }) } func waitForGateway(ctx context.Context, port uint16) error { ch := time.After(10 * time.Second) for { r, err := http.Get(fmt.Sprintf("http://localhost:%d/healthz", port)) if err == nil && r.StatusCode == http.StatusOK { return nil } grpclog.Infof("Waiting for localhost:%d to get ready", port) select { case <-ctx.Done(): return err case <-ch: return err case <-time.After(10 * time.Millisecond): } } } func runServers(ctx context.Context) <-chan error { ch := make(chan error, 3) go func() { if err := server.Run(ctx, *network, *endpoint); err != nil { ch <- fmt.Errorf("cannot run grpc service: %v", err) } }() go func() { if err := runGateway(ctx, ":8088"); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() go func() { if err := server.RunInProcessGateway(ctx, ":8089"); err != nil { ch <- fmt.Errorf("cannot run in process gateway service: %v", err) } }() return ch } func TestMain(m *testing.M) { flag.Parse() ctx, cancel := context.WithCancel(context.Background()) defer cancel() errCh := runServers(ctx) ch := make(chan int, 1) go func() { if err := waitForGateway(ctx, 8088); err != nil { grpclog.Errorf("waitForGateway(ctx, 8088) failed with %v; want success", err) } ch <- m.Run() }() select { case err := <-errCh: fmt.Fprintln(os.Stderr, err) os.Exit(1) case status := <-ch: cancel() os.Exit(status) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/000077500000000000000000000000001465037340600264615ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/000077500000000000000000000000001465037340600304365ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/BUILD.bazel000066400000000000000000000141711465037340600323200ustar00rootroot00000000000000load("@grpc_ecosystem_grpc_gateway//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) # TODO(yannic): Add examples/tests that use import_prefix/strip_import_prefix. # gazelle:exclude a_bit_of_everything.pb.gw.go # gazelle:exclude a_bit_of_everything_grpc.pb.go # gazelle:exclude echo_service.pb.gw.go # gazelle:exclude echo_service_grpc.pb.go # gazelle:exclude enum_with_single_value.pb.gw.go # gazelle:exclude enum_with_single_value.pb.go # gazelle:exclude flow_combination.pb.gw.go # gazelle:exclude flow_combination_grpc.pb.go # gazelle:exclude generate_unbound_methods.pb.gw.go # gazelle:exclude generate_unbound_methods_grpc.pb.go # gazelle:exclude generated_input.proto # gazelle:exclude non_standard_names.pb.gw.go # gazelle:exclude non_standard_names_grpc.pb.go # gazelle:exclude response_body_service.pb.gw.go # gazelle:exclude response_body_service_grpc.pb.go # gazelle:exclude stream.pb.gw.go # gazelle:exclude stream_grpc.pb.go # gazelle:exclude use_go_template.pb.gw.go # gazelle:exclude use_go_template_grpc.pb.go # gazelle:exclude ignore_comment.pb.gw.go # gazelle:exclude remove_internal_comment.pb.gw.go # gazelle:exclude ignore_comment_grpc.pb.go # gazelle:exclude wrappers.pb.gw.go # gazelle:exclude wrappers_grpc.pb.go # gazelle:exclude unannotated_echo_service.pb.gw.go # gazelle:exclude unannotated_echo_service_grpc.pb.go # gazelle:exclude visibility_rule_echo_service.pb.gw.go # gazelle:exclude visibility_rule_echo_service_grpc.pb.go # gazelle:exclude openapi_merge_a.proto # gazelle:exclude openapi_merge_b.proto # gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc, //protoc-gen-grpc-gateway:go_gen_grpc_gateway genrule( name = "generated_proto", srcs = ["generated_input.proto"], outs = ["generated_output.proto"], cmd = "cp $< $@", # A simple copy simulates a generated proto file. ) proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", "echo_service.proto", "enum_with_single_value.proto", "flow_combination.proto", "generate_unbound_methods.proto", "generated_output.proto", "ignore_comment.proto", "non_standard_names.proto", "remove_internal_comment.proto", "response_body_service.proto", "stream.proto", "unannotated_echo_service.proto", "use_go_template.proto", "visibility_rule_echo_service.proto", "wrappers.proto", ], deps = [ "//examples/internal/proto/oneofenum:oneofenum_proto", "//examples/internal/proto/pathenum:pathenum_proto", "//examples/internal/proto/sub:sub_proto", "//examples/internal/proto/sub2:sub2_proto", "//protoc-gen-openapiv2/options:options_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:struct_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", "@googleapis//google/api:annotations_proto", "@googleapis//google/api:field_behavior_proto", "@googleapis//google/api:httpbody_proto", "@googleapis//google/api:visibility_proto", "@googleapis//google/rpc:status_proto", ], ) #keep proto_library( name = "openapi_merge_proto", srcs = [ "openapi_merge_a.proto", "openapi_merge_b.proto", ], deps = [ "@com_google_protobuf//:api_proto", "@googleapis//google/api:annotations_proto", "@googleapis//google/api:field_behavior_proto", "@googleapis//google/rpc:status_proto", ], ) go_proto_library( name = "examplepb_go_proto", compilers = [ "//:go_apiv2", "//:go_grpc", "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", proto = ":examplepb_proto", deps = [ "//examples/internal/proto/oneofenum", "//examples/internal/proto/pathenum", "//examples/internal/proto/sub", "//examples/internal/proto/sub2", "//protoc-gen-openapiv2/options", "@com_github_golang_protobuf//descriptor:go_default_library_gen", # keep "@org_golang_google_genproto_googleapis_api//annotations", "@org_golang_google_genproto_googleapis_api//httpbody", "@org_golang_google_genproto_googleapis_api//visibility", "@org_golang_google_genproto_googleapis_rpc//status", ], ) go_library( name = "examplepb", srcs = [ "openapi_merge_a.pb.go", "openapi_merge_a.pb.gw.go", "openapi_merge_a_grpc.pb.go", "openapi_merge_b.pb.go", "openapi_merge_b.pb.gw.go", "openapi_merge_b_grpc.pb.go", ], embed = [":examplepb_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb", deps = [ "//runtime", "//utilities", "@org_golang_google_genproto_googleapis_api//annotations", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", ], ) protoc_gen_openapiv2( name = "examplepb_protoc_gen_openapiv2", proto = ":examplepb_proto", ) protoc_gen_openapiv2( name = "examplepb_protoc_gen_openapiv2_merged", proto = ":examplepb_proto", single_output = True, # Outputs a single swagger.json file. ) protoc_gen_openapiv2( name = "examplepb_openapi_merge", proto = ":openapi_merge_proto", single_output = True, # Outputs a single swagger.json file. ) alias( name = "go_default_library", actual = ":examplepb", visibility = ["//examples:__subpackages__"], ) a_bit_of_everything.pb.go000066400000000000000000005665571465037340600353440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/a_bit_of_everything.proto package examplepb import ( oneofenum "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum" pathenum "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" sub2 "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" status "google.golang.org/genproto/googleapis/rpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" emptypb "google.golang.org/protobuf/types/known/emptypb" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 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) ) // NumericEnum is one or zero. type NumericEnum int32 const ( // ZERO means 0 NumericEnum_ZERO NumericEnum = 0 // ONE means 1 NumericEnum_ONE NumericEnum = 1 ) // Enum value maps for NumericEnum. var ( NumericEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", } NumericEnum_value = map[string]int32{ "ZERO": 0, "ONE": 1, } ) func (x NumericEnum) Enum() *NumericEnum { p := new(NumericEnum) *p = x return p } func (x NumericEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (NumericEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[0].Descriptor() } func (NumericEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[0] } func (x NumericEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use NumericEnum.Descriptor instead. func (NumericEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{0} } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE type SnakeCaseEnum int32 const ( // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCaseEnum_value_c SnakeCaseEnum = 0 // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCaseEnum_value_d SnakeCaseEnum = 1 ) // Enum value maps for SnakeCaseEnum. var ( SnakeCaseEnum_name = map[int32]string{ 0: "value_c", 1: "value_d", } SnakeCaseEnum_value = map[string]int32{ "value_c": 0, "value_d": 1, } ) func (x SnakeCaseEnum) Enum() *SnakeCaseEnum { p := new(SnakeCaseEnum) *p = x return p } func (x SnakeCaseEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SnakeCaseEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[1].Descriptor() } func (SnakeCaseEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[1] } func (x SnakeCaseEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SnakeCaseEnum.Descriptor instead. func (SnakeCaseEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{1} } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE type SnakeCase_0Enum int32 const ( // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCase_0Enum_value_e SnakeCase_0Enum = 0 // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCase_0Enum_value_f SnakeCase_0Enum = 1 ) // Enum value maps for SnakeCase_0Enum. var ( SnakeCase_0Enum_name = map[int32]string{ 0: "value_e", 1: "value_f", } SnakeCase_0Enum_value = map[string]int32{ "value_e": 0, "value_f": 1, } ) func (x SnakeCase_0Enum) Enum() *SnakeCase_0Enum { p := new(SnakeCase_0Enum) *p = x return p } func (x SnakeCase_0Enum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SnakeCase_0Enum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[2].Descriptor() } func (SnakeCase_0Enum) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[2] } func (x SnakeCase_0Enum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SnakeCase_0Enum.Descriptor instead. func (SnakeCase_0Enum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{2} } // DeepEnum is one or zero. type ABitOfEverything_Nested_DeepEnum int32 const ( // FALSE is false. ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0 // TRUE is true. ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 ) // Enum value maps for ABitOfEverything_Nested_DeepEnum. var ( ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ 0: "FALSE", 1: "TRUE", } ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ "FALSE": 0, "TRUE": 1, } ) func (x ABitOfEverything_Nested_DeepEnum) Enum() *ABitOfEverything_Nested_DeepEnum { p := new(ABitOfEverything_Nested_DeepEnum) *p = x return p } func (x ABitOfEverything_Nested_DeepEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (ABitOfEverything_Nested_DeepEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[3].Descriptor() } func (ABitOfEverything_Nested_DeepEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes[3] } func (x ABitOfEverything_Nested_DeepEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use ABitOfEverything_Nested_DeepEnum.Descriptor instead. func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{2, 0, 0} } type ErrorResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields CorrelationId string `protobuf:"bytes,1,opt,name=correlationId,proto3" json:"correlationId,omitempty"` Error *ErrorObject `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` } func (x *ErrorResponse) Reset() { *x = ErrorResponse{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ErrorResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*ErrorResponse) ProtoMessage() {} func (x *ErrorResponse) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 ErrorResponse.ProtoReflect.Descriptor instead. func (*ErrorResponse) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{0} } func (x *ErrorResponse) GetCorrelationId() string { if x != nil { return x.CorrelationId } return "" } func (x *ErrorResponse) GetError() *ErrorObject { if x != nil { return x.Error } return nil } type ErrorObject struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` } func (x *ErrorObject) Reset() { *x = ErrorObject{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ErrorObject) String() string { return protoimpl.X.MessageStringOf(x) } func (*ErrorObject) ProtoMessage() {} func (x *ErrorObject) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 ErrorObject.ProtoReflect.Descriptor instead. func (*ErrorObject) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{1} } func (x *ErrorObject) GetCode() int32 { if x != nil { return x.Code } return 0 } func (x *ErrorObject) GetMessage() string { if x != nil { return x.Message } return "" } // Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested,proto3" json:"nested,omitempty"` FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value,proto3" json:"fixed64_value,omitempty"` Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value,proto3" json:"fixed32_value,omitempty"` BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum" json:"enum_value,omitempty"` PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,proto3,enum=grpc.gateway.examples.internal.pathenum.PathEnum" json:"path_enum_value,omitempty"` NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,proto3,enum=grpc.gateway.examples.internal.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value,proto3" json:"sint64_value,omitempty"` RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue,proto3" json:"repeated_string_value,omitempty"` // Types that are assignable to OneofValue: // // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum"` MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` TimestampValue *timestamppb.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` // repeated numeric enum comment (This comment is overridden by the field annotation) RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` // numeric enum comment (This comment is overridden by the field annotation) EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` // repeated string comment (This comment is overridden by the field annotation) RepeatedStringAnnotation []string `protobuf:"bytes,34,rep,name=repeated_string_annotation,json=repeatedStringAnnotation,proto3" json:"repeated_string_annotation,omitempty"` // repeated nested object comment (This comment is overridden by the field annotation) RepeatedNestedAnnotation []*ABitOfEverything_Nested `protobuf:"bytes,35,rep,name=repeated_nested_annotation,json=repeatedNestedAnnotation,proto3" json:"repeated_nested_annotation,omitempty"` // nested object comments (This comment is overridden by the field annotation) NestedAnnotation *ABitOfEverything_Nested `protobuf:"bytes,36,opt,name=nested_annotation,json=nestedAnnotation,proto3" json:"nested_annotation,omitempty"` Int64OverrideType int64 `protobuf:"varint,37,opt,name=int64_override_type,json=int64OverrideType,proto3" json:"int64_override_type,omitempty"` // mark a field as required in Open API definition RequiredStringViaFieldBehaviorAnnotation string `protobuf:"bytes,38,opt,name=required_string_via_field_behavior_annotation,json=requiredStringViaFieldBehaviorAnnotation,proto3" json:"required_string_via_field_behavior_annotation,omitempty"` // mark a field as readonly in Open API definition OutputOnlyStringViaFieldBehaviorAnnotation string `protobuf:"bytes,39,opt,name=output_only_string_via_field_behavior_annotation,json=outputOnlyStringViaFieldBehaviorAnnotation,proto3" json:"output_only_string_via_field_behavior_annotation,omitempty"` OptionalStringValue *string `protobuf:"bytes,40,opt,name=optional_string_value,json=optionalStringValue,proto3,oneof" json:"optional_string_value,omitempty"` // Test openapiv2 generation of repeated fields ProductId []string `protobuf:"bytes,41,rep,name=product_id,json=productId,proto3" json:"product_id,omitempty"` // Test openapiv2 generation of required fields with annotation and jsonschema to reproduce OptionalStringField string `protobuf:"bytes,42,opt,name=optional_string_field,json=optionalStringField,proto3" json:"optional_string_field,omitempty"` RequiredStringField_1 string `protobuf:"bytes,43,opt,name=required_string_field_1,json=requiredStringField1,proto3" json:"required_string_field_1,omitempty"` RequiredStringField_2 string `protobuf:"bytes,44,opt,name=required_string_field_2,json=requiredStringField2,proto3" json:"required_string_field_2,omitempty"` // Test openapiv2 handling of required json_name fields RequiredFieldBehaviorJsonName string `protobuf:"bytes,45,opt,name=required_field_behavior_json_name,json=required_field_behavior_json_name_custom,proto3" json:"required_field_behavior_json_name,omitempty"` RequiredFieldSchemaJsonName string `protobuf:"bytes,46,opt,name=required_field_schema_json_name,json=required_field_schema_json_name_custom,proto3" json:"required_field_schema_json_name,omitempty"` TrailingOnly string `protobuf:"bytes,47,opt,name=trailing_only,json=trailingOnly,proto3" json:"trailing_only,omitempty"` // Trailing only TrailingOnlyDot string `protobuf:"bytes,48,opt,name=trailing_only_dot,json=trailingOnlyDot,proto3" json:"trailing_only_dot,omitempty"` // Trailing only dot. // Leading both TrailingBoth string `protobuf:"bytes,49,opt,name=trailing_both,json=trailingBoth,proto3" json:"trailing_both,omitempty"` // Trailing both. // Leading multiline // // This is an example of a multi-line comment. TrailingMultiline string `protobuf:"bytes,50,opt,name=trailing_multiline,json=trailingMultiline,proto3" json:"trailing_multiline,omitempty"` // Trailing multiline. // Specify a custom format of repeated field items Uuids []string `protobuf:"bytes,51,rep,name=uuids,proto3" json:"uuids,omitempty"` } func (x *ABitOfEverything) Reset() { *x = ABitOfEverything{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ABitOfEverything) String() string { return protoimpl.X.MessageStringOf(x) } func (*ABitOfEverything) ProtoMessage() {} func (x *ABitOfEverything) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 ABitOfEverything.ProtoReflect.Descriptor instead. func (*ABitOfEverything) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{2} } func (x *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { if x != nil { return x.SingleNested } return nil } func (x *ABitOfEverything) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { if x != nil { return x.Nested } return nil } func (x *ABitOfEverything) GetFloatValue() float32 { if x != nil { return x.FloatValue } return 0 } func (x *ABitOfEverything) GetDoubleValue() float64 { if x != nil { return x.DoubleValue } return 0 } func (x *ABitOfEverything) GetInt64Value() int64 { if x != nil { return x.Int64Value } return 0 } func (x *ABitOfEverything) GetUint64Value() uint64 { if x != nil { return x.Uint64Value } return 0 } func (x *ABitOfEverything) GetInt32Value() int32 { if x != nil { return x.Int32Value } return 0 } func (x *ABitOfEverything) GetFixed64Value() uint64 { if x != nil { return x.Fixed64Value } return 0 } func (x *ABitOfEverything) GetFixed32Value() uint32 { if x != nil { return x.Fixed32Value } return 0 } func (x *ABitOfEverything) GetBoolValue() bool { if x != nil { return x.BoolValue } return false } func (x *ABitOfEverything) GetStringValue() string { if x != nil { return x.StringValue } return "" } func (x *ABitOfEverything) GetBytesValue() []byte { if x != nil { return x.BytesValue } return nil } func (x *ABitOfEverything) GetUint32Value() uint32 { if x != nil { return x.Uint32Value } return 0 } func (x *ABitOfEverything) GetEnumValue() NumericEnum { if x != nil { return x.EnumValue } return NumericEnum_ZERO } func (x *ABitOfEverything) GetPathEnumValue() pathenum.PathEnum { if x != nil { return x.PathEnumValue } return pathenum.PathEnum(0) } func (x *ABitOfEverything) GetNestedPathEnumValue() pathenum.MessagePathEnum_NestedPathEnum { if x != nil { return x.NestedPathEnumValue } return pathenum.MessagePathEnum_NestedPathEnum(0) } func (x *ABitOfEverything) GetSfixed32Value() int32 { if x != nil { return x.Sfixed32Value } return 0 } func (x *ABitOfEverything) GetSfixed64Value() int64 { if x != nil { return x.Sfixed64Value } return 0 } func (x *ABitOfEverything) GetSint32Value() int32 { if x != nil { return x.Sint32Value } return 0 } func (x *ABitOfEverything) GetSint64Value() int64 { if x != nil { return x.Sint64Value } return 0 } func (x *ABitOfEverything) GetRepeatedStringValue() []string { if x != nil { return x.RepeatedStringValue } return nil } func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { if m != nil { return m.OneofValue } return nil } func (x *ABitOfEverything) GetOneofEmpty() *emptypb.Empty { if x, ok := x.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty } return nil } func (x *ABitOfEverything) GetOneofString() string { if x, ok := x.GetOneofValue().(*ABitOfEverything_OneofString); ok { return x.OneofString } return "" } func (x *ABitOfEverything) GetMapValue() map[string]NumericEnum { if x != nil { return x.MapValue } return nil } func (x *ABitOfEverything) GetMappedStringValue() map[string]string { if x != nil { return x.MappedStringValue } return nil } func (x *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested { if x != nil { return x.MappedNestedValue } return nil } func (x *ABitOfEverything) GetNonConventionalNameValue() string { if x != nil { return x.NonConventionalNameValue } return "" } func (x *ABitOfEverything) GetTimestampValue() *timestamppb.Timestamp { if x != nil { return x.TimestampValue } return nil } func (x *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { if x != nil { return x.RepeatedEnumValue } return nil } func (x *ABitOfEverything) GetRepeatedEnumAnnotation() []NumericEnum { if x != nil { return x.RepeatedEnumAnnotation } return nil } func (x *ABitOfEverything) GetEnumValueAnnotation() NumericEnum { if x != nil { return x.EnumValueAnnotation } return NumericEnum_ZERO } func (x *ABitOfEverything) GetRepeatedStringAnnotation() []string { if x != nil { return x.RepeatedStringAnnotation } return nil } func (x *ABitOfEverything) GetRepeatedNestedAnnotation() []*ABitOfEverything_Nested { if x != nil { return x.RepeatedNestedAnnotation } return nil } func (x *ABitOfEverything) GetNestedAnnotation() *ABitOfEverything_Nested { if x != nil { return x.NestedAnnotation } return nil } func (x *ABitOfEverything) GetInt64OverrideType() int64 { if x != nil { return x.Int64OverrideType } return 0 } func (x *ABitOfEverything) GetRequiredStringViaFieldBehaviorAnnotation() string { if x != nil { return x.RequiredStringViaFieldBehaviorAnnotation } return "" } func (x *ABitOfEverything) GetOutputOnlyStringViaFieldBehaviorAnnotation() string { if x != nil { return x.OutputOnlyStringViaFieldBehaviorAnnotation } return "" } func (x *ABitOfEverything) GetOptionalStringValue() string { if x != nil && x.OptionalStringValue != nil { return *x.OptionalStringValue } return "" } func (x *ABitOfEverything) GetProductId() []string { if x != nil { return x.ProductId } return nil } func (x *ABitOfEverything) GetOptionalStringField() string { if x != nil { return x.OptionalStringField } return "" } func (x *ABitOfEverything) GetRequiredStringField_1() string { if x != nil { return x.RequiredStringField_1 } return "" } func (x *ABitOfEverything) GetRequiredStringField_2() string { if x != nil { return x.RequiredStringField_2 } return "" } func (x *ABitOfEverything) GetRequiredFieldBehaviorJsonName() string { if x != nil { return x.RequiredFieldBehaviorJsonName } return "" } func (x *ABitOfEverything) GetRequiredFieldSchemaJsonName() string { if x != nil { return x.RequiredFieldSchemaJsonName } return "" } func (x *ABitOfEverything) GetTrailingOnly() string { if x != nil { return x.TrailingOnly } return "" } func (x *ABitOfEverything) GetTrailingOnlyDot() string { if x != nil { return x.TrailingOnlyDot } return "" } func (x *ABitOfEverything) GetTrailingBoth() string { if x != nil { return x.TrailingBoth } return "" } func (x *ABitOfEverything) GetTrailingMultiline() string { if x != nil { return x.TrailingMultiline } return "" } func (x *ABitOfEverything) GetUuids() []string { if x != nil { return x.Uuids } return nil } type isABitOfEverything_OneofValue interface { isABitOfEverything_OneofValue() } type ABitOfEverything_OneofEmpty struct { OneofEmpty *emptypb.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` } type ABitOfEverything_OneofString struct { OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` } func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} // ABitOfEverythingRepeated is used to validate repeated path parameter functionality type ABitOfEverythingRepeated struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // repeated values. they are comma-separated in path PathRepeatedFloatValue []float32 `protobuf:"fixed32,1,rep,packed,name=path_repeated_float_value,json=pathRepeatedFloatValue,proto3" json:"path_repeated_float_value,omitempty"` PathRepeatedDoubleValue []float64 `protobuf:"fixed64,2,rep,packed,name=path_repeated_double_value,json=pathRepeatedDoubleValue,proto3" json:"path_repeated_double_value,omitempty"` PathRepeatedInt64Value []int64 `protobuf:"varint,3,rep,packed,name=path_repeated_int64_value,json=pathRepeatedInt64Value,proto3" json:"path_repeated_int64_value,omitempty"` PathRepeatedUint64Value []uint64 `protobuf:"varint,4,rep,packed,name=path_repeated_uint64_value,json=pathRepeatedUint64Value,proto3" json:"path_repeated_uint64_value,omitempty"` PathRepeatedInt32Value []int32 `protobuf:"varint,5,rep,packed,name=path_repeated_int32_value,json=pathRepeatedInt32Value,proto3" json:"path_repeated_int32_value,omitempty"` PathRepeatedFixed64Value []uint64 `protobuf:"fixed64,6,rep,packed,name=path_repeated_fixed64_value,json=pathRepeatedFixed64Value,proto3" json:"path_repeated_fixed64_value,omitempty"` PathRepeatedFixed32Value []uint32 `protobuf:"fixed32,7,rep,packed,name=path_repeated_fixed32_value,json=pathRepeatedFixed32Value,proto3" json:"path_repeated_fixed32_value,omitempty"` PathRepeatedBoolValue []bool `protobuf:"varint,8,rep,packed,name=path_repeated_bool_value,json=pathRepeatedBoolValue,proto3" json:"path_repeated_bool_value,omitempty"` PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue,proto3" json:"path_repeated_string_value,omitempty"` PathRepeatedBytesValue [][]byte `protobuf:"bytes,10,rep,name=path_repeated_bytes_value,json=pathRepeatedBytesValue,proto3" json:"path_repeated_bytes_value,omitempty"` PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value,proto3" json:"path_repeated_uint32_value,omitempty"` PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value,proto3" json:"path_repeated_sfixed32_value,omitempty"` PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value,proto3" json:"path_repeated_sfixed64_value,omitempty"` PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value,proto3" json:"path_repeated_sint32_value,omitempty"` PathRepeatedSint64Value []int64 `protobuf:"zigzag64,16,rep,packed,name=path_repeated_sint64_value,json=pathRepeatedSint64Value,proto3" json:"path_repeated_sint64_value,omitempty"` } func (x *ABitOfEverythingRepeated) Reset() { *x = ABitOfEverythingRepeated{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ABitOfEverythingRepeated) String() string { return protoimpl.X.MessageStringOf(x) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (x *ABitOfEverythingRepeated) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 ABitOfEverythingRepeated.ProtoReflect.Descriptor instead. func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{3} } func (x *ABitOfEverythingRepeated) GetPathRepeatedFloatValue() []float32 { if x != nil { return x.PathRepeatedFloatValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedDoubleValue() []float64 { if x != nil { return x.PathRepeatedDoubleValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedInt64Value() []int64 { if x != nil { return x.PathRepeatedInt64Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedUint64Value() []uint64 { if x != nil { return x.PathRepeatedUint64Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedInt32Value() []int32 { if x != nil { return x.PathRepeatedInt32Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedFixed64Value() []uint64 { if x != nil { return x.PathRepeatedFixed64Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedFixed32Value() []uint32 { if x != nil { return x.PathRepeatedFixed32Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedBoolValue() []bool { if x != nil { return x.PathRepeatedBoolValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedStringValue() []string { if x != nil { return x.PathRepeatedStringValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedBytesValue() [][]byte { if x != nil { return x.PathRepeatedBytesValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedUint32Value() []uint32 { if x != nil { return x.PathRepeatedUint32Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedEnumValue() []NumericEnum { if x != nil { return x.PathRepeatedEnumValue } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedSfixed32Value() []int32 { if x != nil { return x.PathRepeatedSfixed32Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedSfixed64Value() []int64 { if x != nil { return x.PathRepeatedSfixed64Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedSint32Value() []int32 { if x != nil { return x.PathRepeatedSint32Value } return nil } func (x *ABitOfEverythingRepeated) GetPathRepeatedSint64Value() []int64 { if x != nil { return x.PathRepeatedSint64Value } return nil } type CheckStatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Status *status.Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` } func (x *CheckStatusResponse) Reset() { *x = CheckStatusResponse{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *CheckStatusResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*CheckStatusResponse) ProtoMessage() {} func (x *CheckStatusResponse) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 CheckStatusResponse.ProtoReflect.Descriptor instead. func (*CheckStatusResponse) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{4} } func (x *CheckStatusResponse) GetStatus() *status.Status { if x != nil { return x.Status } return nil } type Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (x *Body) Reset() { *x = Body{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Body) String() string { return protoimpl.X.MessageStringOf(x) } func (*Body) ProtoMessage() {} func (x *Body) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 Body.ProtoReflect.Descriptor instead. func (*Body) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{5} } func (x *Body) GetName() string { if x != nil { return x.Name } return "" } type MessageWithBody struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Data *Body `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } func (x *MessageWithBody) Reset() { *x = MessageWithBody{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MessageWithBody) String() string { return protoimpl.X.MessageStringOf(x) } func (*MessageWithBody) ProtoMessage() {} func (x *MessageWithBody) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 MessageWithBody.ProtoReflect.Descriptor instead. func (*MessageWithBody) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{6} } func (x *MessageWithBody) GetId() string { if x != nil { return x.Id } return "" } func (x *MessageWithBody) GetData() *Body { if x != nil { return x.Data } return nil } // UpdateV2Request request for update includes the message and the update mask type UpdateV2Request struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Abe *ABitOfEverything `protobuf:"bytes,1,opt,name=abe,proto3" json:"abe,omitempty"` // The paths to update. UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *UpdateV2Request) Reset() { *x = UpdateV2Request{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UpdateV2Request) String() string { return protoimpl.X.MessageStringOf(x) } func (*UpdateV2Request) ProtoMessage() {} func (x *UpdateV2Request) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 UpdateV2Request.ProtoReflect.Descriptor instead. func (*UpdateV2Request) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{7} } func (x *UpdateV2Request) GetAbe() *ABitOfEverything { if x != nil { return x.Abe } return nil } func (x *UpdateV2Request) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } // An example resource type from AIP-123 used to test the behavior described in // the CreateBookRequest message. // // See: https://google.aip.dev/123 type Book struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The resource name of the book. // // Format: `publishers/{publisher}/books/{book}` // // Example: `publishers/1257894000000000000/books/my-book` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Output only. The book's ID. Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // Output only. Creation time of the book. CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` } func (x *Book) Reset() { *x = Book{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Book) String() string { return protoimpl.X.MessageStringOf(x) } func (*Book) ProtoMessage() {} func (x *Book) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 Book.ProtoReflect.Descriptor instead. func (*Book) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{8} } func (x *Book) GetName() string { if x != nil { return x.Name } return "" } func (x *Book) GetId() string { if x != nil { return x.Id } return "" } func (x *Book) GetCreateTime() *timestamppb.Timestamp { if x != nil { return x.CreateTime } return nil } // A standard Create message from AIP-133 with a user-specified ID. // The user-specified ID (the `book_id` field in this example) must become a // query parameter in the OpenAPI spec. // // See: https://google.aip.dev/133#user-specified-ids type CreateBookRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The publisher in which to create the book. // // Format: `publishers/{publisher}` // // Example: `publishers/1257894000000000000` Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // The book to create. Book *Book `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"` // The ID to use for the book. // // This must start with an alphanumeric character. BookId string `protobuf:"bytes,3,opt,name=book_id,json=bookId,proto3" json:"book_id,omitempty"` } func (x *CreateBookRequest) Reset() { *x = CreateBookRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *CreateBookRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*CreateBookRequest) ProtoMessage() {} func (x *CreateBookRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 CreateBookRequest.ProtoReflect.Descriptor instead. func (*CreateBookRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{9} } func (x *CreateBookRequest) GetParent() string { if x != nil { return x.Parent } return "" } func (x *CreateBookRequest) GetBook() *Book { if x != nil { return x.Book } return nil } func (x *CreateBookRequest) GetBookId() string { if x != nil { return x.BookId } return "" } // A standard Update message from AIP-134 // // See: https://google.aip.dev/134#request-message type UpdateBookRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The book to update. // // The book's `name` field is used to identify the book to be updated. // Format: publishers/{publisher}/books/{book} Book *Book `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"` // The list of fields to be updated. UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` // If set to true, and the book is not found, a new book will be created. // In this situation, `update_mask` is ignored. AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"` } func (x *UpdateBookRequest) Reset() { *x = UpdateBookRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UpdateBookRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*UpdateBookRequest) ProtoMessage() {} func (x *UpdateBookRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 UpdateBookRequest.ProtoReflect.Descriptor instead. func (*UpdateBookRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{10} } func (x *UpdateBookRequest) GetBook() *Book { if x != nil { return x.Book } return nil } func (x *UpdateBookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } func (x *UpdateBookRequest) GetAllowMissing() bool { if x != nil { return x.AllowMissing } return false } type SnakeEnumRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields What SnakeCaseEnum `protobuf:"varint,1,opt,name=what,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.SnakeCaseEnum" json:"what,omitempty"` Who SnakeCase_0Enum `protobuf:"varint,2,opt,name=who,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.SnakeCase_0Enum" json:"who,omitempty"` Where pathenum.SnakeCaseForImport `protobuf:"varint,3,opt,name=where,proto3,enum=grpc.gateway.examples.internal.pathenum.SnakeCaseForImport" json:"where,omitempty"` } func (x *SnakeEnumRequest) Reset() { *x = SnakeEnumRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SnakeEnumRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*SnakeEnumRequest) ProtoMessage() {} func (x *SnakeEnumRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 SnakeEnumRequest.ProtoReflect.Descriptor instead. func (*SnakeEnumRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{11} } func (x *SnakeEnumRequest) GetWhat() SnakeCaseEnum { if x != nil { return x.What } return SnakeCaseEnum_value_c } func (x *SnakeEnumRequest) GetWho() SnakeCase_0Enum { if x != nil { return x.Who } return SnakeCase_0Enum_value_e } func (x *SnakeEnumRequest) GetWhere() pathenum.SnakeCaseForImport { if x != nil { return x.Where } return pathenum.SnakeCaseForImport(0) } type SnakeEnumResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *SnakeEnumResponse) Reset() { *x = SnakeEnumResponse{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SnakeEnumResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*SnakeEnumResponse) ProtoMessage() {} func (x *SnakeEnumResponse) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_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 SnakeEnumResponse.ProtoReflect.Descriptor instead. func (*SnakeEnumResponse) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{12} } // Required message type -> OpenAPI // https://github.com/grpc-ecosystem/grpc-gateway/issues/2837 type RequiredMessageTypeRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Foo *Foo `protobuf:"bytes,2,opt,name=foo,proto3" json:"foo,omitempty"` } func (x *RequiredMessageTypeRequest) Reset() { *x = RequiredMessageTypeRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RequiredMessageTypeRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*RequiredMessageTypeRequest) ProtoMessage() {} func (x *RequiredMessageTypeRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[13] 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 RequiredMessageTypeRequest.ProtoReflect.Descriptor instead. func (*RequiredMessageTypeRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{13} } func (x *RequiredMessageTypeRequest) GetId() string { if x != nil { return x.Id } return "" } func (x *RequiredMessageTypeRequest) GetFoo() *Foo { if x != nil { return x.Foo } return nil } type Foo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Bar *Bar `protobuf:"bytes,1,opt,name=bar,proto3" json:"bar,omitempty"` } func (x *Foo) Reset() { *x = Foo{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Foo) String() string { return protoimpl.X.MessageStringOf(x) } func (*Foo) ProtoMessage() {} func (x *Foo) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[14] 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 Foo.ProtoReflect.Descriptor instead. func (*Foo) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{14} } func (x *Foo) GetBar() *Bar { if x != nil { return x.Bar } return nil } type Bar struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *Bar) Reset() { *x = Bar{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Bar) String() string { return protoimpl.X.MessageStringOf(x) } func (*Bar) ProtoMessage() {} func (x *Bar) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[15] 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 Bar.ProtoReflect.Descriptor instead. func (*Bar) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{15} } func (x *Bar) GetId() string { if x != nil { return x.Id } return "" } // Nested is nested type. type ABitOfEverything_Nested struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // name is nested field. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // DeepEnum comment. Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` } func (x *ABitOfEverything_Nested) Reset() { *x = ABitOfEverything_Nested{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ABitOfEverything_Nested) String() string { return protoimpl.X.MessageStringOf(x) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (x *ABitOfEverything_Nested) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[16] 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 ABitOfEverything_Nested.ProtoReflect.Descriptor instead. func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{2, 0} } func (x *ABitOfEverything_Nested) GetName() string { if x != nil { return x.Name } return "" } func (x *ABitOfEverything_Nested) GetAmount() uint32 { if x != nil { return x.Amount } return 0 } func (x *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { if x != nil { return x.Ok } return ABitOfEverything_Nested_FALSE } var File_examples_internal_proto_examplepb_a_bit_of_everything_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc = []byte{ 0x0a, 0x3b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x32, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x30, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x32, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc6, 0x02, 0x0a, 0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xe1, 0x01, 0x0a, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0xba, 0x01, 0x92, 0x41, 0xb6, 0x01, 0x2a, 0x10, 0x78, 0x2d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x69, 0x64, 0x32, 0x2b, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x4a, 0x26, 0x22, 0x32, 0x34, 0x33, 0x38, 0x61, 0x63, 0x33, 0x63, 0x2d, 0x33, 0x37, 0x65, 0x62, 0x2d, 0x34, 0x39, 0x30, 0x32, 0x2d, 0x61, 0x64, 0x65, 0x66, 0x2d, 0x65, 0x64, 0x31, 0x36, 0x62, 0x34, 0x34, 0x33, 0x31, 0x30, 0x33, 0x30, 0x22, 0x8a, 0x01, 0x45, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x38, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x34, 0x7d, 0x2d, 0x34, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, 0x2d, 0x5b, 0x38, 0x39, 0x41, 0x42, 0x5d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x31, 0x32, 0x7d, 0x24, 0xa2, 0x02, 0x04, 0x75, 0x75, 0x69, 0x64, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x51, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xa0, 0x01, 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x2c, 0x92, 0x41, 0x29, 0x2a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x32, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x8a, 0x01, 0x07, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0xa2, 0x02, 0x07, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x4f, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0x92, 0x41, 0x32, 0x2a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x10, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x8a, 0x01, 0x14, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x31, 0x2c, 0x20, 0x33, 0x32, 0x7d, 0x24, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xae, 0x25, 0x0a, 0x10, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x6c, 0x0a, 0x0d, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x0c, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x90, 0x01, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x7c, 0x92, 0x41, 0x79, 0x80, 0x01, 0x01, 0x8a, 0x01, 0x4b, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x38, 0x7d, 0x2d, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x7d, 0x2d, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x7d, 0x2d, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x7d, 0x2d, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x31, 0x32, 0x7d, 0xa2, 0x02, 0x04, 0x75, 0x75, 0x69, 0x64, 0x82, 0x03, 0x10, 0x0a, 0x0a, 0x78, 0x2d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x02, 0x20, 0x01, 0xca, 0x3e, 0x0b, 0xfa, 0x02, 0x08, 0x75, 0x75, 0x69, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x5f, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x4a, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x42, 0x29, 0x92, 0x41, 0x26, 0x32, 0x11, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x03, 0x30, 0x2e, 0x32, 0xd2, 0x01, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0c, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x07, 0x52, 0x0c, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x5a, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x59, 0x0a, 0x0f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x7c, 0x0a, 0x16, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x13, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x0d, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x10, 0x52, 0x0d, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0b, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0b, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x6b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x87, 0x01, 0x0a, 0x13, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x87, 0x01, 0x0a, 0x13, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x6e, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x6e, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1b, 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, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x6b, 0x0a, 0x13, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1c, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x11, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0xbb, 0x01, 0x0a, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x20, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x44, 0x92, 0x41, 0x41, 0x2a, 0x1b, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x32, 0x22, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x16, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xa3, 0x01, 0x0a, 0x15, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x32, 0x92, 0x41, 0x2f, 0x2a, 0x12, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x32, 0x19, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x13, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x76, 0x0a, 0x1a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x22, 0x20, 0x03, 0x28, 0x09, 0x42, 0x38, 0x92, 0x41, 0x35, 0x2a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x32, 0x1c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xcd, 0x01, 0x0a, 0x1a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x42, 0x46, 0x92, 0x41, 0x43, 0x2a, 0x1c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x32, 0x23, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xaa, 0x01, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x42, 0x34, 0x92, 0x41, 0x31, 0x2a, 0x13, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x32, 0x1a, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x13, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0x92, 0x41, 0x04, 0x9a, 0x02, 0x01, 0x03, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x65, 0x0a, 0x2d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x69, 0x61, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x26, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x28, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x69, 0x61, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x6a, 0x0a, 0x30, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x69, 0x61, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x2a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, 0x6e, 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x69, 0x61, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x15, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x4c, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x29, 0x20, 0x03, 0x28, 0x09, 0x42, 0x2d, 0x92, 0x41, 0x2a, 0x32, 0x18, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2e, 0x78, 0x13, 0x80, 0x01, 0x01, 0x8a, 0x01, 0x08, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0x2b, 0x24, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3b, 0x0a, 0x17, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x31, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x14, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x3b, 0x0a, 0x17, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x32, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x14, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x12, 0x59, 0x0a, 0x21, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x28, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x4f, 0x0a, 0x1f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x26, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x64, 0x6f, 0x74, 0x18, 0x30, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x4f, 0x6e, 0x6c, 0x79, 0x44, 0x6f, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x6f, 0x74, 0x68, 0x18, 0x31, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x75, 0x75, 0x69, 0x64, 0x73, 0x18, 0x33, 0x20, 0x03, 0x28, 0x09, 0x42, 0x0a, 0x92, 0x41, 0x07, 0xa2, 0x02, 0x04, 0x75, 0x75, 0x69, 0x64, 0x52, 0x05, 0x75, 0x75, 0x69, 0x64, 0x73, 0x1a, 0xe8, 0x01, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x7c, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x50, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x65, 0x70, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x1a, 0x92, 0x41, 0x17, 0x32, 0x15, 0x44, 0x65, 0x65, 0x70, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x1f, 0x0a, 0x08, 0x44, 0x65, 0x65, 0x70, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, 0x3a, 0x13, 0x92, 0x41, 0x10, 0x32, 0x0e, 0x7b, 0x22, 0x6f, 0x6b, 0x22, 0x3a, 0x20, 0x22, 0x54, 0x52, 0x55, 0x45, 0x22, 0x7d, 0x1a, 0x78, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x51, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, 0x0a, 0x16, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x8d, 0x01, 0x0a, 0x16, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x5d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0xd6, 0x02, 0x92, 0x41, 0xd2, 0x02, 0x0a, 0xcc, 0x01, 0x2a, 0x13, 0x41, 0x20, 0x62, 0x69, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x32, 0x4a, 0x49, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x6e, 0x79, 0x20, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0xd2, 0x01, 0x04, 0x75, 0x75, 0x69, 0x64, 0xd2, 0x01, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0xd2, 0x01, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0xd2, 0x01, 0x1f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0x03, 0x22, 0x0a, 0x19, 0x78, 0x2d, 0x61, 0x2d, 0x62, 0x69, 0x74, 0x2d, 0x6f, 0x66, 0x2d, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2d, 0x66, 0x6f, 0x6f, 0x12, 0x05, 0x1a, 0x03, 0x62, 0x61, 0x72, 0x2a, 0x56, 0x0a, 0x24, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x32, 0x29, 0x7b, 0x22, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x31, 0x32, 0x2c, 0x20, 0x22, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x31, 0x32, 0x2e, 0x33, 0x7d, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x09, 0x0a, 0x18, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x19, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x02, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x01, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x04, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x1b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x06, 0x52, 0x18, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x1b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x07, 0x52, 0x18, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x08, 0x52, 0x15, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x74, 0x0a, 0x18, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x15, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x1c, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0f, 0x52, 0x19, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x1c, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x10, 0x52, 0x19, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x11, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x10, 0x20, 0x03, 0x28, 0x12, 0x52, 0x17, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x64, 0x92, 0x41, 0x61, 0x32, 0x5f, 0x7b, 0x22, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x2c, 0x20, 0x22, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x33, 0x5d, 0x7d, 0x22, 0x41, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x1a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6b, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x48, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xa2, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x52, 0x0a, 0x03, 0x61, 0x62, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x03, 0x61, 0x62, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x67, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 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, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x6b, 0x49, 0x64, 0x22, 0xc5, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x22, 0x92, 0x02, 0x0a, 0x10, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x04, 0x77, 0x68, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x77, 0x68, 0x61, 0x74, 0x12, 0x53, 0x0a, 0x03, 0x77, 0x68, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x30, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x52, 0x03, 0x77, 0x68, 0x6f, 0x12, 0x54, 0x0a, 0x05, 0x77, 0x68, 0x65, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x77, 0x68, 0x65, 0x72, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7f, 0x0a, 0x1a, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x02, 0x69, 0x64, 0x12, 0x4b, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x22, 0x52, 0x0a, 0x03, 0x46, 0x6f, 0x6f, 0x12, 0x4b, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x61, 0x72, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x03, 0x62, 0x61, 0x72, 0x22, 0x1b, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x02, 0x69, 0x64, 0x2a, 0x20, 0x0a, 0x0b, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x2a, 0x2b, 0x0a, 0x0f, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x63, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x64, 0x10, 0x01, 0x2a, 0x2d, 0x0a, 0x11, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x30, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x65, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x10, 0x01, 0x32, 0xe5, 0x37, 0x0a, 0x17, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8c, 0x04, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0xfd, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xf6, 0x02, 0x22, 0xf3, 0x02, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x7b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x73, 0x74, 0x72, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x2f, 0x2a, 0x7d, 0x2f, 0x7b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x6e, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0xbc, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0xb4, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0xb9, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x32, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xb0, 0x01, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x32, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xc3, 0x01, 0x0a, 0x06, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x22, 0x2d, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0xcf, 0x01, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x6e, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x3c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x22, 0x34, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x3a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x95, 0x01, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x01, 0x2a, 0x1a, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x83, 0x02, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x32, 0x12, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x9d, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x96, 0x01, 0x3a, 0x03, 0x61, 0x62, 0x65, 0x5a, 0x31, 0x3a, 0x03, 0x61, 0x62, 0x65, 0x32, 0x2a, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x61, 0x62, 0x65, 0x2e, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x5a, 0x30, 0x3a, 0x01, 0x2a, 0x32, 0x2b, 0x2f, 0x76, 0x32, 0x61, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x61, 0x62, 0x65, 0x2e, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x1a, 0x2a, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x61, 0x62, 0x65, 0x2e, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xca, 0x01, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x32, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x72, 0x92, 0x41, 0x41, 0x62, 0x29, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x17, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0x0d, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6a, 0x14, 0x0a, 0x0e, 0x78, 0x2d, 0x69, 0x72, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x02, 0x20, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x2a, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xf2, 0x01, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x8b, 0x01, 0x92, 0x41, 0x54, 0x22, 0x4e, 0x0a, 0x1c, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x58, 0x01, 0x62, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xa9, 0x05, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x1a, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x80, 0x04, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xf9, 0x03, 0x12, 0xf6, 0x03, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x12, 0xa7, 0x04, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xac, 0x03, 0x92, 0x41, 0xc5, 0x02, 0x0a, 0x08, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x72, 0x70, 0x63, 0x12, 0x11, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x3a, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x20, 0x72, 0x70, 0x63, 0x1a, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x22, 0x44, 0x0a, 0x12, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4a, 0x39, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x32, 0x22, 0x30, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x12, 0x1c, 0x7b, 0x22, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7d, 0x4a, 0x3b, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x34, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, 0x06, 0x0a, 0x04, 0x9a, 0x02, 0x01, 0x03, 0x4a, 0x56, 0x0a, 0x03, 0x35, 0x30, 0x33, 0x12, 0x4f, 0x0a, 0x36, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x69, 0x6c, 0x79, 0x20, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x2a, 0x15, 0x0a, 0x08, 0x78, 0x2d, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x5d, 0x5a, 0x19, 0x3a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x10, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5a, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x12, 0x2c, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x12, 0xc9, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x65, 0x70, 0x50, 0x61, 0x74, 0x68, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x64, 0x65, 0x65, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x41, 0x0a, 0x0a, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x68, 0x0a, 0x10, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x57, 0x69, 0x74, 0x68, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x77, 0x69, 0x74, 0x68, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x19, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x77, 0x69, 0x74, 0x68, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x92, 0x01, 0x0a, 0x11, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x77, 0x69, 0x74, 0x68, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xe2, 0x01, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x47, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x41, 0x12, 0x3f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2f, 0x67, 0x65, 0x74, 0x2f, 0x7b, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xf6, 0x01, 0x0a, 0x1d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x51, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4b, 0x12, 0x49, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2f, 0x67, 0x65, 0x74, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x7b, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x6f, 0x6b, 0x7d, 0x12, 0xed, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x51, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4b, 0x3a, 0x0d, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x22, 0x3a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x12, 0xba, 0x01, 0x0a, 0x1b, 0x4f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x4d, 0x92, 0x41, 0x18, 0x32, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x62, 0x61, 0x72, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x3a, 0x01, 0x2a, 0x22, 0x27, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x74, 0x79, 0x70, 0x65, 0x12, 0x9b, 0x01, 0x0a, 0x1c, 0x4f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x45, 0x92, 0x41, 0x12, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x74, 0x79, 0x70, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x3c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x3a, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x94, 0x01, 0x0a, 0x1b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x42, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x33, 0x2f, 0x7b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x7d, 0x3a, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x8b, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x06, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x42, 0x2e, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xab, 0x01, 0x0a, 0x14, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x42, 0x31, 0x0a, 0x07, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0xcb, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x37, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x42, 0x2f, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x75, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x96, 0x01, 0x0a, 0x0d, 0x50, 0x6f, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x45, 0x6e, 0x75, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x0c, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0xa9, 0x01, 0x0a, 0x17, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x74, 0x79, 0x70, 0x65, 0x1a, 0xd1, 0x01, 0x92, 0x41, 0xcd, 0x01, 0x0a, 0x10, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x66, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2d, 0x2d, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x21, 0x1a, 0x51, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x32, 0x6a, 0x0a, 0x14, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x32, 0x5e, 0x0a, 0x1c, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0xd5, 0x01, 0x0a, 0x10, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc0, 0x01, 0x0a, 0x09, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x2f, 0x7b, 0x77, 0x68, 0x6f, 0x7d, 0x2f, 0x7b, 0x77, 0x68, 0x61, 0x74, 0x7d, 0x2f, 0x7b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x7d, 0x42, 0xcf, 0x0c, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x92, 0x41, 0xfe, 0x0b, 0x12, 0xf0, 0x01, 0x0a, 0x13, 0x41, 0x20, 0x42, 0x69, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x58, 0x0a, 0x14, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x10, 0x6e, 0x6f, 0x6e, 0x65, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2a, 0x58, 0x0a, 0x14, 0x42, 0x53, 0x44, 0x20, 0x33, 0x2d, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x3a, 0x20, 0x0a, 0x15, 0x78, 0x2d, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2d, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x07, 0x1a, 0x05, 0x79, 0x61, 0x64, 0x64, 0x61, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x32, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x52, 0x50, 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, 0x49, 0x0a, 0x47, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x3b, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x34, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, 0x06, 0x0a, 0x04, 0x9a, 0x02, 0x01, 0x07, 0x52, 0x57, 0x0a, 0x03, 0x34, 0x31, 0x38, 0x12, 0x50, 0x0a, 0x0d, 0x49, 0x27, 0x6d, 0x20, 0x61, 0x20, 0x74, 0x65, 0x61, 0x70, 0x6f, 0x74, 0x2e, 0x12, 0x3f, 0x0a, 0x3d, 0x1a, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x9b, 0x02, 0x0a, 0x03, 0x35, 0x30, 0x30, 0x12, 0x93, 0x02, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x41, 0x0a, 0x3f, 0x1a, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0xbf, 0x01, 0x0a, 0x10, 0x58, 0x2d, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x49, 0x64, 0x12, 0xaa, 0x01, 0x0a, 0x2b, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x32, 0x26, 0x22, 0x32, 0x34, 0x33, 0x38, 0x61, 0x63, 0x33, 0x63, 0x2d, 0x33, 0x37, 0x65, 0x62, 0x2d, 0x34, 0x39, 0x30, 0x32, 0x2d, 0x61, 0x64, 0x65, 0x66, 0x2d, 0x65, 0x64, 0x31, 0x36, 0x62, 0x34, 0x34, 0x33, 0x31, 0x30, 0x33, 0x30, 0x22, 0x6a, 0x45, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x38, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x34, 0x7d, 0x2d, 0x34, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, 0x2d, 0x5b, 0x38, 0x39, 0x41, 0x42, 0x5d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x31, 0x32, 0x7d, 0x24, 0x5a, 0x97, 0x03, 0x0a, 0xaa, 0x01, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x9b, 0x01, 0x08, 0x02, 0x1a, 0x09, 0x58, 0x2d, 0x41, 0x50, 0x49, 0x2d, 0x4b, 0x65, 0x79, 0x20, 0x02, 0x4a, 0x60, 0x0a, 0x1e, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x3e, 0x2a, 0x3c, 0x0a, 0x29, 0x0a, 0x1c, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x54, 0x74, 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x40, 0x0a, 0x0f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, 0x1a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4a, 0x28, 0x0a, 0x1c, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x74, 0x79, 0x70, 0x65, 0x12, 0x08, 0x1a, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x0a, 0x0f, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, 0x08, 0x01, 0x0a, 0xd6, 0x01, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0xcb, 0x01, 0x08, 0x03, 0x28, 0x04, 0x32, 0x23, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x3a, 0x1f, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x7f, 0x0a, 0x43, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x3a, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x1a, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x12, 0x12, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x0a, 0x1c, 0x0a, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x13, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x62, 0x1f, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x0d, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x62, 0x29, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x17, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0x0d, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6a, 0x32, 0x0a, 0x08, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x72, 0x70, 0x63, 0x12, 0x14, 0x45, 0x63, 0x68, 0x6f, 0x20, 0x52, 0x70, 0x63, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x10, 0x0a, 0x0a, 0x78, 0x2d, 0x74, 0x72, 0x61, 0x69, 0x74, 0x54, 0x61, 0x67, 0x12, 0x02, 0x20, 0x01, 0x72, 0x49, 0x0a, 0x17, 0x4d, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x7a, 0x28, 0x0a, 0x17, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x62, 0x61, 0x7a, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x0d, 0x32, 0x0b, 0x0a, 0x05, 0x1a, 0x03, 0x6f, 0x6e, 0x65, 0x0a, 0x02, 0x20, 0x01, 0x7a, 0x1b, 0x0a, 0x12, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x66, 0x6f, 0x6f, 0x12, 0x05, 0x1a, 0x03, 0x62, 0x61, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescData = file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc ) func file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescData) }) return file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescData } var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_goTypes = []interface{}{ (NumericEnum)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.NumericEnum (SnakeCaseEnum)(0), // 1: grpc.gateway.examples.internal.proto.examplepb.snake_case_enum (SnakeCase_0Enum)(0), // 2: grpc.gateway.examples.internal.proto.examplepb.snake_case_0_enum (ABitOfEverything_Nested_DeepEnum)(0), // 3: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested.DeepEnum (*ErrorResponse)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.ErrorResponse (*ErrorObject)(nil), // 5: grpc.gateway.examples.internal.proto.examplepb.ErrorObject (*ABitOfEverything)(nil), // 6: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything (*ABitOfEverythingRepeated)(nil), // 7: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingRepeated (*CheckStatusResponse)(nil), // 8: grpc.gateway.examples.internal.proto.examplepb.CheckStatusResponse (*Body)(nil), // 9: grpc.gateway.examples.internal.proto.examplepb.Body (*MessageWithBody)(nil), // 10: grpc.gateway.examples.internal.proto.examplepb.MessageWithBody (*UpdateV2Request)(nil), // 11: grpc.gateway.examples.internal.proto.examplepb.UpdateV2Request (*Book)(nil), // 12: grpc.gateway.examples.internal.proto.examplepb.Book (*CreateBookRequest)(nil), // 13: grpc.gateway.examples.internal.proto.examplepb.CreateBookRequest (*UpdateBookRequest)(nil), // 14: grpc.gateway.examples.internal.proto.examplepb.UpdateBookRequest (*SnakeEnumRequest)(nil), // 15: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumRequest (*SnakeEnumResponse)(nil), // 16: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumResponse (*RequiredMessageTypeRequest)(nil), // 17: grpc.gateway.examples.internal.proto.examplepb.RequiredMessageTypeRequest (*Foo)(nil), // 18: grpc.gateway.examples.internal.proto.examplepb.Foo (*Bar)(nil), // 19: grpc.gateway.examples.internal.proto.examplepb.Bar (*ABitOfEverything_Nested)(nil), // 20: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested nil, // 21: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MapValueEntry nil, // 22: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MappedStringValueEntry nil, // 23: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MappedNestedValueEntry (pathenum.PathEnum)(0), // 24: grpc.gateway.examples.internal.pathenum.PathEnum (pathenum.MessagePathEnum_NestedPathEnum)(0), // 25: grpc.gateway.examples.internal.pathenum.MessagePathEnum.NestedPathEnum (*emptypb.Empty)(nil), // 26: google.protobuf.Empty (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp (*status.Status)(nil), // 28: google.rpc.Status (*fieldmaskpb.FieldMask)(nil), // 29: google.protobuf.FieldMask (pathenum.SnakeCaseForImport)(0), // 30: grpc.gateway.examples.internal.pathenum.snake_case_for_import (*sub2.IdMessage)(nil), // 31: grpc.gateway.examples.internal.proto.sub2.IdMessage (*sub.StringMessage)(nil), // 32: grpc.gateway.examples.internal.proto.sub.StringMessage (*durationpb.Duration)(nil), // 33: google.protobuf.Duration (*pathenum.MessageWithPathEnum)(nil), // 34: grpc.gateway.examples.internal.pathenum.MessageWithPathEnum (*pathenum.MessageWithNestedPathEnum)(nil), // 35: grpc.gateway.examples.internal.pathenum.MessageWithNestedPathEnum (*oneofenum.OneofEnumMessage)(nil), // 36: grpc.gateway.examples.internal.proto.oneofenum.OneofEnumMessage (*wrapperspb.StringValue)(nil), // 37: google.protobuf.StringValue } var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_depIdxs = []int32{ 5, // 0: grpc.gateway.examples.internal.proto.examplepb.ErrorResponse.error:type_name -> grpc.gateway.examples.internal.proto.examplepb.ErrorObject 20, // 1: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.single_nested:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested 20, // 2: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.nested:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested 0, // 3: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.enum_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 24, // 4: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.path_enum_value:type_name -> grpc.gateway.examples.internal.pathenum.PathEnum 25, // 5: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.nested_path_enum_value:type_name -> grpc.gateway.examples.internal.pathenum.MessagePathEnum.NestedPathEnum 26, // 6: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.oneof_empty:type_name -> google.protobuf.Empty 21, // 7: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.map_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MapValueEntry 22, // 8: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.mapped_string_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MappedStringValueEntry 23, // 9: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.mapped_nested_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MappedNestedValueEntry 27, // 10: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.timestamp_value:type_name -> google.protobuf.Timestamp 0, // 11: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.repeated_enum_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 0, // 12: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.repeated_enum_annotation:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 0, // 13: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.enum_value_annotation:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 20, // 14: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.repeated_nested_annotation:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested 20, // 15: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.nested_annotation:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested 0, // 16: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingRepeated.path_repeated_enum_value:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 28, // 17: grpc.gateway.examples.internal.proto.examplepb.CheckStatusResponse.status:type_name -> google.rpc.Status 9, // 18: grpc.gateway.examples.internal.proto.examplepb.MessageWithBody.data:type_name -> grpc.gateway.examples.internal.proto.examplepb.Body 6, // 19: grpc.gateway.examples.internal.proto.examplepb.UpdateV2Request.abe:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 29, // 20: grpc.gateway.examples.internal.proto.examplepb.UpdateV2Request.update_mask:type_name -> google.protobuf.FieldMask 27, // 21: grpc.gateway.examples.internal.proto.examplepb.Book.create_time:type_name -> google.protobuf.Timestamp 12, // 22: grpc.gateway.examples.internal.proto.examplepb.CreateBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.examplepb.Book 12, // 23: grpc.gateway.examples.internal.proto.examplepb.UpdateBookRequest.book:type_name -> grpc.gateway.examples.internal.proto.examplepb.Book 29, // 24: grpc.gateway.examples.internal.proto.examplepb.UpdateBookRequest.update_mask:type_name -> google.protobuf.FieldMask 1, // 25: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumRequest.what:type_name -> grpc.gateway.examples.internal.proto.examplepb.snake_case_enum 2, // 26: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumRequest.who:type_name -> grpc.gateway.examples.internal.proto.examplepb.snake_case_0_enum 30, // 27: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumRequest.where:type_name -> grpc.gateway.examples.internal.pathenum.snake_case_for_import 18, // 28: grpc.gateway.examples.internal.proto.examplepb.RequiredMessageTypeRequest.foo:type_name -> grpc.gateway.examples.internal.proto.examplepb.Foo 19, // 29: grpc.gateway.examples.internal.proto.examplepb.Foo.bar:type_name -> grpc.gateway.examples.internal.proto.examplepb.Bar 3, // 30: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested.ok:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested.DeepEnum 0, // 31: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MapValueEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.NumericEnum 20, // 32: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.MappedNestedValueEntry.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything.Nested 6, // 33: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Create:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 34: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CreateBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 13, // 35: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CreateBook:input_type -> grpc.gateway.examples.internal.proto.examplepb.CreateBookRequest 14, // 36: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.UpdateBook:input_type -> grpc.gateway.examples.internal.proto.examplepb.UpdateBookRequest 31, // 37: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Lookup:input_type -> grpc.gateway.examples.internal.proto.sub2.IdMessage 6, // 38: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Custom:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 39: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.DoubleColon:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 40: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Update:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 11, // 41: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.UpdateV2:input_type -> grpc.gateway.examples.internal.proto.examplepb.UpdateV2Request 31, // 42: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Delete:input_type -> grpc.gateway.examples.internal.proto.sub2.IdMessage 6, // 43: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetQuery:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 7, // 44: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetRepeatedQuery:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingRepeated 32, // 45: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Echo:input_type -> grpc.gateway.examples.internal.proto.sub.StringMessage 6, // 46: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.DeepPathEcho:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 33, // 47: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.NoBindings:input_type -> google.protobuf.Duration 26, // 48: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Timeout:input_type -> google.protobuf.Empty 26, // 49: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.ErrorWithDetails:input_type -> google.protobuf.Empty 10, // 50: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetMessageWithBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.MessageWithBody 9, // 51: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostWithEmptyBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.Body 6, // 52: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckGetQueryParams:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 53: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckNestedEnumGetQueryParams:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 54: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckPostQueryParams:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 9, // 55: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.OverwriteRequestContentType:input_type -> grpc.gateway.examples.internal.proto.examplepb.Body 26, // 56: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.OverwriteResponseContentType:input_type -> google.protobuf.Empty 34, // 57: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckExternalPathEnum:input_type -> grpc.gateway.examples.internal.pathenum.MessageWithPathEnum 35, // 58: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckExternalNestedPathEnum:input_type -> grpc.gateway.examples.internal.pathenum.MessageWithNestedPathEnum 26, // 59: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckStatus:input_type -> google.protobuf.Empty 6, // 60: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Exists:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 61: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CustomOptionsRequest:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 62: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.TraceRequest:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 36, // 63: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostOneofEnum:input_type -> grpc.gateway.examples.internal.proto.oneofenum.OneofEnumMessage 17, // 64: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostRequiredMessageType:input_type -> grpc.gateway.examples.internal.proto.examplepb.RequiredMessageTypeRequest 26, // 65: grpc.gateway.examples.internal.proto.examplepb.camelCaseServiceName.Empty:input_type -> google.protobuf.Empty 26, // 66: grpc.gateway.examples.internal.proto.examplepb.AnotherServiceWithNoBindings.NoBindings:input_type -> google.protobuf.Empty 15, // 67: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService.SnakeEnum:input_type -> grpc.gateway.examples.internal.proto.examplepb.SnakeEnumRequest 6, // 68: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Create:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 69: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CreateBody:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 12, // 70: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CreateBook:output_type -> grpc.gateway.examples.internal.proto.examplepb.Book 12, // 71: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.UpdateBook:output_type -> grpc.gateway.examples.internal.proto.examplepb.Book 6, // 72: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Lookup:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 73: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Custom:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 74: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.DoubleColon:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 26, // 75: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Update:output_type -> google.protobuf.Empty 26, // 76: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.UpdateV2:output_type -> google.protobuf.Empty 26, // 77: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Delete:output_type -> google.protobuf.Empty 26, // 78: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetQuery:output_type -> google.protobuf.Empty 7, // 79: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetRepeatedQuery:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingRepeated 32, // 80: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Echo:output_type -> grpc.gateway.examples.internal.proto.sub.StringMessage 6, // 81: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.DeepPathEcho:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 26, // 82: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.NoBindings:output_type -> google.protobuf.Empty 26, // 83: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Timeout:output_type -> google.protobuf.Empty 26, // 84: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.ErrorWithDetails:output_type -> google.protobuf.Empty 26, // 85: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.GetMessageWithBody:output_type -> google.protobuf.Empty 26, // 86: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostWithEmptyBody:output_type -> google.protobuf.Empty 6, // 87: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckGetQueryParams:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 88: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckNestedEnumGetQueryParams:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 6, // 89: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckPostQueryParams:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 26, // 90: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.OverwriteRequestContentType:output_type -> google.protobuf.Empty 37, // 91: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.OverwriteResponseContentType:output_type -> google.protobuf.StringValue 26, // 92: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckExternalPathEnum:output_type -> google.protobuf.Empty 26, // 93: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckExternalNestedPathEnum:output_type -> google.protobuf.Empty 8, // 94: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CheckStatus:output_type -> grpc.gateway.examples.internal.proto.examplepb.CheckStatusResponse 26, // 95: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.Exists:output_type -> google.protobuf.Empty 26, // 96: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.CustomOptionsRequest:output_type -> google.protobuf.Empty 6, // 97: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.TraceRequest:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 26, // 98: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostOneofEnum:output_type -> google.protobuf.Empty 26, // 99: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService.PostRequiredMessageType:output_type -> google.protobuf.Empty 26, // 100: grpc.gateway.examples.internal.proto.examplepb.camelCaseServiceName.Empty:output_type -> google.protobuf.Empty 26, // 101: grpc.gateway.examples.internal.proto.examplepb.AnotherServiceWithNoBindings.NoBindings:output_type -> google.protobuf.Empty 16, // 102: grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService.SnakeEnum:output_type -> grpc.gateway.examples.internal.proto.examplepb.SnakeEnumResponse 68, // [68:103] is the sub-list for method output_type 33, // [33:68] is the sub-list for method input_type 33, // [33:33] is the sub-list for extension type_name 33, // [33:33] is the sub-list for extension extendee 0, // [0:33] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_a_bit_of_everything_proto_init() } func file_examples_internal_proto_examplepb_a_bit_of_everything_proto_init() { if File_examples_internal_proto_examplepb_a_bit_of_everything_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ErrorResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ErrorObject); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ABitOfEverything); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ABitOfEverythingRepeated); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckStatusResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Body); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MessageWithBody); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateV2Request); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Book); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateBookRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateBookRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SnakeEnumRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SnakeEnumResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RequiredMessageTypeRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Foo); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bar); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ABitOfEverything_Nested); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes[2].OneofWrappers = []interface{}{ (*ABitOfEverything_OneofEmpty)(nil), (*ABitOfEverything_OneofString)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc, NumEnums: 4, NumMessages: 20, NumExtensions: 0, NumServices: 4, }, GoTypes: file_examples_internal_proto_examplepb_a_bit_of_everything_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_a_bit_of_everything_proto_depIdxs, EnumInfos: file_examples_internal_proto_examplepb_a_bit_of_everything_proto_enumTypes, MessageInfos: file_examples_internal_proto_examplepb_a_bit_of_everything_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_a_bit_of_everything_proto = out.File file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc = nil file_examples_internal_proto_examplepb_a_bit_of_everything_proto_goTypes = nil file_examples_internal_proto_examplepb_a_bit_of_everything_proto_depIdxs = nil } a_bit_of_everything.pb.gw.go000066400000000000000000006437021465037340600357440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/a_bit_of_everything.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "enum_value_annotation": 18}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}} ) func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["float_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") } protoReq.FloatValue, err = runtime.Float32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "float_value", err) } val, ok = pathParams["double_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") } protoReq.DoubleValue, err = runtime.Float64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "double_value", err) } val, ok = pathParams["int64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") } protoReq.Int64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64_value", err) } val, ok = pathParams["uint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") } protoReq.Uint64Value, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64_value", err) } val, ok = pathParams["int32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") } protoReq.Int32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32_value", err) } val, ok = pathParams["fixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") } protoReq.Fixed64Value, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed64_value", err) } val, ok = pathParams["fixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") } protoReq.Fixed32Value, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed32_value", err) } val, ok = pathParams["bool_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") } protoReq.BoolValue, err = runtime.Bool(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bool_value", err) } val, ok = pathParams["string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } protoReq.StringValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) } val, ok = pathParams["uint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") } protoReq.Uint32Value, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32_value", err) } val, ok = pathParams["sfixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") } protoReq.Sfixed32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed32_value", err) } val, ok = pathParams["sfixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") } protoReq.Sfixed64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed64_value", err) } val, ok = pathParams["sint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") } protoReq.Sint32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint32_value", err) } val, ok = pathParams["sint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") } protoReq.Sint64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint64_value", err) } val, ok = pathParams["nonConventionalNameValue"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") } protoReq.NonConventionalNameValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) } val, ok = pathParams["enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value") } e, err = runtime.Enum(val, NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value", err) } protoReq.EnumValue = NumericEnum(e) val, ok = pathParams["path_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_enum_value") } e, err = runtime.Enum(val, pathenum.PathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_enum_value", err) } protoReq.PathEnumValue = pathenum.PathEnum(e) val, ok = pathParams["nested_path_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nested_path_enum_value") } e, err = runtime.Enum(val, pathenum.MessagePathEnum_NestedPathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nested_path_enum_value", err) } protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) val, ok = pathParams["enum_value_annotation"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") } e, err = runtime.Enum(val, NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value_annotation", err) } protoReq.EnumValueAnnotation = NumericEnum(e) if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["float_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") } protoReq.FloatValue, err = runtime.Float32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "float_value", err) } val, ok = pathParams["double_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") } protoReq.DoubleValue, err = runtime.Float64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "double_value", err) } val, ok = pathParams["int64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") } protoReq.Int64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64_value", err) } val, ok = pathParams["uint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") } protoReq.Uint64Value, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64_value", err) } val, ok = pathParams["int32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") } protoReq.Int32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32_value", err) } val, ok = pathParams["fixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") } protoReq.Fixed64Value, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed64_value", err) } val, ok = pathParams["fixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") } protoReq.Fixed32Value, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed32_value", err) } val, ok = pathParams["bool_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") } protoReq.BoolValue, err = runtime.Bool(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bool_value", err) } val, ok = pathParams["string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } protoReq.StringValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) } val, ok = pathParams["uint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") } protoReq.Uint32Value, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32_value", err) } val, ok = pathParams["sfixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") } protoReq.Sfixed32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed32_value", err) } val, ok = pathParams["sfixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") } protoReq.Sfixed64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed64_value", err) } val, ok = pathParams["sint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") } protoReq.Sint32Value, err = runtime.Int32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint32_value", err) } val, ok = pathParams["sint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") } protoReq.Sint64Value, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint64_value", err) } val, ok = pathParams["nonConventionalNameValue"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") } protoReq.NonConventionalNameValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) } val, ok = pathParams["enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value") } e, err = runtime.Enum(val, NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value", err) } protoReq.EnumValue = NumericEnum(e) val, ok = pathParams["path_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_enum_value") } e, err = runtime.Enum(val, pathenum.PathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_enum_value", err) } protoReq.PathEnumValue = pathenum.PathEnum(e) val, ok = pathParams["nested_path_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nested_path_enum_value") } e, err = runtime.Enum(val, pathenum.MessagePathEnum_NestedPathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nested_path_enum_value", err) } protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) val, ok = pathParams["enum_value_annotation"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") } e, err = runtime.Enum(val, NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value_annotation", err) } protoReq.EnumValueAnnotation = NumericEnum(e) if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Create(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateBody(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_CreateBook_0 = &utilities.DoubleArray{Encoding: map[string]int{"book": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_ABitOfEverythingService_CreateBook_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateBookRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Book); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["parent"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } protoReq.Parent, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CreateBook_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateBook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CreateBook_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateBookRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Book); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["parent"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } protoReq.Parent, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CreateBook_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateBook(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_UpdateBook_0 = &utilities.DoubleArray{Encoding: map[string]int{"book": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} ) func request_ABitOfEverythingService_UpdateBook_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateBookRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Book); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Book); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } var ( val string ok bool err error _ = err ) val, ok = pathParams["book.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "book.name") } err = runtime.PopulateFieldFromPath(&protoReq, "book.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateBook_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UpdateBook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_UpdateBook_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateBookRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Book); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Book); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } var ( val string ok bool err error _ = err ) val, ok = pathParams["book.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "book.name") } err = runtime.PopulateFieldFromPath(&protoReq, "book.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "book.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateBook_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UpdateBook(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := server.Lookup(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_Custom_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_Custom_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Custom_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Custom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Custom_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Custom_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Custom(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_DoubleColon_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_DoubleColon_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_DoubleColon_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.DoubleColon(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_DoubleColon_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_DoubleColon_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.DoubleColon(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := server.Update(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_UpdateV2_0 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} ) func request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_UpdateV2_1 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} ) func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Abe); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Abe); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_UpdateV2_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_UpdateV2_2(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["abe.uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := server.Delete(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_GetQuery_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_GetQuery_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.GetQuery(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_GetRepeatedQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverythingRepeated var metadata runtime.ServerMetadata var ( val string es []int32 ok bool err error _ = err ) val, ok = pathParams["path_repeated_float_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_float_value") } protoReq.PathRepeatedFloatValue, err = runtime.Float32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_float_value", err) } val, ok = pathParams["path_repeated_double_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_double_value") } protoReq.PathRepeatedDoubleValue, err = runtime.Float64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_double_value", err) } val, ok = pathParams["path_repeated_int64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int64_value") } protoReq.PathRepeatedInt64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int64_value", err) } val, ok = pathParams["path_repeated_uint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint64_value") } protoReq.PathRepeatedUint64Value, err = runtime.Uint64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint64_value", err) } val, ok = pathParams["path_repeated_int32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int32_value") } protoReq.PathRepeatedInt32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int32_value", err) } val, ok = pathParams["path_repeated_fixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed64_value") } protoReq.PathRepeatedFixed64Value, err = runtime.Uint64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed64_value", err) } val, ok = pathParams["path_repeated_fixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed32_value") } protoReq.PathRepeatedFixed32Value, err = runtime.Uint32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed32_value", err) } val, ok = pathParams["path_repeated_bool_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bool_value") } protoReq.PathRepeatedBoolValue, err = runtime.BoolSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bool_value", err) } val, ok = pathParams["path_repeated_string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_string_value") } protoReq.PathRepeatedStringValue, err = runtime.StringSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_string_value", err) } val, ok = pathParams["path_repeated_bytes_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bytes_value") } protoReq.PathRepeatedBytesValue, err = runtime.BytesSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bytes_value", err) } val, ok = pathParams["path_repeated_uint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint32_value") } protoReq.PathRepeatedUint32Value, err = runtime.Uint32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint32_value", err) } val, ok = pathParams["path_repeated_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_enum_value") } es, err = runtime.EnumSlice(val, ",", NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_enum_value", err) } s := make([]NumericEnum, len(es)) for i, v := range es { s[i] = NumericEnum(v) } protoReq.PathRepeatedEnumValue = s val, ok = pathParams["path_repeated_sfixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed32_value") } protoReq.PathRepeatedSfixed32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed32_value", err) } val, ok = pathParams["path_repeated_sfixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed64_value") } protoReq.PathRepeatedSfixed64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed64_value", err) } val, ok = pathParams["path_repeated_sint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint32_value") } protoReq.PathRepeatedSint32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint32_value", err) } val, ok = pathParams["path_repeated_sint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint64_value") } protoReq.PathRepeatedSint64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint64_value", err) } msg, err := client.GetRepeatedQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_GetRepeatedQuery_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverythingRepeated var metadata runtime.ServerMetadata var ( val string es []int32 ok bool err error _ = err ) val, ok = pathParams["path_repeated_float_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_float_value") } protoReq.PathRepeatedFloatValue, err = runtime.Float32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_float_value", err) } val, ok = pathParams["path_repeated_double_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_double_value") } protoReq.PathRepeatedDoubleValue, err = runtime.Float64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_double_value", err) } val, ok = pathParams["path_repeated_int64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int64_value") } protoReq.PathRepeatedInt64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int64_value", err) } val, ok = pathParams["path_repeated_uint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint64_value") } protoReq.PathRepeatedUint64Value, err = runtime.Uint64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint64_value", err) } val, ok = pathParams["path_repeated_int32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int32_value") } protoReq.PathRepeatedInt32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int32_value", err) } val, ok = pathParams["path_repeated_fixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed64_value") } protoReq.PathRepeatedFixed64Value, err = runtime.Uint64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed64_value", err) } val, ok = pathParams["path_repeated_fixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed32_value") } protoReq.PathRepeatedFixed32Value, err = runtime.Uint32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed32_value", err) } val, ok = pathParams["path_repeated_bool_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bool_value") } protoReq.PathRepeatedBoolValue, err = runtime.BoolSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bool_value", err) } val, ok = pathParams["path_repeated_string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_string_value") } protoReq.PathRepeatedStringValue, err = runtime.StringSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_string_value", err) } val, ok = pathParams["path_repeated_bytes_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bytes_value") } protoReq.PathRepeatedBytesValue, err = runtime.BytesSlice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bytes_value", err) } val, ok = pathParams["path_repeated_uint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint32_value") } protoReq.PathRepeatedUint32Value, err = runtime.Uint32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint32_value", err) } val, ok = pathParams["path_repeated_enum_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_enum_value") } es, err = runtime.EnumSlice(val, ",", NumericEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_enum_value", err) } s := make([]NumericEnum, len(es)) for i, v := range es { s[i] = NumericEnum(v) } protoReq.PathRepeatedEnumValue = s val, ok = pathParams["path_repeated_sfixed32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed32_value") } protoReq.PathRepeatedSfixed32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed32_value", err) } val, ok = pathParams["path_repeated_sfixed64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed64_value") } protoReq.PathRepeatedSfixed64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed64_value", err) } val, ok = pathParams["path_repeated_sint32_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint32_value") } protoReq.PathRepeatedSint32Value, err = runtime.Int32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint32_value", err) } val, ok = pathParams["path_repeated_sint64_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint64_value") } protoReq.PathRepeatedSint64Value, err = runtime.Int64Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint64_value", err) } msg, err := server.GetRepeatedQuery(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } protoReq.Value, err = runtime.StringP(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } protoReq.Value, err = runtime.StringP(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["single_nested.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) } msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["single_nested.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) } msg, err := server.DeepPathEcho(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.Timeout(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.ErrorWithDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.ErrorWithDetails(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MessageWithBody var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := client.GetMessageWithBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MessageWithBody var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := server.GetMessageWithBody(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Body var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } protoReq.Name, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } msg, err := client.PostWithEmptyBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Body var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } protoReq.Name, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } msg, err := server.PostWithEmptyBody(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_CheckGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "name": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["single_nested.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CheckGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["single_nested.name"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CheckGetQueryParams(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "ok": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["single_nested.ok"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.ok") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.ok", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.ok", err) } e, err = runtime.Enum(val, ABitOfEverything_Nested_DeepEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "single_nested.ok", err) } protoReq.SingleNested.Ok = ABitOfEverything_Nested_DeepEnum(e) if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CheckNestedEnumGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["single_nested.ok"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.ok") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.ok", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.ok", err) } e, err = runtime.Enum(val, ABitOfEverything_Nested_DeepEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", "single_nested.ok", err) } protoReq.SingleNested.Ok = ABitOfEverything_Nested_DeepEnum(e) if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CheckNestedEnumGetQueryParams(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_CheckPostQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "string_value": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } protoReq.StringValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CheckPostQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["string_value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } protoReq.StringValue, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CheckPostQueryParams(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_OverwriteRequestContentType_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Body var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.OverwriteRequestContentType(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_OverwriteRequestContentType_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Body var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.OverwriteRequestContentType(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_OverwriteResponseContentType_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.OverwriteResponseContentType(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_OverwriteResponseContentType_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.OverwriteResponseContentType(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_CheckExternalPathEnum_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq pathenum.MessageWithPathEnum var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } e, err = runtime.Enum(val, pathenum.PathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } protoReq.Value = pathenum.PathEnum(e) msg, err := client.CheckExternalPathEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckExternalPathEnum_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq pathenum.MessageWithPathEnum var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } e, err = runtime.Enum(val, pathenum.PathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } protoReq.Value = pathenum.PathEnum(e) msg, err := server.CheckExternalPathEnum(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_CheckExternalNestedPathEnum_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq pathenum.MessageWithNestedPathEnum var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } e, err = runtime.Enum(val, pathenum.MessagePathEnum_NestedPathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } protoReq.Value = pathenum.MessagePathEnum_NestedPathEnum(e) msg, err := client.CheckExternalNestedPathEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckExternalNestedPathEnum_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq pathenum.MessageWithNestedPathEnum var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["value"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } e, err = runtime.Enum(val, pathenum.MessagePathEnum_NestedPathEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } protoReq.Value = pathenum.MessagePathEnum_NestedPathEnum(e) msg, err := server.CheckExternalNestedPathEnum(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_CheckStatus_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.CheckStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CheckStatus_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.CheckStatus(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_Exists_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_Exists_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Exists_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Exists(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_Exists_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Exists_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Exists(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_CustomOptionsRequest_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_CustomOptionsRequest_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CustomOptionsRequest_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CustomOptionsRequest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_CustomOptionsRequest_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CustomOptionsRequest_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CustomOptionsRequest(ctx, &protoReq) return msg, metadata, err } var ( filter_ABitOfEverythingService_TraceRequest_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_ABitOfEverythingService_TraceRequest_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_TraceRequest_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.TraceRequest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_TraceRequest_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["uuid"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_TraceRequest_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.TraceRequest(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_PostOneofEnum_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq oneofenum.OneofEnumMessage var metadata runtime.ServerMetadata if protoReq.One == nil { protoReq.One = &oneofenum.OneofEnumMessage_ExampleEnum{} } else if _, ok := protoReq.One.(*oneofenum.OneofEnumMessage_ExampleEnum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *oneofenum.OneofEnumMessage_ExampleEnum, but: %t\n", protoReq.One) } if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.One.(*oneofenum.OneofEnumMessage_ExampleEnum).ExampleEnum); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.PostOneofEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_PostOneofEnum_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq oneofenum.OneofEnumMessage var metadata runtime.ServerMetadata if protoReq.One == nil { protoReq.One = &oneofenum.OneofEnumMessage_ExampleEnum{} } else if _, ok := protoReq.One.(*oneofenum.OneofEnumMessage_ExampleEnum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *oneofenum.OneofEnumMessage_ExampleEnum, but: %t\n", protoReq.One) } if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.One.(*oneofenum.OneofEnumMessage_ExampleEnum).ExampleEnum); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.PostOneofEnum(ctx, &protoReq) return msg, metadata, err } func request_ABitOfEverythingService_PostRequiredMessageType_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq RequiredMessageTypeRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.PostRequiredMessageType(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ABitOfEverythingService_PostRequiredMessageType_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq RequiredMessageTypeRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.PostRequiredMessageType(ctx, &protoReq) return msg, metadata, err } func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.Empty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, server CamelCaseServiceNameServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.Empty(ctx, &protoReq) return msg, metadata, err } func request_SnakeEnumService_SnakeEnum_0(ctx context.Context, marshaler runtime.Marshaler, client SnakeEnumServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SnakeEnumRequest var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["who"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "who") } e, err = runtime.Enum(val, SnakeCase_0Enum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "who", err) } protoReq.Who = SnakeCase_0Enum(e) val, ok = pathParams["what"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "what") } e, err = runtime.Enum(val, SnakeCaseEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "what", err) } protoReq.What = SnakeCaseEnum(e) val, ok = pathParams["where"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "where") } e, err = runtime.Enum(val, pathenum.SnakeCaseForImport_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "where", err) } protoReq.Where = pathenum.SnakeCaseForImport(e) msg, err := client.SnakeEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_SnakeEnumService_SnakeEnum_0(ctx context.Context, marshaler runtime.Marshaler, server SnakeEnumServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SnakeEnumRequest var metadata runtime.ServerMetadata var ( val string e int32 ok bool err error _ = err ) val, ok = pathParams["who"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "who") } e, err = runtime.Enum(val, SnakeCase_0Enum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "who", err) } protoReq.Who = SnakeCase_0Enum(e) val, ok = pathParams["what"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "what") } e, err = runtime.Enum(val, SnakeCaseEnum_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "what", err) } protoReq.What = SnakeCaseEnum(e) val, ok = pathParams["where"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "where") } e, err = runtime.Enum(val, pathenum.SnakeCaseForImport_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "where", err) } protoReq.Where = pathenum.SnakeCaseForImport(e) msg, err := server.SnakeEnum(ctx, &protoReq) return msg, metadata, err } // RegisterABitOfEverythingServiceHandlerServer registers the http handlers for service ABitOfEverythingService to "mux". // UnaryRPC :call ABitOfEverythingServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterABitOfEverythingServiceHandlerFromEndpoint instead. func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Create", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBody", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CreateBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CreateBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CreateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBook", runtime.WithHTTPPathPattern("/v1/{parent=publishers/*}/books")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CreateBook_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateBook", runtime.WithHTTPPathPattern("/v1/{book.name=publishers/*/books/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_UpdateBook_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Lookup", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Lookup_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Lookup_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_Custom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Custom", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}:custom")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Custom_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Custom_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_DoubleColon_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DoubleColon", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}:custom:custom")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_DoubleColon_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_DoubleColon_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Update", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Update_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_ABitOfEverythingService_UpdateV2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_UpdateV2_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_UpdateV2_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2a/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_UpdateV2_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Delete", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetQuery", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/query/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_GetQuery_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetQuery_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_GetRepeatedQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetRepeatedQuery", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_GetRepeatedQuery_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetRepeatedQuery_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/echo/{value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Echo_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Echo_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DeepPathEcho", runtime.WithHTTPPathPattern("/v1/example/deep_path/{single_nested.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_DeepPathEcho_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_DeepPathEcho_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Timeout", runtime.WithHTTPPathPattern("/v2/example/timeout")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Timeout_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Timeout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_ErrorWithDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/ErrorWithDetails", runtime.WithHTTPPathPattern("/v2/example/errorwithdetails")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_ErrorWithDetails_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_ErrorWithDetails_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetMessageWithBody", runtime.WithHTTPPathPattern("/v2/example/withbody/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_GetMessageWithBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetMessageWithBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostWithEmptyBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostWithEmptyBody", runtime.WithHTTPPathPattern("/v2/example/postwithemptybody/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_PostWithEmptyBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostWithEmptyBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckGetQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/get/{single_nested.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckGetQueryParams_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckGetQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckPostQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/post/{string_value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckPostQueryParams_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckPostQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_OverwriteRequestContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteRequestContentType", runtime.WithHTTPPathPattern("/v2/example/overwriterequestcontenttype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_OverwriteRequestContentType_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_OverwriteRequestContentType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_OverwriteResponseContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteResponseContentType", runtime.WithHTTPPathPattern("/v2/example/overwriteresponsecontenttype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_OverwriteResponseContentType_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_OverwriteResponseContentType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckExternalPathEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalPathEnum", runtime.WithHTTPPathPattern("/v2/{value}:check")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckExternalPathEnum_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckExternalPathEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckExternalNestedPathEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalNestedPathEnum", runtime.WithHTTPPathPattern("/v3/{value}:check")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckExternalNestedPathEnum_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckExternalNestedPathEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckStatus", runtime.WithHTTPPathPattern("/v1/example/checkStatus")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CheckStatus_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("HEAD", pattern_ABitOfEverythingService_Exists_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Exists", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_Exists_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Exists_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("OPTIONS", pattern_ABitOfEverythingService_CustomOptionsRequest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CustomOptionsRequest", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_CustomOptionsRequest_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CustomOptionsRequest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("TRACE", pattern_ABitOfEverythingService_TraceRequest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/TraceRequest", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_TraceRequest_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_TraceRequest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostOneofEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostOneofEnum", runtime.WithHTTPPathPattern("/v1/example/oneofenum")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_PostOneofEnum_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostOneofEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostRequiredMessageType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostRequiredMessageType", runtime.WithHTTPPathPattern("/v1/example/requiredmessagetype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ABitOfEverythingService_PostRequiredMessageType_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostRequiredMessageType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterCamelCaseServiceNameHandlerServer registers the http handlers for service CamelCaseServiceName to "mux". // UnaryRPC :call CamelCaseServiceNameServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCamelCaseServiceNameHandlerFromEndpoint instead. func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer) error { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.CamelCaseServiceName/Empty", runtime.WithHTTPPathPattern("/v2/example/empty")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_CamelCaseServiceName_Empty_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_CamelCaseServiceName_Empty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterSnakeEnumServiceHandlerServer registers the http handlers for service SnakeEnumService to "mux". // UnaryRPC :call SnakeEnumServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSnakeEnumServiceHandlerFromEndpoint instead. func RegisterSnakeEnumServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SnakeEnumServiceServer) error { mux.Handle("GET", pattern_SnakeEnumService_SnakeEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService/SnakeEnum", runtime.WithHTTPPathPattern("/v1/example/snake/{who}/{what}/{where}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_SnakeEnumService_SnakeEnum_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_SnakeEnumService_SnakeEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterABitOfEverythingServiceHandler(ctx, mux, conn) } // RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterABitOfEverythingServiceHandlerClient(ctx, mux, NewABitOfEverythingServiceClient(conn)) } // RegisterABitOfEverythingServiceHandlerClient registers the http handlers for service ABitOfEverythingService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ABitOfEverythingServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ABitOfEverythingServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "ABitOfEverythingServiceClient" to call the correct interceptors. func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ABitOfEverythingServiceClient) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Create", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBody", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CreateBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CreateBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CreateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBook", runtime.WithHTTPPathPattern("/v1/{parent=publishers/*}/books")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CreateBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CreateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateBook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateBook", runtime.WithHTTPPathPattern("/v1/{book.name=publishers/*/books/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_UpdateBook_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateBook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Lookup", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Lookup_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Lookup_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_Custom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Custom", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}:custom")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Custom_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Custom_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_DoubleColon_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DoubleColon", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}:custom:custom")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_DoubleColon_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_DoubleColon_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Update", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Update_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_ABitOfEverythingService_UpdateV2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_UpdateV2_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_UpdateV2_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", runtime.WithHTTPPathPattern("/v2a/example/a_bit_of_everything/{abe.uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_UpdateV2_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_UpdateV2_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Delete", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetQuery", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/query/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_GetQuery_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetQuery_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_GetRepeatedQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetRepeatedQuery", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_GetRepeatedQuery_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetRepeatedQuery_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/echo/{value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Echo_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Echo_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DeepPathEcho", runtime.WithHTTPPathPattern("/v1/example/deep_path/{single_nested.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_DeepPathEcho_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Timeout", runtime.WithHTTPPathPattern("/v2/example/timeout")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Timeout_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Timeout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_ErrorWithDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/ErrorWithDetails", runtime.WithHTTPPathPattern("/v2/example/errorwithdetails")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_ErrorWithDetails_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_ErrorWithDetails_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetMessageWithBody", runtime.WithHTTPPathPattern("/v2/example/withbody/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_GetMessageWithBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_GetMessageWithBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostWithEmptyBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostWithEmptyBody", runtime.WithHTTPPathPattern("/v2/example/postwithemptybody/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_PostWithEmptyBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostWithEmptyBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckGetQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/get/{single_nested.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckGetQueryParams_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckGetQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckPostQueryParams", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/params/post/{string_value}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckPostQueryParams_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckPostQueryParams_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_OverwriteRequestContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteRequestContentType", runtime.WithHTTPPathPattern("/v2/example/overwriterequestcontenttype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_OverwriteRequestContentType_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_OverwriteRequestContentType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_OverwriteResponseContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteResponseContentType", runtime.WithHTTPPathPattern("/v2/example/overwriteresponsecontenttype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_OverwriteResponseContentType_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_OverwriteResponseContentType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckExternalPathEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalPathEnum", runtime.WithHTTPPathPattern("/v2/{value}:check")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckExternalPathEnum_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckExternalPathEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckExternalNestedPathEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalNestedPathEnum", runtime.WithHTTPPathPattern("/v3/{value}:check")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckExternalNestedPathEnum_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckExternalNestedPathEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ABitOfEverythingService_CheckStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckStatus", runtime.WithHTTPPathPattern("/v1/example/checkStatus")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CheckStatus_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CheckStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("HEAD", pattern_ABitOfEverythingService_Exists_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Exists", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_Exists_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_Exists_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("OPTIONS", pattern_ABitOfEverythingService_CustomOptionsRequest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CustomOptionsRequest", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_CustomOptionsRequest_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_CustomOptionsRequest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("TRACE", pattern_ABitOfEverythingService_TraceRequest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/TraceRequest", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/{uuid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_TraceRequest_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_TraceRequest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostOneofEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostOneofEnum", runtime.WithHTTPPathPattern("/v1/example/oneofenum")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_PostOneofEnum_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostOneofEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ABitOfEverythingService_PostRequiredMessageType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostRequiredMessageType", runtime.WithHTTPPathPattern("/v1/example/requiredmessagetype")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ABitOfEverythingService_PostRequiredMessageType_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ABitOfEverythingService_PostRequiredMessageType_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "enum_value_annotation"}, "")) pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) pattern_ABitOfEverythingService_CreateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "publishers", "parent", "books"}, "")) pattern_ABitOfEverythingService_UpdateBook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "publishers", "books", "book.name"}, "")) pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_Custom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "custom")) pattern_ABitOfEverythingService_DoubleColon_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "custom:custom")) pattern_ABitOfEverythingService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_UpdateV2_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) pattern_ABitOfEverythingService_UpdateV2_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) pattern_ABitOfEverythingService_UpdateV2_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.uuid"}, "")) pattern_ABitOfEverythingService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "")) pattern_ABitOfEverythingService_GetRepeatedQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 1, 0, 4, 1, 5, 12, 1, 0, 4, 1, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18}, []string{"v1", "example", "a_bit_of_everything_repeated", "path_repeated_float_value", "path_repeated_double_value", "path_repeated_int64_value", "path_repeated_uint64_value", "path_repeated_int32_value", "path_repeated_fixed64_value", "path_repeated_fixed32_value", "path_repeated_bool_value", "path_repeated_string_value", "path_repeated_bytes_value", "path_repeated_uint32_value", "path_repeated_enum_value", "path_repeated_sfixed32_value", "path_repeated_sfixed64_value", "path_repeated_sint32_value", "path_repeated_sint64_value"}, "")) pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, "")) pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) pattern_ABitOfEverythingService_DeepPathEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "deep_path", "single_nested.name"}, "")) pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "")) pattern_ABitOfEverythingService_ErrorWithDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "errorwithdetails"}, "")) pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) pattern_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "postwithemptybody", "name"}, "")) pattern_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "single_nested.name"}, "")) pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "nested_enum", "single_nested.ok"}, "")) pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "")) pattern_ABitOfEverythingService_OverwriteRequestContentType_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "overwriterequestcontenttype"}, "")) pattern_ABitOfEverythingService_OverwriteResponseContentType_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "overwriteresponsecontenttype"}, "")) pattern_ABitOfEverythingService_CheckExternalPathEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"v2", "value"}, "check")) pattern_ABitOfEverythingService_CheckExternalNestedPathEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"v3", "value"}, "check")) pattern_ABitOfEverythingService_CheckStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "checkStatus"}, "")) pattern_ABitOfEverythingService_Exists_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_CustomOptionsRequest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_TraceRequest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_PostOneofEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "oneofenum"}, "")) pattern_ABitOfEverythingService_PostRequiredMessageType_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "requiredmessagetype"}, "")) ) var ( forward_ABitOfEverythingService_Create_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CreateBody_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CreateBook_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_UpdateBook_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Lookup_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Custom_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_DoubleColon_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_UpdateV2_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_UpdateV2_1 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_UpdateV2_2 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_GetQuery_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_GetRepeatedQuery_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Echo_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Echo_1 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Echo_2 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_ErrorWithDetails_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_GetMessageWithBody_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_OverwriteRequestContentType_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_OverwriteResponseContentType_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckExternalPathEnum_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckExternalNestedPathEnum_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckStatus_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Exists_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CustomOptionsRequest_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_TraceRequest_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_PostOneofEnum_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_PostRequiredMessageType_0 = runtime.ForwardResponseMessage ) // RegisterCamelCaseServiceNameHandlerFromEndpoint is same as RegisterCamelCaseServiceNameHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterCamelCaseServiceNameHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterCamelCaseServiceNameHandler(ctx, mux, conn) } // RegisterCamelCaseServiceNameHandler registers the http handlers for service CamelCaseServiceName to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterCamelCaseServiceNameHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterCamelCaseServiceNameHandlerClient(ctx, mux, NewCamelCaseServiceNameClient(conn)) } // RegisterCamelCaseServiceNameHandlerClient registers the http handlers for service CamelCaseServiceName // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CamelCaseServiceNameClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CamelCaseServiceNameClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "CamelCaseServiceNameClient" to call the correct interceptors. func RegisterCamelCaseServiceNameHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CamelCaseServiceNameClient) error { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.CamelCaseServiceName/Empty", runtime.WithHTTPPathPattern("/v2/example/empty")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_CamelCaseServiceName_Empty_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_CamelCaseServiceName_Empty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_CamelCaseServiceName_Empty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "empty"}, "")) ) var ( forward_CamelCaseServiceName_Empty_0 = runtime.ForwardResponseMessage ) // RegisterSnakeEnumServiceHandlerFromEndpoint is same as RegisterSnakeEnumServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterSnakeEnumServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterSnakeEnumServiceHandler(ctx, mux, conn) } // RegisterSnakeEnumServiceHandler registers the http handlers for service SnakeEnumService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterSnakeEnumServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterSnakeEnumServiceHandlerClient(ctx, mux, NewSnakeEnumServiceClient(conn)) } // RegisterSnakeEnumServiceHandlerClient registers the http handlers for service SnakeEnumService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SnakeEnumServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SnakeEnumServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "SnakeEnumServiceClient" to call the correct interceptors. func RegisterSnakeEnumServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SnakeEnumServiceClient) error { mux.Handle("GET", pattern_SnakeEnumService_SnakeEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService/SnakeEnum", runtime.WithHTTPPathPattern("/v1/example/snake/{who}/{what}/{where}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_SnakeEnumService_SnakeEnum_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_SnakeEnumService_SnakeEnum_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_SnakeEnumService_SnakeEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "snake", "who", "what", "where"}, "")) ) var ( forward_SnakeEnumService_SnakeEnum_0 = runtime.ForwardResponseMessage ) a_bit_of_everything.proto000066400000000000000000000643161465037340600354640ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "examples/internal/proto/oneofenum/oneof_enum.proto"; import "examples/internal/proto/pathenum/path_enum.proto"; import "examples/internal/proto/sub/message.proto"; import "examples/internal/proto/sub2/message.proto"; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/rpc/status.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "A Bit of Everything"; version: "1.0"; contact: { name: "gRPC-Gateway project"; url: "https://github.com/grpc-ecosystem/grpc-gateway"; email: "none@example.com"; }; license: { name: "BSD 3-Clause License"; url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; }; extensions: { key: "x-something-something"; value {string_value: "yadda"} } }; // Overwriting host entry breaks tests, so this is not done here. external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "More about gRPC-Gateway"; } schemes: HTTP; schemes: HTTPS; schemes: WSS; consumes: "application/json"; consumes: "application/x-foo-mime"; produces: "application/json"; produces: "application/x-foo-mime"; security_definitions: { security: { key: "BasicAuth"; value: {type: TYPE_BASIC} } security: { key: "ApiKeyAuth"; value: { type: TYPE_API_KEY; in: IN_HEADER; name: "X-API-Key"; extensions: { key: "x-amazon-apigateway-authtype"; value {string_value: "oauth2"} } extensions: { key: "x-amazon-apigateway-authorizer"; value { struct_value { fields { key: "type"; value {string_value: "token"} } fields { key: "authorizerResultTtlInSeconds"; value {number_value: 60} } } } } } } security: { key: "OAuth2"; value: { type: TYPE_OAUTH2; flow: FLOW_ACCESS_CODE; authorization_url: "https://example.com/oauth/authorize"; token_url: "https://example.com/oauth/token"; scopes: { scope: { key: "read"; value: "Grants read access"; } scope: { key: "write"; value: "Grants write access"; } scope: { key: "admin"; value: "Grants read and write access to administrative information"; } } } } } security: { security_requirement: { key: "BasicAuth"; value: {}; } security_requirement: { key: "ApiKeyAuth"; value: {}; } } security: { security_requirement: { key: "OAuth2"; value: { scope: "read"; scope: "write"; } } security_requirement: { key: "ApiKeyAuth"; value: {}; } } responses: { key: "403"; value: {description: "Returned when the user does not have permission to access the resource."} } responses: { key: "404"; value: { description: "Returned when the resource does not exist."; schema: { json_schema: {type: STRING} } } } responses: { key: "418"; value: { description: "I'm a teapot."; schema: { json_schema: {ref: ".grpc.gateway.examples.internal.proto.examplepb.NumericEnum"} } } } responses: { key: "500"; value: { description: "Server error"; headers: { key: "X-Correlation-Id" value: { description: "Unique event identifier for server requests" type: "string" format: "uuid" default: "\"2438ac3c-37eb-4902-adef-ed16b4431030\"" pattern: "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$" } }; schema: { json_schema: {ref: ".grpc.gateway.examples.internal.proto.examplepb.ErrorResponse"} } } } tags: { name: "echo rpc" description: "Echo Rpc description" extensions: { key: "x-traitTag"; value {bool_value: true} } } extensions: { key: "x-grpc-gateway-foo"; value {string_value: "bar"} } extensions: { key: "x-grpc-gateway-baz-list"; value { list_value: { values: {string_value: "one"} values: {bool_value: true} } } } }; message ErrorResponse { string correlationId = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { pattern: "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$", title: "x-correlation-id", description: "Unique event identifier for server requests", format: "uuid", example: "\"2438ac3c-37eb-4902-adef-ed16b4431030\"" }]; ErrorObject error = 2; } message ErrorObject { int32 code = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { pattern: "^[0-9]$", title: "code", description: "Response code", format: "integer" }]; string message = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { pattern: "^[a-zA-Z0-9]{1, 32}$", title: "message", description: "Response message" }]; } // Intentionally complicated message type to cover many features of Protobuf. message ABitOfEverything { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { json_schema: { title: "A bit of everything" description: "Intentionally complicated message type to cover many features of Protobuf." required: [ "uuid", "int64_value", "double_value", "required_field_schema_json_name" ] extensions: { key: "x-a-bit-of-everything-foo"; value {string_value: "bar"} } } external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more about ABitOfEverything"; } example: "{\"int64_value\": 12, \"double_value\": 12.3}" }; // Nested is nested type. message Nested { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {example: "{\"ok\": \"TRUE\"}"}; // name is nested field. string name = 1; uint32 amount = 2; // DeepEnum is one or zero. enum DeepEnum { // FALSE is false. FALSE = 0; // TRUE is true. TRUE = 1; } // DeepEnum comment. DeepEnum ok = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "DeepEnum description."}]; } Nested single_nested = 25; string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", min_length: 1, field_configuration: {path_param_name: "uuidName"}, format: "uuid", extensions: { key: "x-internal"; value {bool_value: true} } }]; repeated Nested nested = 2; float float_value = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { description: "Float value field", default: "0.2", required: ["float_value"] }]; double double_value = 4; int64 int64_value = 5; uint64 uint64_value = 6; int32 int32_value = 7; fixed64 fixed64_value = 8; fixed32 fixed32_value = 9; bool bool_value = 10; string string_value = 11; bytes bytes_value = 29; uint32 uint32_value = 13; NumericEnum enum_value = 14; pathenum.PathEnum path_enum_value = 30; pathenum.MessagePathEnum.NestedPathEnum nested_path_enum_value = 31; sfixed32 sfixed32_value = 15; sfixed64 sfixed64_value = 16; sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; oneof oneof_value { google.protobuf.Empty oneof_empty = 20; string oneof_string = 21; } map map_value = 22; map mapped_string_value = 23; map mapped_nested_value = 24; string nonConventionalNameValue = 26; google.protobuf.Timestamp timestamp_value = 27; // repeated enum value. it is comma-separated in query repeated NumericEnum repeated_enum_value = 28; // repeated numeric enum comment (This comment is overridden by the field annotation) repeated NumericEnum repeated_enum_annotation = 32 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title: "Repeated numeric enum title", description: "Repeated numeric enum description." }]; // numeric enum comment (This comment is overridden by the field annotation) NumericEnum enum_value_annotation = 33 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title: "Numeric enum title", description: "Numeric enum description." }]; // repeated string comment (This comment is overridden by the field annotation) repeated string repeated_string_annotation = 34 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title: "Repeated string title", description: "Repeated string description." }]; // repeated nested object comment (This comment is overridden by the field annotation) repeated Nested repeated_nested_annotation = 35 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title: "Repeated nested object title", description: "Repeated nested object description." }]; // nested object comments (This comment is overridden by the field annotation) Nested nested_annotation = 36 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title: "Nested object title", description: "Nested object description." }]; int64 int64_override_type = 37 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {type: INTEGER}]; // mark a field as required in Open API definition string required_string_via_field_behavior_annotation = 38 [(google.api.field_behavior) = REQUIRED]; // mark a field as readonly in Open API definition string output_only_string_via_field_behavior_annotation = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; optional string optional_string_value = 40; // Test openapiv2 generation of repeated fields repeated string product_id = 41 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { pattern: "^[0-9]+$" max_length: 19 min_length: 1 description: "Only digits are allowed." }]; // Test openapiv2 generation of required fields with annotation and jsonschema to reproduce string optional_string_field = 42; string required_string_field_1 = 43 [(google.api.field_behavior) = REQUIRED]; string required_string_field_2 = 44 [(google.api.field_behavior) = REQUIRED]; // Test openapiv2 handling of required json_name fields string required_field_behavior_json_name = 45 [ json_name = "required_field_behavior_json_name_custom", (google.api.field_behavior) = REQUIRED ]; string required_field_schema_json_name = 46 [json_name = "required_field_schema_json_name_custom"]; string trailing_only = 47; // Trailing only string trailing_only_dot = 48; // Trailing only dot. // Leading both string trailing_both = 49; // Trailing both. // Leading multiline // // This is an example of a multi-line comment. string trailing_multiline = 50; // Trailing multiline. // Specify a custom format of repeated field items repeated string uuids = 51 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "uuid"}]; } // ABitOfEverythingRepeated is used to validate repeated path parameter functionality message ABitOfEverythingRepeated { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {example: "{\"path_repeated_bool_value\": [true, true, false, true], \"path_repeated_int32_value\": [1, 2, 3]}"}; // repeated values. they are comma-separated in path repeated float path_repeated_float_value = 1; repeated double path_repeated_double_value = 2; repeated int64 path_repeated_int64_value = 3; repeated uint64 path_repeated_uint64_value = 4; repeated int32 path_repeated_int32_value = 5; repeated fixed64 path_repeated_fixed64_value = 6; repeated fixed32 path_repeated_fixed32_value = 7; repeated bool path_repeated_bool_value = 8; repeated string path_repeated_string_value = 9; repeated bytes path_repeated_bytes_value = 10; repeated uint32 path_repeated_uint32_value = 11; repeated NumericEnum path_repeated_enum_value = 12; repeated sfixed32 path_repeated_sfixed32_value = 13; repeated sfixed64 path_repeated_sfixed64_value = 14; repeated sint32 path_repeated_sint32_value = 15; repeated sint64 path_repeated_sint64_value = 16; } message CheckStatusResponse { google.rpc.Status status = 1; } message Body { string name = 1; } message MessageWithBody { string id = 1; Body data = 2; } // NumericEnum is one or zero. enum NumericEnum { // ZERO means 0 ZERO = 0; // ONE means 1 ONE = 1; } // UpdateV2Request request for update includes the message and the update mask message UpdateV2Request { ABitOfEverything abe = 1; // The paths to update. google.protobuf.FieldMask update_mask = 2; } // An example resource type from AIP-123 used to test the behavior described in // the CreateBookRequest message. // // See: https://google.aip.dev/123 message Book { // The resource name of the book. // // Format: `publishers/{publisher}/books/{book}` // // Example: `publishers/1257894000000000000/books/my-book` string name = 1; // Output only. The book's ID. string id = 2; // Output only. Creation time of the book. google.protobuf.Timestamp create_time = 3; } // A standard Create message from AIP-133 with a user-specified ID. // The user-specified ID (the `book_id` field in this example) must become a // query parameter in the OpenAPI spec. // // See: https://google.aip.dev/133#user-specified-ids message CreateBookRequest { // The publisher in which to create the book. // // Format: `publishers/{publisher}` // // Example: `publishers/1257894000000000000` string parent = 1; // The book to create. Book book = 2; // The ID to use for the book. // // This must start with an alphanumeric character. string book_id = 3; } // A standard Update message from AIP-134 // // See: https://google.aip.dev/134#request-message message UpdateBookRequest { // The book to update. // // The book's `name` field is used to identify the book to be updated. // Format: publishers/{publisher}/books/{book} Book book = 1 [(google.api.field_behavior) = REQUIRED]; // The list of fields to be updated. google.protobuf.FieldMask update_mask = 2; // If set to true, and the book is not found, a new book will be created. // In this situation, `update_mask` is ignored. bool allow_missing = 3; } // ABitOfEverything service is used to validate that APIs with complicated // proto messages and URL templates are still processed correctly. service ABitOfEverythingService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { name: "ABitOfEverything" description: "ABitOfEverythingService description -- which should not be used in place of the documentation comment!" external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more about EchoService"; } }; // Create a new ABitOfEverything // // This API creates a new ABitOfEverything rpc Create(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = {post: "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}"}; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything" body: "*" }; } // Create a book. rpc CreateBook(CreateBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{parent=publishers/*}/books" body: "book" }; } rpc UpdateBook(UpdateBookRequest) returns (Book) { option (google.api.http) = { patch: "/v1/{book.name=publishers/*/books/*}" body: "book" }; } rpc Lookup(grpc.gateway.examples.internal.proto.sub2.IdMessage) returns (ABitOfEverything) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything/{uuid}"}; } rpc Custom(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = {post: "/v1/example/a_bit_of_everything/{uuid}:custom"}; } rpc DoubleColon(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = {post: "/v1/example/a_bit_of_everything/{uuid}:custom:custom"}; } rpc Update(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { put: "/v1/example/a_bit_of_everything/{uuid}" body: "*" }; } rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { option (google.api.http) = { put: "/v2/example/a_bit_of_everything/{abe.uuid}" body: "abe" additional_bindings: [ { patch: "/v2/example/a_bit_of_everything/{abe.uuid}" body: "abe" }, { patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" body: "*" } ] }; } rpc Delete(grpc.gateway.examples.internal.proto.sub2.IdMessage) returns (google.protobuf.Empty) { option (google.api.http) = {delete: "/v1/example/a_bit_of_everything/{uuid}"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: { security_requirement: { key: "ApiKeyAuth"; value: {} } security_requirement: { key: "OAuth2"; value: { scope: "read"; scope: "write"; } } } extensions: { key: "x-irreversible"; value {bool_value: true} } }; } rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything/query/{uuid}"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { deprecated: true // For testing purposes. external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more about GetQuery"; } security: {} }; } rpc GetRepeatedQuery(ABitOfEverythingRepeated) returns (ABitOfEverythingRepeated) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}"}; } // Echo allows posting a StringMessage value. // // It also exposes multiple bindings. // // This makes it useful when validating that the OpenAPI v2 API // description exposes documentation correctly on all paths // defined as additional_bindings in the proto. rpc Echo(grpc.gateway.examples.internal.proto.sub.StringMessage) returns (grpc.gateway.examples.internal.proto.sub.StringMessage) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/echo/{value}" additional_bindings { post: "/v2/example/echo" body: "value" } additional_bindings {get: "/v2/example/echo"} }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { description: "Description Echo"; summary: "Summary: Echo rpc"; tags: "echo rpc"; external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more Echo"; } responses: { key: "200" value: { examples: { key: "application/json" value: "{\"value\": \"the input value\"}" } } } responses: { key: "503"; value: { description: "Returned when the resource is temporarily unavailable."; extensions: { key: "x-number"; value {number_value: 100} } } } responses: { // Overwrites global definition. key: "404"; value: { description: "Returned when the resource does not exist."; schema: { json_schema: {type: INTEGER} } } } }; } rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { post: "/v1/example/deep_path/{single_nested.name}" body: "*" }; } rpc NoBindings(google.protobuf.Duration) returns (google.protobuf.Empty) {} rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v2/example/timeout"}; } rpc ErrorWithDetails(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v2/example/errorwithdetails"}; } rpc GetMessageWithBody(MessageWithBody) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/example/withbody/{id}", body: "data" }; } rpc PostWithEmptyBody(Body) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/example/postwithemptybody/{name}", body: "*" }; } rpc CheckGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything/params/get/{single_nested.name}"}; } rpc CheckNestedEnumGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}"}; } rpc CheckPostQueryParams(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/params/post/{string_value}" body: "single_nested" }; } rpc OverwriteRequestContentType(Body) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/example/overwriterequestcontenttype" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {consumes: "application/x-bar-mime"}; } rpc OverwriteResponseContentType(google.protobuf.Empty) returns (google.protobuf.StringValue) { option (google.api.http) = {get: "/v2/example/overwriteresponsecontenttype"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {produces: "application/text"}; } rpc CheckExternalPathEnum(pathenum.MessageWithPathEnum) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v2/{value}:check"}; } rpc CheckExternalNestedPathEnum(pathenum.MessageWithNestedPathEnum) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v3/{value}:check"}; } rpc CheckStatus(google.protobuf.Empty) returns (CheckStatusResponse) { option (google.api.http) = {get: "/v1/example/checkStatus"}; } rpc Exists(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { custom: { kind: "HEAD", path: "/v1/example/a_bit_of_everything/{uuid}" } }; } rpc CustomOptionsRequest(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { custom: { kind: "OPTIONS", path: "/v1/example/a_bit_of_everything/{uuid}" } }; } rpc TraceRequest(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { custom: { kind: "TRACE", path: "/v1/example/a_bit_of_everything/{uuid}" } }; } rpc PostOneofEnum(grpc.gateway.examples.internal.proto.oneofenum.OneofEnumMessage) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/example/oneofenum" body: "example_enum" }; } rpc PostRequiredMessageType(RequiredMessageTypeRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/example/requiredmessagetype" body: "*" }; } } // camelCase and lowercase service names are valid but not recommended (use TitleCase instead) service camelCaseServiceName { rpc Empty(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = {get: "/v2/example/empty"}; } } service AnotherServiceWithNoBindings { rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} } service SnakeEnumService { rpc SnakeEnum(SnakeEnumRequest) returns (SnakeEnumResponse) { option (google.api.http) = {get: "/v1/example/snake/{who}/{what}/{where}"}; } } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE enum snake_case_enum { // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_c = 0; // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_d = 1; } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE enum snake_case_0_enum { // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_e = 0; // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_f = 1; } message SnakeEnumRequest { snake_case_enum what = 1; snake_case_0_enum who = 2; pathenum.snake_case_for_import where = 3; } message SnakeEnumResponse {} // Required message type -> OpenAPI // https://github.com/grpc-ecosystem/grpc-gateway/issues/2837 message RequiredMessageTypeRequest { string id = 1 [(google.api.field_behavior) = REQUIRED]; Foo foo = 2 [(google.api.field_behavior) = REQUIRED]; } message Foo { Bar bar = 1 [(google.api.field_behavior) = REQUIRED]; } message Bar { string id = 1 [(google.api.field_behavior) = REQUIRED]; } a_bit_of_everything.swagger.json000066400000000000000000007327431465037340600367360ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "A Bit of Everything", "version": "1.0", "contact": { "name": "gRPC-Gateway project", "url": "https://github.com/grpc-ecosystem/grpc-gateway", "email": "none@example.com" }, "license": { "name": "BSD 3-Clause License", "url": "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE" }, "x-something-something": "yadda" }, "tags": [ { "name": "echo rpc", "description": "Echo Rpc description", "x-traitTag": true }, { "name": "ABitOfEverything", "description": "ABitOfEverythingService description -- which should not be used in place of the documentation comment!", "externalDocs": { "description": "Find out more about EchoService", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } }, { "name": "camelCaseServiceName" }, { "name": "AnotherServiceWithNoBindings" }, { "name": "SnakeEnumService" } ], "schemes": [ "http", "https", "wss" ], "consumes": [ "application/json", "application/x-foo-mime" ], "produces": [ "application/json", "application/x-foo-mime" ], "paths": { "/v1/example/a_bit_of_everything": { "post": { "operationId": "ABitOfEverythingService_CreateBody", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "Intentionally complicated message type to cover many features of Protobuf.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/echo/{value}": { "get": { "summary": "Summary: Echo rpc", "description": "Description Echo", "operationId": "ABitOfEverythingService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" }, "examples": { "application/json": { "value": "the input value" } } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "integer", "format": "integer" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "503": { "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "value", "in": "path", "required": true, "type": "string" } ], "tags": [ "echo rpc" ], "externalDocs": { "description": "Find out more Echo", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } }, "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}": { "get": { "operationId": "ABitOfEverythingService_CheckNestedEnumGetQueryParams", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "singleNested.ok", "description": "DeepEnum description.", "in": "path", "required": true, "type": "string", "enum": [ "FALSE", "TRUE" ] }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "uuid", "in": "query", "required": true, "type": "string", "format": "uuid", "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/params/get/{singleNested.name}": { "get": { "operationId": "ABitOfEverythingService_CheckGetQueryParams", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "singleNested.name", "description": "name is nested field.", "in": "path", "required": true, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "uuid", "in": "query", "required": true, "type": "string", "format": "uuid", "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/params/post/{stringValue}": { "post": { "operationId": "ABitOfEverythingService_CheckPostQueryParams", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "stringValue", "in": "path", "required": true, "type": "string" }, { "name": "singleNested", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ABitOfEverythingNested" } }, { "name": "uuid", "in": "query", "required": true, "type": "string", "format": "uuid", "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/query/{uuidName}": { "get": { "operationId": "ABitOfEverythingService_GetQuery", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverything" ], "deprecated": true, "security": [], "externalDocs": { "description": "Find out more about GetQuery", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } }, "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}": { "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", "operationId": "ABitOfEverythingService_Create", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "floatValue", "description": "Float value field", "in": "path", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "path", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "path", "required": true, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "path", "required": true, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "path", "required": true, "type": "boolean" }, { "name": "stringValue", "in": "path", "required": true, "type": "string", "pattern": "strprefix/[^/]+" }, { "name": "uint32Value", "in": "path", "required": true, "type": "integer", "format": "int64" }, { "name": "sfixed32Value", "in": "path", "required": true, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "path", "required": true, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "nonConventionalNameValue", "in": "path", "required": true, "type": "string" }, { "name": "enumValue", "in": "path", "required": true, "type": "string", "enum": [ "ZERO", "ONE" ] }, { "name": "pathEnumValue", "in": "path", "required": true, "type": "string", "enum": [ "ABC", "DEF" ] }, { "name": "nestedPathEnumValue", "in": "path", "required": true, "type": "string", "enum": [ "GHI", "JKL" ] }, { "name": "enumValueAnnotation", "description": "Numeric enum description.", "in": "path", "required": true, "type": "string", "enum": [ "ZERO", "ONE" ] }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "uuid", "in": "query", "required": true, "type": "string", "format": "uuid", "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/{uuidName}": { "put": { "operationId": "ABitOfEverythingService_Update", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbABitOfEverythingServiceUpdateBody" } } ], "tags": [ "ABitOfEverythingService" ] }, "head": { "operationId": "ABitOfEverythingService_Exists", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] }, "options": { "operationId": "ABitOfEverythingService_CustomOptionsRequest", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/{uuidName}:custom": { "post": { "operationId": "ABitOfEverythingService_Custom", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/{uuidName}:custom:custom": { "post": { "operationId": "ABitOfEverythingService_DoubleColon", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "singleNested.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "singleNested.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "singleNested.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "floatValue", "description": "Float value field", "in": "query", "required": true, "type": "number", "format": "float", "default": "0.2" }, { "name": "doubleValue", "in": "query", "required": true, "type": "number", "format": "double" }, { "name": "int64Value", "in": "query", "required": true, "type": "string", "format": "int64" }, { "name": "uint64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "int32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "fixed64Value", "in": "query", "required": false, "type": "string", "format": "uint64" }, { "name": "fixed32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "boolValue", "in": "query", "required": false, "type": "boolean" }, { "name": "stringValue", "in": "query", "required": false, "type": "string" }, { "name": "bytesValue", "in": "query", "required": false, "type": "string", "format": "byte" }, { "name": "uint32Value", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "enumValue", "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "pathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, { "name": "nestedPathEnumValue", "in": "query", "required": false, "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, { "name": "sfixed32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sfixed64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "sint32Value", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "sint64Value", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "repeatedStringValue", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "oneofEmpty", "in": "query", "required": false, "type": "object" }, { "name": "oneofString", "in": "query", "required": false, "type": "string" }, { "name": "mapValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "mappedStringValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false, "type": "string" }, { "name": "mappedNestedValue", "description": "This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18", "in": "query", "required": false }, { "name": "nonConventionalNameValue", "in": "query", "required": false, "type": "string" }, { "name": "timestampValue", "in": "query", "required": false, "type": "string", "format": "date-time" }, { "name": "repeatedEnumValue", "description": "repeated enum value. it is comma-separated in query\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "repeatedEnumAnnotation", "description": "Repeated numeric enum title\n\nRepeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "multi" }, { "name": "enumValueAnnotation", "description": "Numeric enum title\n\nNumeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO" }, { "name": "repeatedStringAnnotation", "description": "Repeated string title\n\nRepeated string description.", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "nestedAnnotation.name", "description": "name is nested field.", "in": "query", "required": false, "type": "string" }, { "name": "nestedAnnotation.amount", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "nestedAnnotation.ok", "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE" }, { "name": "int64OverrideType", "in": "query", "required": false, "type": "integer", "format": "int64" }, { "name": "requiredStringViaFieldBehaviorAnnotation", "description": "mark a field as required in Open API definition", "in": "query", "required": true, "type": "string" }, { "name": "outputOnlyStringViaFieldBehaviorAnnotation", "description": "mark a field as readonly in Open API definition", "in": "query", "required": false, "type": "string" }, { "name": "optionalStringValue", "in": "query", "required": false, "type": "string" }, { "name": "productId", "description": "Test openapiv2 generation of repeated fields\n\nOnly digits are allowed.", "in": "query", "required": false, "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "collectionFormat": "multi" }, { "name": "optionalStringField", "description": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce", "in": "query", "required": false, "type": "string" }, { "name": "requiredStringField1", "in": "query", "required": true, "type": "string" }, { "name": "requiredStringField2", "in": "query", "required": true, "type": "string" }, { "name": "required_field_behavior_json_name_custom", "description": "Test openapiv2 handling of required json_name fields", "in": "query", "required": true, "type": "string" }, { "name": "required_field_schema_json_name_custom", "in": "query", "required": true, "type": "string" }, { "name": "trailingOnly", "description": "Trailing only", "in": "query", "required": false, "type": "string" }, { "name": "trailingOnlyDot", "description": "Trailing only dot.", "in": "query", "required": false, "type": "string" }, { "name": "trailingBoth", "description": "Leading both\n\nTrailing both.", "in": "query", "required": false, "type": "string" }, { "name": "trailingMultiline", "description": "Leading multiline\n\nThis is an example of a multi-line comment.\n\nTrailing multiline.", "in": "query", "required": false, "type": "string" }, { "name": "uuids", "description": "Specify a custom format of repeated field items", "in": "query", "required": false, "type": "array", "items": { "type": "string", "format": "uuid" }, "collectionFormat": "multi" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/a_bit_of_everything/{uuid}": { "get": { "operationId": "ABitOfEverythingService_Lookup", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuid", "in": "path", "required": true, "type": "string" } ], "tags": [ "ABitOfEverythingService" ] }, "delete": { "operationId": "ABitOfEverythingService_Delete", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuid", "in": "path", "required": true, "type": "string" } ], "tags": [ "ABitOfEverything" ], "security": [ { "ApiKeyAuth": [], "OAuth2": [ "read", "write" ] } ], "x-irreversible": true } }, "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}": { "get": { "operationId": "ABitOfEverythingService_GetRepeatedQuery", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverythingRepeated" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "pathRepeatedFloatValue", "description": "repeated values. they are comma-separated in path", "in": "path", "required": true, "type": "array", "items": { "type": "number", "format": "float" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedDoubleValue", "in": "path", "required": true, "type": "array", "items": { "type": "number", "format": "double" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedInt64Value", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "int64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedUint64Value", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "uint64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedInt32Value", "in": "path", "required": true, "type": "array", "items": { "type": "integer", "format": "int32" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedFixed64Value", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "uint64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedFixed32Value", "in": "path", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedBoolValue", "in": "path", "required": true, "type": "array", "items": { "type": "boolean" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedStringValue", "in": "path", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedBytesValue", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "byte" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedUint32Value", "in": "path", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedEnumValue", "in": "path", "required": true, "type": "array", "items": { "type": "string", "enum": [ "ZERO", "ONE" ] }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedSfixed32Value", "in": "path", "required": true, "type": "array", "items": { "type": "integer", "format": "int32" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedSfixed64Value", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "int64" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedSint32Value", "in": "path", "required": true, "type": "array", "items": { "type": "integer", "format": "int32" }, "collectionFormat": "csv", "minItems": 1 }, { "name": "pathRepeatedSint64Value", "in": "path", "required": true, "type": "array", "items": { "type": "string", "format": "int64" }, "collectionFormat": "csv", "minItems": 1 } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/checkStatus": { "get": { "operationId": "ABitOfEverythingService_CheckStatus", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbCheckStatusResponse" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/deep_path/{singleNested.name}": { "post": { "operationId": "ABitOfEverythingService_DeepPathEcho", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "singleNested.name", "description": "name is nested field.", "in": "path", "required": true, "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ABitOfEverythingServiceDeepPathEchoBody" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/oneofenum": { "post": { "operationId": "ABitOfEverythingService_PostOneofEnum", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "exampleEnum", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oneofenumExampleEnum" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/requiredmessagetype": { "post": { "operationId": "ABitOfEverythingService_PostRequiredMessageType", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbRequiredMessageTypeRequest" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/example/snake/{who}/{what}/{where}": { "get": { "operationId": "SnakeEnumService_SnakeEnum", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSnakeEnumResponse" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "who", "in": "path", "required": true, "type": "string", "enum": [ "value_e", "value_f" ] }, { "name": "what", "in": "path", "required": true, "type": "string", "enum": [ "value_c", "value_d" ] }, { "name": "where", "in": "path", "required": true, "type": "string", "enum": [ "value_x", "value_y" ] } ], "tags": [ "SnakeEnumService" ] } }, "/v1/{book.name}": { "patch": { "operationId": "ABitOfEverythingService_UpdateBook", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbBook" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "book.name", "description": "The resource name of the book.\n\nFormat: `publishers/{publisher}/books/{book}`\n\nExample: `publishers/1257894000000000000/books/my-book`", "in": "path", "required": true, "type": "string", "pattern": "publishers/[^/]+/books/[^/]+" }, { "name": "book", "description": "The book to update.\n\nThe book's `name` field is used to identify the book to be updated.\nFormat: publishers/{publisher}/books/{book}", "in": "body", "required": true, "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "Output only. The book's ID.", "readOnly": true }, "createTime": { "type": "string", "format": "date-time", "description": "Output only. Creation time of the book.", "readOnly": true } }, "description": "The book's `name` field is used to identify the book to be updated.\nFormat: publishers/{publisher}/books/{book}", "title": "The book to update." } }, { "name": "allowMissing", "description": "If set to true, and the book is not found, a new book will be created.\nIn this situation, `update_mask` is ignored.", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v1/{parent}/books": { "post": { "summary": "Create a book.", "operationId": "ABitOfEverythingService_CreateBook", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbBook" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "parent", "description": "The publisher in which to create the book.\n\nFormat: `publishers/{publisher}`\n\nExample: `publishers/1257894000000000000`", "in": "path", "required": true, "type": "string", "pattern": "publishers/[^/]+" }, { "name": "book", "description": "The book to create.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbBook" } }, { "name": "bookId", "description": "The ID to use for the book.\n\nThis must start with an alphanumeric character.", "in": "query", "required": false, "type": "string" } ], "tags": [ "ABitOfEverythingService" ] } }, "/v2/example/a_bit_of_everything/{uuidName}": { "put": { "operationId": "ABitOfEverythingService_UpdateV2", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "abe", "description": "A bit of everything\n\nIntentionally complicated message type to cover many features of Protobuf.", "in": "body", "required": true, "schema": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" } }, { "name": "updateMask", "description": "The paths to update.", "in": "query", "required": false, "type": "string" } ], "tags": [ "ABitOfEverythingService" ] }, "patch": { "operationId": "ABitOfEverythingService_UpdateV22", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "abe", "description": "A bit of everything\n\nIntentionally complicated message type to cover many features of Protobuf.", "in": "body", "required": true, "schema": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v2/example/echo": { "get": { "summary": "Summary: Echo rpc", "description": "Description Echo", "operationId": "ABitOfEverythingService_Echo3", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" }, "examples": { "application/json": { "value": "the input value" } } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "integer", "format": "integer" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "503": { "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "value", "in": "query", "required": false, "type": "string" } ], "tags": [ "echo rpc" ], "externalDocs": { "description": "Find out more Echo", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } }, "post": { "summary": "Summary: Echo rpc", "description": "Description Echo", "operationId": "ABitOfEverythingService_Echo2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" }, "examples": { "application/json": { "value": "the input value" } } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "integer", "format": "integer" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "503": { "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "value", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "echo rpc" ], "externalDocs": { "description": "Find out more Echo", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } }, "/v2/example/empty": { "get": { "operationId": "camelCaseServiceName_Empty", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "camelCaseServiceName" ] } }, "/v2/example/errorwithdetails": { "get": { "operationId": "ABitOfEverythingService_ErrorWithDetails", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "ABitOfEverythingService" ] } }, "/v2/example/overwriterequestcontenttype": { "post": { "operationId": "ABitOfEverythingService_OverwriteRequestContentType", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbBody" } } ], "tags": [ "ABitOfEverything" ], "consumes": [ "application/x-bar-mime" ] } }, "/v2/example/overwriteresponsecontenttype": { "get": { "operationId": "ABitOfEverythingService_OverwriteResponseContentType", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "ABitOfEverything" ], "produces": [ "application/text" ] } }, "/v2/example/postwithemptybody/{name}": { "post": { "operationId": "ABitOfEverythingService_PostWithEmptyBody", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "name", "in": "path", "required": true, "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ABitOfEverythingServicePostWithEmptyBodyBody" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v2/example/timeout": { "get": { "operationId": "ABitOfEverythingService_Timeout", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "ABitOfEverythingService" ] } }, "/v2/example/withbody/{id}": { "post": { "operationId": "ABitOfEverythingService_GetMessageWithBody", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" }, { "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbBody" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v2/{value}:check": { "get": { "operationId": "ABitOfEverythingService_CheckExternalPathEnum", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "value", "in": "path", "required": true, "type": "string", "enum": [ "ABC", "DEF" ] } ], "tags": [ "ABitOfEverythingService" ] } }, "/v2a/example/a_bit_of_everything/{uuidName}": { "patch": { "operationId": "ABitOfEverythingService_UpdateV23", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "uuidName", "in": "path", "required": true, "type": "string", "format": "uuid", "x-internal": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ABitOfEverythingServiceUpdateV2Body" } } ], "tags": [ "ABitOfEverythingService" ] } }, "/v3/{value}:check": { "get": { "operationId": "ABitOfEverythingService_CheckExternalNestedPathEnum", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "418": { "description": "I'm a teapot.", "schema": { "$ref": "#/definitions/examplepbNumericEnum" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/examplepbErrorResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "value", "in": "path", "required": true, "type": "string", "enum": [ "GHI", "JKL" ] } ], "tags": [ "ABitOfEverythingService" ] } } }, "definitions": { "ABitOfEverythingNested": { "type": "object", "example": { "ok": "TRUE" }, "properties": { "name": { "type": "string", "description": "name is nested field." }, "amount": { "type": "integer", "format": "int64" }, "ok": { "$ref": "#/definitions/NestedDeepEnum", "description": "DeepEnum description." } }, "description": "Nested is nested type." }, "ABitOfEverythingServiceDeepPathEchoBody": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "type": "object", "example": { "ok": "TRUE" }, "properties": { "amount": { "type": "integer", "format": "int64" }, "ok": { "$ref": "#/definitions/NestedDeepEnum", "description": "DeepEnum description." } }, "description": "Nested is nested type." }, "uuid": { "type": "string", "format": "uuid", "minLength": 1, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "uuid", "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "ABitOfEverythingServicePostWithEmptyBodyBody": { "type": "object" }, "ABitOfEverythingServiceUpdateV2Body": { "type": "object", "properties": { "abe": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "x-a-bit-of-everything-foo": "bar" }, "updateMask": { "type": "string", "description": "The paths to update." } }, "title": "UpdateV2Request request for update includes the message and the update mask", "required": [ "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ] }, "MessagePathEnumNestedPathEnum": { "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, "NestedDeepEnum": { "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE", "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." }, "examplepbABitOfEverything": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { "type": "string", "format": "uuid", "minLength": 1, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "uuid", "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "examplepbABitOfEverythingRepeated": { "type": "object", "example": { "path_repeated_bool_value": [ true, true, false, true ], "path_repeated_int32_value": [ 1, 2, 3 ] }, "properties": { "pathRepeatedFloatValue": { "type": "array", "items": { "type": "number", "format": "float" }, "title": "repeated values. they are comma-separated in path" }, "pathRepeatedDoubleValue": { "type": "array", "items": { "type": "number", "format": "double" } }, "pathRepeatedInt64Value": { "type": "array", "items": { "type": "string", "format": "int64" } }, "pathRepeatedUint64Value": { "type": "array", "items": { "type": "string", "format": "uint64" } }, "pathRepeatedInt32Value": { "type": "array", "items": { "type": "integer", "format": "int32" } }, "pathRepeatedFixed64Value": { "type": "array", "items": { "type": "string", "format": "uint64" } }, "pathRepeatedFixed32Value": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "pathRepeatedBoolValue": { "type": "array", "items": { "type": "boolean" } }, "pathRepeatedStringValue": { "type": "array", "items": { "type": "string" } }, "pathRepeatedBytesValue": { "type": "array", "items": { "type": "string", "format": "byte" } }, "pathRepeatedUint32Value": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "pathRepeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" } }, "pathRepeatedSfixed32Value": { "type": "array", "items": { "type": "integer", "format": "int32" } }, "pathRepeatedSfixed64Value": { "type": "array", "items": { "type": "string", "format": "int64" } }, "pathRepeatedSint32Value": { "type": "array", "items": { "type": "integer", "format": "int32" } }, "pathRepeatedSint64Value": { "type": "array", "items": { "type": "string", "format": "int64" } } }, "title": "ABitOfEverythingRepeated is used to validate repeated path parameter functionality" }, "examplepbABitOfEverythingServiceUpdateBody": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "examplepbBar": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] }, "examplepbBody": { "type": "object", "properties": { "name": { "type": "string" } } }, "examplepbBook": { "type": "object", "properties": { "name": { "type": "string", "description": "The resource name of the book.\n\nFormat: `publishers/{publisher}/books/{book}`\n\nExample: `publishers/1257894000000000000/books/my-book`" }, "id": { "type": "string", "description": "Output only. The book's ID.", "readOnly": true }, "createTime": { "type": "string", "format": "date-time", "description": "Output only. Creation time of the book.", "readOnly": true } }, "description": "An example resource type from AIP-123 used to test the behavior described in\nthe CreateBookRequest message.\n\nSee: https://google.aip.dev/123" }, "examplepbCheckStatusResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/rpcStatus" } } }, "examplepbErrorObject": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Response code", "title": "code", "pattern": "^[0-9]$" }, "message": { "type": "string", "description": "Response message", "title": "message", "pattern": "^[a-zA-Z0-9]{1, 32}$" } } }, "examplepbErrorResponse": { "type": "object", "properties": { "correlationId": { "type": "string", "format": "uuid", "example": "2438ac3c-37eb-4902-adef-ed16b4431030", "description": "Unique event identifier for server requests", "title": "x-correlation-id", "pattern": "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$" }, "error": { "$ref": "#/definitions/examplepbErrorObject" } } }, "examplepbNumericEnum": { "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, "examplepbRequiredMessageTypeRequest": { "type": "object", "properties": { "id": { "type": "string" }, "foo": { "$ref": "#/definitions/protoexamplepbFoo" } }, "title": "Required message type -\u003e OpenAPI\nhttps://github.com/grpc-ecosystem/grpc-gateway/issues/2837", "required": [ "id", "foo" ] }, "examplepbSnakeEnumResponse": { "type": "object" }, "examplepbsnake_case_0_enum": { "type": "string", "enum": [ "value_e", "value_f" ], "default": "value_e", "description": "- value_e: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_f: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", "title": "Ignoring lint warnings as this enum type exist to validate proper functionality\nfor projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" }, "examplepbsnake_case_enum": { "type": "string", "enum": [ "value_c", "value_d" ], "default": "value_c", "description": "- value_c: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_d: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", "title": "Ignoring lint warnings as this enum type exist to validate proper functionality\nfor projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" }, "oneofenumExampleEnum": { "type": "string", "enum": [ "EXAMPLE_ENUM_UNSPECIFIED", "EXAMPLE_ENUM_FIRST" ], "default": "EXAMPLE_ENUM_UNSPECIFIED" }, "pathenumPathEnum": { "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, "pathenumsnake_case_for_import": { "type": "string", "enum": [ "value_x", "value_y" ], "default": "value_x", "description": "- value_x: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - value_y: buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", "title": "Ignoring lint warnings as this enum type exist to validate proper functionality\nfor projects that don't follow these lint rules.\nbuf:lint:ignore ENUM_PASCAL_CASE" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "protoexamplepbFoo": { "type": "object", "properties": { "bar": { "$ref": "#/definitions/examplepbBar" } }, "required": [ "bar" ] }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." }, "subStringMessage": { "type": "object", "properties": { "value": { "type": "string" } } } }, "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "X-API-Key", "in": "header", "x-amazon-apigateway-authorizer": { "authorizerResultTtlInSeconds": 60, "type": "token" }, "x-amazon-apigateway-authtype": "oauth2" }, "BasicAuth": { "type": "basic" }, "OAuth2": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "https://example.com/oauth/authorize", "tokenUrl": "https://example.com/oauth/token", "scopes": { "admin": "Grants read and write access to administrative information", "read": "Grants read access", "write": "Grants write access" } } }, "security": [ { "ApiKeyAuth": [], "BasicAuth": [] }, { "ApiKeyAuth": [], "OAuth2": [ "read", "write" ] } ], "externalDocs": { "description": "More about gRPC-Gateway", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "x-grpc-gateway-baz-list": [ "one", true ], "x-grpc-gateway-foo": "bar" } a_bit_of_everything_grpc.pb.go000066400000000000000000002014451465037340600363350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/a_bit_of_everything.proto package examplepb import ( context "context" oneofenum "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum" pathenum "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" sub2 "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" durationpb "google.golang.org/protobuf/types/known/durationpb" emptypb "google.golang.org/protobuf/types/known/emptypb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // ABitOfEverythingServiceClient is the client API for ABitOfEverythingService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ABitOfEverythingServiceClient interface { // Create a new ABitOfEverything // // This API creates a new ABitOfEverything Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) // Create a book. CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) UpdateBook(ctx context.Context, in *UpdateBookRequest, opts ...grpc.CallOption) (*Book, error) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) Custom(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) DoubleColon(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*emptypb.Empty, error) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*emptypb.Empty, error) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) // Echo allows posting a StringMessage value. // // It also exposes multiple bindings. // // This makes it useful when validating that the OpenAPI v2 API // description exposes documentation correctly on all paths // defined as additional_bindings in the proto. Echo(ctx context.Context, in *sub.StringMessage, opts ...grpc.CallOption) (*sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) NoBindings(ctx context.Context, in *durationpb.Duration, opts ...grpc.CallOption) (*emptypb.Empty, error) Timeout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) ErrorWithDetails(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*emptypb.Empty, error) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*emptypb.Empty, error) CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) OverwriteRequestContentType(ctx context.Context, in *Body, opts ...grpc.CallOption) (*emptypb.Empty, error) OverwriteResponseContentType(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) CheckExternalPathEnum(ctx context.Context, in *pathenum.MessageWithPathEnum, opts ...grpc.CallOption) (*emptypb.Empty, error) CheckExternalNestedPathEnum(ctx context.Context, in *pathenum.MessageWithNestedPathEnum, opts ...grpc.CallOption) (*emptypb.Empty, error) CheckStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CheckStatusResponse, error) Exists(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) CustomOptionsRequest(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) TraceRequest(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) PostOneofEnum(ctx context.Context, in *oneofenum.OneofEnumMessage, opts ...grpc.CallOption) (*emptypb.Empty, error) PostRequiredMessageType(ctx context.Context, in *RequiredMessageTypeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type aBitOfEverythingServiceClient struct { cc grpc.ClientConnInterface } func NewABitOfEverythingServiceClient(cc grpc.ClientConnInterface) ABitOfEverythingServiceClient { return &aBitOfEverythingServiceClient{cc} } func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Create", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CreateBook(ctx context.Context, in *CreateBookRequest, opts ...grpc.CallOption) (*Book, error) { out := new(Book) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBook", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) UpdateBook(ctx context.Context, in *UpdateBookRequest, opts ...grpc.CallOption) (*Book, error) { out := new(Book) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateBook", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Lookup", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Custom(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Custom", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) DoubleColon(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DoubleColon", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Update", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Delete", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetQuery", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) { out := new(ABitOfEverythingRepeated) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.StringMessage, opts ...grpc.CallOption) (*sub.StringMessage, error) { out := new(sub.StringMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *durationpb.Duration, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/NoBindings", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Timeout", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckGetQueryParams", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckPostQueryParams", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) OverwriteRequestContentType(ctx context.Context, in *Body, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteRequestContentType", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) OverwriteResponseContentType(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) { out := new(wrapperspb.StringValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteResponseContentType", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckExternalPathEnum(ctx context.Context, in *pathenum.MessageWithPathEnum, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalPathEnum", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckExternalNestedPathEnum(ctx context.Context, in *pathenum.MessageWithNestedPathEnum, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalNestedPathEnum", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CheckStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CheckStatusResponse, error) { out := new(CheckStatusResponse) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckStatus", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) Exists(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Exists", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) CustomOptionsRequest(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CustomOptionsRequest", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) TraceRequest(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/TraceRequest", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) PostOneofEnum(ctx context.Context, in *oneofenum.OneofEnumMessage, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostOneofEnum", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *aBitOfEverythingServiceClient) PostRequiredMessageType(ctx context.Context, in *RequiredMessageTypeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostRequiredMessageType", in, out, opts...) if err != nil { return nil, err } return out, nil } // ABitOfEverythingServiceServer is the server API for ABitOfEverythingService service. // All implementations should embed UnimplementedABitOfEverythingServiceServer // for forward compatibility type ABitOfEverythingServiceServer interface { // Create a new ABitOfEverything // // This API creates a new ABitOfEverything Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) // Create a book. CreateBook(context.Context, *CreateBookRequest) (*Book, error) UpdateBook(context.Context, *UpdateBookRequest) (*Book, error) Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) Custom(context.Context, *ABitOfEverything) (*ABitOfEverything, error) DoubleColon(context.Context, *ABitOfEverything) (*ABitOfEverything, error) Update(context.Context, *ABitOfEverything) (*emptypb.Empty, error) UpdateV2(context.Context, *UpdateV2Request) (*emptypb.Empty, error) Delete(context.Context, *sub2.IdMessage) (*emptypb.Empty, error) GetQuery(context.Context, *ABitOfEverything) (*emptypb.Empty, error) GetRepeatedQuery(context.Context, *ABitOfEverythingRepeated) (*ABitOfEverythingRepeated, error) // Echo allows posting a StringMessage value. // // It also exposes multiple bindings. // // This makes it useful when validating that the OpenAPI v2 API // description exposes documentation correctly on all paths // defined as additional_bindings in the proto. Echo(context.Context, *sub.StringMessage) (*sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) NoBindings(context.Context, *durationpb.Duration) (*emptypb.Empty, error) Timeout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) ErrorWithDetails(context.Context, *emptypb.Empty) (*emptypb.Empty, error) GetMessageWithBody(context.Context, *MessageWithBody) (*emptypb.Empty, error) PostWithEmptyBody(context.Context, *Body) (*emptypb.Empty, error) CheckGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CheckNestedEnumGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) OverwriteRequestContentType(context.Context, *Body) (*emptypb.Empty, error) OverwriteResponseContentType(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) CheckExternalPathEnum(context.Context, *pathenum.MessageWithPathEnum) (*emptypb.Empty, error) CheckExternalNestedPathEnum(context.Context, *pathenum.MessageWithNestedPathEnum) (*emptypb.Empty, error) CheckStatus(context.Context, *emptypb.Empty) (*CheckStatusResponse, error) Exists(context.Context, *ABitOfEverything) (*emptypb.Empty, error) CustomOptionsRequest(context.Context, *ABitOfEverything) (*emptypb.Empty, error) TraceRequest(context.Context, *ABitOfEverything) (*ABitOfEverything, error) PostOneofEnum(context.Context, *oneofenum.OneofEnumMessage) (*emptypb.Empty, error) PostRequiredMessageType(context.Context, *RequiredMessageTypeRequest) (*emptypb.Empty, error) } // UnimplementedABitOfEverythingServiceServer should be embedded to have forward compatible implementations. type UnimplementedABitOfEverythingServiceServer struct { } func (UnimplementedABitOfEverythingServiceServer) Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } func (UnimplementedABitOfEverythingServiceServer) CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateBody not implemented") } func (UnimplementedABitOfEverythingServiceServer) CreateBook(context.Context, *CreateBookRequest) (*Book, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateBook not implemented") } func (UnimplementedABitOfEverythingServiceServer) UpdateBook(context.Context, *UpdateBookRequest) (*Book, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateBook not implemented") } func (UnimplementedABitOfEverythingServiceServer) Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method Lookup not implemented") } func (UnimplementedABitOfEverythingServiceServer) Custom(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method Custom not implemented") } func (UnimplementedABitOfEverythingServiceServer) DoubleColon(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method DoubleColon not implemented") } func (UnimplementedABitOfEverythingServiceServer) Update(context.Context, *ABitOfEverything) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") } func (UnimplementedABitOfEverythingServiceServer) UpdateV2(context.Context, *UpdateV2Request) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateV2 not implemented") } func (UnimplementedABitOfEverythingServiceServer) Delete(context.Context, *sub2.IdMessage) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } func (UnimplementedABitOfEverythingServiceServer) GetQuery(context.Context, *ABitOfEverything) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method GetQuery not implemented") } func (UnimplementedABitOfEverythingServiceServer) GetRepeatedQuery(context.Context, *ABitOfEverythingRepeated) (*ABitOfEverythingRepeated, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRepeatedQuery not implemented") } func (UnimplementedABitOfEverythingServiceServer) Echo(context.Context, *sub.StringMessage) (*sub.StringMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } func (UnimplementedABitOfEverythingServiceServer) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method DeepPathEcho not implemented") } func (UnimplementedABitOfEverythingServiceServer) NoBindings(context.Context, *durationpb.Duration) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method NoBindings not implemented") } func (UnimplementedABitOfEverythingServiceServer) Timeout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Timeout not implemented") } func (UnimplementedABitOfEverythingServiceServer) ErrorWithDetails(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ErrorWithDetails not implemented") } func (UnimplementedABitOfEverythingServiceServer) GetMessageWithBody(context.Context, *MessageWithBody) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method GetMessageWithBody not implemented") } func (UnimplementedABitOfEverythingServiceServer) PostWithEmptyBody(context.Context, *Body) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method PostWithEmptyBody not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckGetQueryParams not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckNestedEnumGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckNestedEnumGetQueryParams not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckPostQueryParams not implemented") } func (UnimplementedABitOfEverythingServiceServer) OverwriteRequestContentType(context.Context, *Body) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method OverwriteRequestContentType not implemented") } func (UnimplementedABitOfEverythingServiceServer) OverwriteResponseContentType(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) { return nil, status.Errorf(codes.Unimplemented, "method OverwriteResponseContentType not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckExternalPathEnum(context.Context, *pathenum.MessageWithPathEnum) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckExternalPathEnum not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckExternalNestedPathEnum(context.Context, *pathenum.MessageWithNestedPathEnum) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckExternalNestedPathEnum not implemented") } func (UnimplementedABitOfEverythingServiceServer) CheckStatus(context.Context, *emptypb.Empty) (*CheckStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckStatus not implemented") } func (UnimplementedABitOfEverythingServiceServer) Exists(context.Context, *ABitOfEverything) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Exists not implemented") } func (UnimplementedABitOfEverythingServiceServer) CustomOptionsRequest(context.Context, *ABitOfEverything) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CustomOptionsRequest not implemented") } func (UnimplementedABitOfEverythingServiceServer) TraceRequest(context.Context, *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method TraceRequest not implemented") } func (UnimplementedABitOfEverythingServiceServer) PostOneofEnum(context.Context, *oneofenum.OneofEnumMessage) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method PostOneofEnum not implemented") } func (UnimplementedABitOfEverythingServiceServer) PostRequiredMessageType(context.Context, *RequiredMessageTypeRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method PostRequiredMessageType not implemented") } // UnsafeABitOfEverythingServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ABitOfEverythingServiceServer will // result in compilation errors. type UnsafeABitOfEverythingServiceServer interface { mustEmbedUnimplementedABitOfEverythingServiceServer() } func RegisterABitOfEverythingServiceServer(s grpc.ServiceRegistrar, srv ABitOfEverythingServiceServer) { s.RegisterService(&ABitOfEverythingService_ServiceDesc, srv) } func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Create(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CreateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateBookRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CreateBook(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CreateBook", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CreateBook(ctx, req.(*CreateBookRequest)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_UpdateBook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateBookRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).UpdateBook(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateBook", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).UpdateBook(ctx, req.(*UpdateBookRequest)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(sub2.IdMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Lookup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Custom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Custom(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Custom", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Custom(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_DoubleColon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).DoubleColon(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DoubleColon", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).DoubleColon(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Update(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_UpdateV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateV2Request) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).UpdateV2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/UpdateV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).UpdateV2(ctx, req.(*UpdateV2Request)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(sub2.IdMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_GetQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_GetRepeatedQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverythingRepeated) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).GetRepeatedQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetRepeatedQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetRepeatedQuery(ctx, req.(*ABitOfEverythingRepeated)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(sub.StringMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*sub.StringMessage)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/DeepPathEcho", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(durationpb.Duration) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/NoBindings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*durationpb.Duration)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Timeout(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Timeout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_ErrorWithDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).ErrorWithDetails(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/ErrorWithDetails", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).ErrorWithDetails(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_GetMessageWithBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MessageWithBody) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).GetMessageWithBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/GetMessageWithBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetMessageWithBody(ctx, req.(*MessageWithBody)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_PostWithEmptyBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Body) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).PostWithEmptyBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostWithEmptyBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).PostWithEmptyBody(ctx, req.(*Body)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckGetQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckGetQueryParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckGetQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckGetQueryParams(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckNestedEnumGetQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckNestedEnumGetQueryParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckNestedEnumGetQueryParams(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckPostQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckPostQueryParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckPostQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckPostQueryParams(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_OverwriteRequestContentType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Body) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).OverwriteRequestContentType(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteRequestContentType", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).OverwriteRequestContentType(ctx, req.(*Body)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_OverwriteResponseContentType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).OverwriteResponseContentType(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/OverwriteResponseContentType", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).OverwriteResponseContentType(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckExternalPathEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(pathenum.MessageWithPathEnum) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckExternalPathEnum(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalPathEnum", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckExternalPathEnum(ctx, req.(*pathenum.MessageWithPathEnum)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckExternalNestedPathEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(pathenum.MessageWithNestedPathEnum) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckExternalNestedPathEnum(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckExternalNestedPathEnum", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckExternalNestedPathEnum(ctx, req.(*pathenum.MessageWithNestedPathEnum)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CheckStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CheckStatus(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CheckStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckStatus(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_Exists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).Exists(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/Exists", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Exists(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_CustomOptionsRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).CustomOptionsRequest(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/CustomOptionsRequest", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CustomOptionsRequest(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_TraceRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).TraceRequest(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/TraceRequest", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).TraceRequest(ctx, req.(*ABitOfEverything)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_PostOneofEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(oneofenum.OneofEnumMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).PostOneofEnum(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostOneofEnum", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).PostOneofEnum(ctx, req.(*oneofenum.OneofEnumMessage)) } return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_PostRequiredMessageType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RequiredMessageTypeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ABitOfEverythingServiceServer).PostRequiredMessageType(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService/PostRequiredMessageType", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).PostRequiredMessageType(ctx, req.(*RequiredMessageTypeRequest)) } return interceptor(ctx, in, info, handler) } // ABitOfEverythingService_ServiceDesc is the grpc.ServiceDesc for ABitOfEverythingService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ABitOfEverythingService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _ABitOfEverythingService_Create_Handler, }, { MethodName: "CreateBody", Handler: _ABitOfEverythingService_CreateBody_Handler, }, { MethodName: "CreateBook", Handler: _ABitOfEverythingService_CreateBook_Handler, }, { MethodName: "UpdateBook", Handler: _ABitOfEverythingService_UpdateBook_Handler, }, { MethodName: "Lookup", Handler: _ABitOfEverythingService_Lookup_Handler, }, { MethodName: "Custom", Handler: _ABitOfEverythingService_Custom_Handler, }, { MethodName: "DoubleColon", Handler: _ABitOfEverythingService_DoubleColon_Handler, }, { MethodName: "Update", Handler: _ABitOfEverythingService_Update_Handler, }, { MethodName: "UpdateV2", Handler: _ABitOfEverythingService_UpdateV2_Handler, }, { MethodName: "Delete", Handler: _ABitOfEverythingService_Delete_Handler, }, { MethodName: "GetQuery", Handler: _ABitOfEverythingService_GetQuery_Handler, }, { MethodName: "GetRepeatedQuery", Handler: _ABitOfEverythingService_GetRepeatedQuery_Handler, }, { MethodName: "Echo", Handler: _ABitOfEverythingService_Echo_Handler, }, { MethodName: "DeepPathEcho", Handler: _ABitOfEverythingService_DeepPathEcho_Handler, }, { MethodName: "NoBindings", Handler: _ABitOfEverythingService_NoBindings_Handler, }, { MethodName: "Timeout", Handler: _ABitOfEverythingService_Timeout_Handler, }, { MethodName: "ErrorWithDetails", Handler: _ABitOfEverythingService_ErrorWithDetails_Handler, }, { MethodName: "GetMessageWithBody", Handler: _ABitOfEverythingService_GetMessageWithBody_Handler, }, { MethodName: "PostWithEmptyBody", Handler: _ABitOfEverythingService_PostWithEmptyBody_Handler, }, { MethodName: "CheckGetQueryParams", Handler: _ABitOfEverythingService_CheckGetQueryParams_Handler, }, { MethodName: "CheckNestedEnumGetQueryParams", Handler: _ABitOfEverythingService_CheckNestedEnumGetQueryParams_Handler, }, { MethodName: "CheckPostQueryParams", Handler: _ABitOfEverythingService_CheckPostQueryParams_Handler, }, { MethodName: "OverwriteRequestContentType", Handler: _ABitOfEverythingService_OverwriteRequestContentType_Handler, }, { MethodName: "OverwriteResponseContentType", Handler: _ABitOfEverythingService_OverwriteResponseContentType_Handler, }, { MethodName: "CheckExternalPathEnum", Handler: _ABitOfEverythingService_CheckExternalPathEnum_Handler, }, { MethodName: "CheckExternalNestedPathEnum", Handler: _ABitOfEverythingService_CheckExternalNestedPathEnum_Handler, }, { MethodName: "CheckStatus", Handler: _ABitOfEverythingService_CheckStatus_Handler, }, { MethodName: "Exists", Handler: _ABitOfEverythingService_Exists_Handler, }, { MethodName: "CustomOptionsRequest", Handler: _ABitOfEverythingService_CustomOptionsRequest_Handler, }, { MethodName: "TraceRequest", Handler: _ABitOfEverythingService_TraceRequest_Handler, }, { MethodName: "PostOneofEnum", Handler: _ABitOfEverythingService_PostOneofEnum_Handler, }, { MethodName: "PostRequiredMessageType", Handler: _ABitOfEverythingService_PostRequiredMessageType_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } // CamelCaseServiceNameClient is the client API for CamelCaseServiceName service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type CamelCaseServiceNameClient interface { Empty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) } type camelCaseServiceNameClient struct { cc grpc.ClientConnInterface } func NewCamelCaseServiceNameClient(cc grpc.ClientConnInterface) CamelCaseServiceNameClient { return &camelCaseServiceNameClient{cc} } func (c *camelCaseServiceNameClient) Empty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.camelCaseServiceName/Empty", in, out, opts...) if err != nil { return nil, err } return out, nil } // CamelCaseServiceNameServer is the server API for CamelCaseServiceName service. // All implementations should embed UnimplementedCamelCaseServiceNameServer // for forward compatibility type CamelCaseServiceNameServer interface { Empty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) } // UnimplementedCamelCaseServiceNameServer should be embedded to have forward compatible implementations. type UnimplementedCamelCaseServiceNameServer struct { } func (UnimplementedCamelCaseServiceNameServer) Empty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Empty not implemented") } // UnsafeCamelCaseServiceNameServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to CamelCaseServiceNameServer will // result in compilation errors. type UnsafeCamelCaseServiceNameServer interface { mustEmbedUnimplementedCamelCaseServiceNameServer() } func RegisterCamelCaseServiceNameServer(s grpc.ServiceRegistrar, srv CamelCaseServiceNameServer) { s.RegisterService(&CamelCaseServiceName_ServiceDesc, srv) } func _CamelCaseServiceName_Empty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(CamelCaseServiceNameServer).Empty(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.camelCaseServiceName/Empty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CamelCaseServiceNameServer).Empty(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } // CamelCaseServiceName_ServiceDesc is the grpc.ServiceDesc for CamelCaseServiceName service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var CamelCaseServiceName_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.camelCaseServiceName", HandlerType: (*CamelCaseServiceNameServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Empty", Handler: _CamelCaseServiceName_Empty_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } // AnotherServiceWithNoBindingsClient is the client API for AnotherServiceWithNoBindings service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AnotherServiceWithNoBindingsClient interface { NoBindings(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) } type anotherServiceWithNoBindingsClient struct { cc grpc.ClientConnInterface } func NewAnotherServiceWithNoBindingsClient(cc grpc.ClientConnInterface) AnotherServiceWithNoBindingsClient { return &anotherServiceWithNoBindingsClient{cc} } func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, opts...) if err != nil { return nil, err } return out, nil } // AnotherServiceWithNoBindingsServer is the server API for AnotherServiceWithNoBindings service. // All implementations should embed UnimplementedAnotherServiceWithNoBindingsServer // for forward compatibility type AnotherServiceWithNoBindingsServer interface { NoBindings(context.Context, *emptypb.Empty) (*emptypb.Empty, error) } // UnimplementedAnotherServiceWithNoBindingsServer should be embedded to have forward compatible implementations. type UnimplementedAnotherServiceWithNoBindingsServer struct { } func (UnimplementedAnotherServiceWithNoBindingsServer) NoBindings(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method NoBindings not implemented") } // UnsafeAnotherServiceWithNoBindingsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AnotherServiceWithNoBindingsServer will // result in compilation errors. type UnsafeAnotherServiceWithNoBindingsServer interface { mustEmbedUnimplementedAnotherServiceWithNoBindingsServer() } func RegisterAnotherServiceWithNoBindingsServer(s grpc.ServiceRegistrar, srv AnotherServiceWithNoBindingsServer) { s.RegisterService(&AnotherServiceWithNoBindings_ServiceDesc, srv) } func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.AnotherServiceWithNoBindings/NoBindings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } // AnotherServiceWithNoBindings_ServiceDesc is the grpc.ServiceDesc for AnotherServiceWithNoBindings service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var AnotherServiceWithNoBindings_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.AnotherServiceWithNoBindings", HandlerType: (*AnotherServiceWithNoBindingsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "NoBindings", Handler: _AnotherServiceWithNoBindings_NoBindings_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } // SnakeEnumServiceClient is the client API for SnakeEnumService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SnakeEnumServiceClient interface { SnakeEnum(ctx context.Context, in *SnakeEnumRequest, opts ...grpc.CallOption) (*SnakeEnumResponse, error) } type snakeEnumServiceClient struct { cc grpc.ClientConnInterface } func NewSnakeEnumServiceClient(cc grpc.ClientConnInterface) SnakeEnumServiceClient { return &snakeEnumServiceClient{cc} } func (c *snakeEnumServiceClient) SnakeEnum(ctx context.Context, in *SnakeEnumRequest, opts ...grpc.CallOption) (*SnakeEnumResponse, error) { out := new(SnakeEnumResponse) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService/SnakeEnum", in, out, opts...) if err != nil { return nil, err } return out, nil } // SnakeEnumServiceServer is the server API for SnakeEnumService service. // All implementations should embed UnimplementedSnakeEnumServiceServer // for forward compatibility type SnakeEnumServiceServer interface { SnakeEnum(context.Context, *SnakeEnumRequest) (*SnakeEnumResponse, error) } // UnimplementedSnakeEnumServiceServer should be embedded to have forward compatible implementations. type UnimplementedSnakeEnumServiceServer struct { } func (UnimplementedSnakeEnumServiceServer) SnakeEnum(context.Context, *SnakeEnumRequest) (*SnakeEnumResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SnakeEnum not implemented") } // UnsafeSnakeEnumServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SnakeEnumServiceServer will // result in compilation errors. type UnsafeSnakeEnumServiceServer interface { mustEmbedUnimplementedSnakeEnumServiceServer() } func RegisterSnakeEnumServiceServer(s grpc.ServiceRegistrar, srv SnakeEnumServiceServer) { s.RegisterService(&SnakeEnumService_ServiceDesc, srv) } func _SnakeEnumService_SnakeEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SnakeEnumRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(SnakeEnumServiceServer).SnakeEnum(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService/SnakeEnum", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(SnakeEnumServiceServer).SnakeEnum(ctx, req.(*SnakeEnumRequest)) } return interceptor(ctx, in, info, handler) } // SnakeEnumService_ServiceDesc is the grpc.ServiceDesc for SnakeEnumService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SnakeEnumService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.SnakeEnumService", HandlerType: (*SnakeEnumServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SnakeEnum", Handler: _SnakeEnumService_SnakeEnum_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } echo_service.pb.go000066400000000000000000001003711465037340600337460ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/echo_service.proto // Echo Service // // Echo Service API consists of a single service which returns // a message. package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" structpb "google.golang.org/protobuf/types/known/structpb" 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) ) // Embedded represents a message embedded in SimpleMessage. type Embedded struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Mark: // // *Embedded_Progress // *Embedded_Note Mark isEmbedded_Mark `protobuf_oneof:"mark"` } func (x *Embedded) Reset() { *x = Embedded{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Embedded) String() string { return protoimpl.X.MessageStringOf(x) } func (*Embedded) ProtoMessage() {} func (x *Embedded) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_echo_service_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 Embedded.ProtoReflect.Descriptor instead. func (*Embedded) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP(), []int{0} } func (m *Embedded) GetMark() isEmbedded_Mark { if m != nil { return m.Mark } return nil } func (x *Embedded) GetProgress() int64 { if x, ok := x.GetMark().(*Embedded_Progress); ok { return x.Progress } return 0 } func (x *Embedded) GetNote() string { if x, ok := x.GetMark().(*Embedded_Note); ok { return x.Note } return "" } type isEmbedded_Mark interface { isEmbedded_Mark() } type Embedded_Progress struct { Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` } type Embedded_Note struct { Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` } func (*Embedded_Progress) isEmbedded_Mark() {} func (*Embedded_Note) isEmbedded_Mark() {} type NestedMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields NId string `protobuf:"bytes,1,opt,name=n_id,json=nId,proto3" json:"n_id,omitempty"` Val string `protobuf:"bytes,2,opt,name=val,proto3" json:"val,omitempty"` } func (x *NestedMessage) Reset() { *x = NestedMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedMessage) ProtoMessage() {} func (x *NestedMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_echo_service_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 NestedMessage.ProtoReflect.Descriptor instead. func (*NestedMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP(), []int{1} } func (x *NestedMessage) GetNId() string { if x != nil { return x.NId } return "" } func (x *NestedMessage) GetVal() string { if x != nil { return x.Val } return "" } // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` // Types that are assignable to Code: // // *SimpleMessage_LineNum // *SimpleMessage_Lang Code isSimpleMessage_Code `protobuf_oneof:"code"` Status *Embedded `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` // Types that are assignable to Ext: // // *SimpleMessage_En // *SimpleMessage_No Ext isSimpleMessage_Ext `protobuf_oneof:"ext"` ResourceId string `protobuf:"bytes,8,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` NId *NestedMessage `protobuf:"bytes,9,opt,name=n_id,json=nId,proto3" json:"n_id,omitempty"` } func (x *SimpleMessage) Reset() { *x = SimpleMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SimpleMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*SimpleMessage) ProtoMessage() {} func (x *SimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_echo_service_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 SimpleMessage.ProtoReflect.Descriptor instead. func (*SimpleMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP(), []int{2} } func (x *SimpleMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *SimpleMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (m *SimpleMessage) GetCode() isSimpleMessage_Code { if m != nil { return m.Code } return nil } func (x *SimpleMessage) GetLineNum() int64 { if x, ok := x.GetCode().(*SimpleMessage_LineNum); ok { return x.LineNum } return 0 } func (x *SimpleMessage) GetLang() string { if x, ok := x.GetCode().(*SimpleMessage_Lang); ok { return x.Lang } return "" } func (x *SimpleMessage) GetStatus() *Embedded { if x != nil { return x.Status } return nil } func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { if m != nil { return m.Ext } return nil } func (x *SimpleMessage) GetEn() int64 { if x, ok := x.GetExt().(*SimpleMessage_En); ok { return x.En } return 0 } func (x *SimpleMessage) GetNo() *Embedded { if x, ok := x.GetExt().(*SimpleMessage_No); ok { return x.No } return nil } func (x *SimpleMessage) GetResourceId() string { if x != nil { return x.ResourceId } return "" } func (x *SimpleMessage) GetNId() *NestedMessage { if x != nil { return x.NId } return nil } type isSimpleMessage_Code interface { isSimpleMessage_Code() } type SimpleMessage_LineNum struct { LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"` } type SimpleMessage_Lang struct { Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"` } func (*SimpleMessage_LineNum) isSimpleMessage_Code() {} func (*SimpleMessage_Lang) isSimpleMessage_Code() {} type isSimpleMessage_Ext interface { isSimpleMessage_Ext() } type SimpleMessage_En struct { En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` } type SimpleMessage_No struct { No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` } func (*SimpleMessage_En) isSimpleMessage_Ext() {} func (*SimpleMessage_No) isSimpleMessage_Ext() {} // DynamicMessage represents a message which can have its structure // built dynamically using Struct and Values. type DynamicMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields StructField *structpb.Struct `protobuf:"bytes,1,opt,name=struct_field,json=structField,proto3" json:"struct_field,omitempty"` ValueField *structpb.Value `protobuf:"bytes,2,opt,name=value_field,json=valueField,proto3" json:"value_field,omitempty"` } func (x *DynamicMessage) Reset() { *x = DynamicMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *DynamicMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*DynamicMessage) ProtoMessage() {} func (x *DynamicMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_echo_service_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 DynamicMessage.ProtoReflect.Descriptor instead. func (*DynamicMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP(), []int{3} } func (x *DynamicMessage) GetStructField() *structpb.Struct { if x != nil { return x.StructField } return nil } func (x *DynamicMessage) GetValueField() *structpb.Value { if x != nil { return x.ValueField } return nil } type DynamicMessageUpdate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Body *DynamicMessage `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *DynamicMessageUpdate) Reset() { *x = DynamicMessageUpdate{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *DynamicMessageUpdate) String() string { return protoimpl.X.MessageStringOf(x) } func (*DynamicMessageUpdate) ProtoMessage() {} func (x *DynamicMessageUpdate) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_echo_service_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 DynamicMessageUpdate.ProtoReflect.Descriptor instead. func (*DynamicMessageUpdate) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP(), []int{4} } func (x *DynamicMessageUpdate) GetBody() *DynamicMessage { if x != nil { return x.Body } return nil } func (x *DynamicMessageUpdate) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } var File_examples_internal_proto_examplepb_echo_service_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_echo_service_proto_rawDesc = []byte{ 0x0a, 0x34, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x08, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x34, 0x0a, 0x0d, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6e, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x96, 0x03, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1b, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x50, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x02, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x02, 0x65, 0x6e, 0x12, 0x4a, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x48, 0x01, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x50, 0x0a, 0x04, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x03, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x65, 0x78, 0x74, 0x22, 0x85, 0x01, 0x0a, 0x0e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xa7, 0x01, 0x0a, 0x14, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x32, 0x95, 0x09, 0x0a, 0x0b, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8e, 0x03, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x87, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x80, 0x02, 0x5a, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x7b, 0x6e, 0x75, 0x6d, 0x7d, 0x5a, 0x24, 0x12, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x7b, 0x6e, 0x75, 0x6d, 0x7d, 0x2f, 0x7b, 0x6c, 0x61, 0x6e, 0x67, 0x7d, 0x5a, 0x31, 0x12, 0x2f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x7b, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x7d, 0x2f, 0x7b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x6e, 0x6f, 0x74, 0x65, 0x7d, 0x5a, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x32, 0x2f, 0x7b, 0x6e, 0x6f, 0x2e, 0x6e, 0x6f, 0x74, 0x65, 0x7d, 0x5a, 0x29, 0x12, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x5a, 0x25, 0x12, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x6e, 0x5f, 0x69, 0x64, 0x2e, 0x6e, 0x5f, 0x69, 0x64, 0x7d, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xcc, 0x01, 0x0a, 0x08, 0x45, 0x63, 0x68, 0x6f, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x42, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3c, 0x3a, 0x01, 0x2a, 0x5a, 0x20, 0x3a, 0x02, 0x6e, 0x6f, 0x1a, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x12, 0xab, 0x01, 0x0a, 0x0a, 0x45, 0x63, 0x68, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0xbd, 0x01, 0x0a, 0x09, 0x45, 0x63, 0x68, 0x6f, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x1a, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0xb7, 0x01, 0x0a, 0x10, 0x45, 0x63, 0x68, 0x6f, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_echo_service_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_echo_service_proto_rawDescData = file_examples_internal_proto_examplepb_echo_service_proto_rawDesc ) func file_examples_internal_proto_examplepb_echo_service_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_echo_service_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_echo_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_echo_service_proto_rawDescData) }) return file_examples_internal_proto_examplepb_echo_service_proto_rawDescData } var file_examples_internal_proto_examplepb_echo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_examples_internal_proto_examplepb_echo_service_proto_goTypes = []interface{}{ (*Embedded)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.Embedded (*NestedMessage)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.NestedMessage (*SimpleMessage)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.SimpleMessage (*DynamicMessage)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.DynamicMessage (*DynamicMessageUpdate)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.DynamicMessageUpdate (*structpb.Struct)(nil), // 5: google.protobuf.Struct (*structpb.Value)(nil), // 6: google.protobuf.Value (*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask } var file_examples_internal_proto_examplepb_echo_service_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.examplepb.SimpleMessage.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.Embedded 0, // 1: grpc.gateway.examples.internal.proto.examplepb.SimpleMessage.no:type_name -> grpc.gateway.examples.internal.proto.examplepb.Embedded 1, // 2: grpc.gateway.examples.internal.proto.examplepb.SimpleMessage.n_id:type_name -> grpc.gateway.examples.internal.proto.examplepb.NestedMessage 5, // 3: grpc.gateway.examples.internal.proto.examplepb.DynamicMessage.struct_field:type_name -> google.protobuf.Struct 6, // 4: grpc.gateway.examples.internal.proto.examplepb.DynamicMessage.value_field:type_name -> google.protobuf.Value 3, // 5: grpc.gateway.examples.internal.proto.examplepb.DynamicMessageUpdate.body:type_name -> grpc.gateway.examples.internal.proto.examplepb.DynamicMessage 7, // 6: grpc.gateway.examples.internal.proto.examplepb.DynamicMessageUpdate.update_mask:type_name -> google.protobuf.FieldMask 2, // 7: grpc.gateway.examples.internal.proto.examplepb.EchoService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 2, // 8: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 2, // 9: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoDelete:input_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 4, // 10: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoPatch:input_type -> grpc.gateway.examples.internal.proto.examplepb.DynamicMessageUpdate 2, // 11: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoUnauthorized:input_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 2, // 12: grpc.gateway.examples.internal.proto.examplepb.EchoService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 2, // 13: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoBody:output_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 2, // 14: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoDelete:output_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 4, // 15: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoPatch:output_type -> grpc.gateway.examples.internal.proto.examplepb.DynamicMessageUpdate 2, // 16: grpc.gateway.examples.internal.proto.examplepb.EchoService.EchoUnauthorized:output_type -> grpc.gateway.examples.internal.proto.examplepb.SimpleMessage 12, // [12:17] is the sub-list for method output_type 7, // [7:12] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name 7, // [7:7] is the sub-list for extension extendee 0, // [0:7] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_echo_service_proto_init() } func file_examples_internal_proto_examplepb_echo_service_proto_init() { if File_examples_internal_proto_examplepb_echo_service_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Embedded); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SimpleMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DynamicMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DynamicMessageUpdate); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[0].OneofWrappers = []interface{}{ (*Embedded_Progress)(nil), (*Embedded_Note)(nil), } file_examples_internal_proto_examplepb_echo_service_proto_msgTypes[2].OneofWrappers = []interface{}{ (*SimpleMessage_LineNum)(nil), (*SimpleMessage_Lang)(nil), (*SimpleMessage_En)(nil), (*SimpleMessage_No)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_echo_service_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_echo_service_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_echo_service_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_echo_service_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_echo_service_proto = out.File file_examples_internal_proto_examplepb_echo_service_proto_rawDesc = nil file_examples_internal_proto_examplepb_echo_service_proto_goTypes = nil file_examples_internal_proto_examplepb_echo_service_proto_depIdxs = nil } echo_service.pb.gw.go000066400000000000000000001761321465037340600343720ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/echo_service.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_EchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1, "lang": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}} ) func request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } val, ok = pathParams["lang"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang") } if protoReq.Code == nil { protoReq.Code = &SimpleMessage_Lang{} } else if _, ok := protoReq.Code.(*SimpleMessage_Lang); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_Lang, but: %t\n", protoReq.Code) } protoReq.Code.(*SimpleMessage_Lang).Lang, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } val, ok = pathParams["lang"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang") } if protoReq.Code == nil { protoReq.Code = &SimpleMessage_Lang{} } else if _, ok := protoReq.Code.(*SimpleMessage_Lang); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_Lang, but: %t\n", protoReq.Code) } protoReq.Code.(*SimpleMessage_Lang).Lang, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_3 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "line_num": 1, "status": 2, "note": 3}, Base: []int{1, 1, 2, 1, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 4, 2, 3, 5}} ) func request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["line_num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num") } if protoReq.Code == nil { protoReq.Code = &SimpleMessage_LineNum{} } else if _, ok := protoReq.Code.(*SimpleMessage_LineNum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_LineNum, but: %t\n", protoReq.Code) } protoReq.Code.(*SimpleMessage_LineNum).LineNum, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err) } val, ok = pathParams["status.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note") } err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["line_num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num") } if protoReq.Code == nil { protoReq.Code = &SimpleMessage_LineNum{} } else if _, ok := protoReq.Code.(*SimpleMessage_LineNum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_LineNum, but: %t\n", protoReq.Code) } protoReq.Code.(*SimpleMessage_LineNum).LineNum, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err) } val, ok = pathParams["status.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note") } err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_4 = &utilities.DoubleArray{Encoding: map[string]int{"no": 0, "note": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["no.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note") } err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["no.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note") } err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_5 = &utilities.DoubleArray{Encoding: map[string]int{"resource_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_EchoService_Echo_5(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["resource_id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource_id") } protoReq.ResourceId, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource_id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_5(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["resource_id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource_id") } protoReq.ResourceId, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource_id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_Echo_6 = &utilities.DoubleArray{Encoding: map[string]int{"n_id": 0}, Base: []int{1, 2, 2, 0}, Check: []int{0, 1, 2, 3}} ) func request_EchoService_Echo_6(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["n_id.n_id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "n_id.n_id") } err = runtime.PopulateFieldFromPath(&protoReq, "n_id.n_id", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "n_id.n_id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_Echo_6(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["n_id.n_id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "n_id.n_id") } err = runtime.PopulateFieldFromPath(&protoReq, "n_id.n_id", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "n_id.n_id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoBody(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_EchoBody_1 = &utilities.DoubleArray{Encoding: map[string]int{"no": 0, "id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_EchoService_EchoBody_1(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if protoReq.Ext == nil { protoReq.Ext = &SimpleMessage_No{} } else if _, ok := protoReq.Ext.(*SimpleMessage_No); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_No, but: %t\n", protoReq.Ext) } if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Ext.(*SimpleMessage_No).No); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoBody_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_EchoBody_1(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if protoReq.Ext == nil { protoReq.Ext = &SimpleMessage_No{} } else if _, ok := protoReq.Ext.(*SimpleMessage_No); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_No, but: %t\n", protoReq.Ext) } if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Ext.(*SimpleMessage_No).No); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoBody_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoBody(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoDelete(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_EchoPatch_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_EchoService_EchoPatch_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DynamicMessageUpdate var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoPatch_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoPatch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_EchoPatch_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DynamicMessageUpdate var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoPatch_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoPatch(ctx, &protoReq) return msg, metadata, err } var ( filter_EchoService_EchoUnauthorized_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_EchoService_EchoUnauthorized_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoUnauthorized_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoUnauthorized(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EchoService_EchoUnauthorized_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoUnauthorized_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoUnauthorized(ctx, &protoReq) return msg, metadata, err } // RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". // UnaryRPC :call EchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEchoServiceHandlerFromEndpoint instead. func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}/{lang}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo1/{id}/{line_num}/{status.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_3(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo2/{no.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_4(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/resource/{resource_id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_5(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/nested/{n_id.n_id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_Echo_6(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_EchoBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_EchoService_EchoBody_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_EchoBody_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoBody_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", runtime.WithHTTPPathPattern("/v1/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_EchoDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", runtime.WithHTTPPathPattern("/v1/example/echo_patch")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_EchoPatch_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoPatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_EchoUnauthorized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", runtime.WithHTTPPathPattern("/v1/example/echo_unauthorized")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EchoService_EchoUnauthorized_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoUnauthorized_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterEchoServiceHandler(ctx, mux, conn) } // RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterEchoServiceHandlerClient(ctx, mux, NewEchoServiceClient(conn)) } // RegisterEchoServiceHandlerClient registers the http handlers for service EchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "EchoServiceClient" to call the correct interceptors. func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}/{lang}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo1/{id}/{line_num}/{status.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_3(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo2/{no.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_4(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/resource/{resource_id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_5(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_Echo_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/nested/{n_id.n_id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_Echo_6(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_Echo_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_EchoBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PUT", pattern_EchoService_EchoBody_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_EchoBody_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoBody_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", runtime.WithHTTPPathPattern("/v1/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_EchoDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", runtime.WithHTTPPathPattern("/v1/example/echo_patch")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_EchoPatch_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoPatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_EchoService_EchoUnauthorized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", runtime.WithHTTPPathPattern("/v1/example/echo_unauthorized")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EchoService_EchoUnauthorized_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EchoService_EchoUnauthorized_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) pattern_EchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "")) pattern_EchoService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo", "id", "num", "lang"}, "")) pattern_EchoService_Echo_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo1", "id", "line_num", "status.note"}, "")) pattern_EchoService_Echo_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo2", "no.note"}, "")) pattern_EchoService_Echo_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "resource", "resource_id"}, "")) pattern_EchoService_Echo_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "nested", "n_id.n_id"}, "")) pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) pattern_EchoService_EchoBody_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo_body", "id"}, "")) pattern_EchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "")) pattern_EchoService_EchoPatch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_patch"}, "")) pattern_EchoService_EchoUnauthorized_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_unauthorized"}, "")) ) var ( forward_EchoService_Echo_0 = runtime.ForwardResponseMessage forward_EchoService_Echo_1 = runtime.ForwardResponseMessage forward_EchoService_Echo_2 = runtime.ForwardResponseMessage forward_EchoService_Echo_3 = runtime.ForwardResponseMessage forward_EchoService_Echo_4 = runtime.ForwardResponseMessage forward_EchoService_Echo_5 = runtime.ForwardResponseMessage forward_EchoService_Echo_6 = runtime.ForwardResponseMessage forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage forward_EchoService_EchoBody_1 = runtime.ForwardResponseMessage forward_EchoService_EchoDelete_0 = runtime.ForwardResponseMessage forward_EchoService_EchoPatch_0 = runtime.ForwardResponseMessage forward_EchoService_EchoUnauthorized_0 = runtime.ForwardResponseMessage ) echo_service.proto000066400000000000000000000061061465037340600341050ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Echo Service // // Echo Service API consists of a single service which returns // a message. package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // Embedded represents a message embedded in SimpleMessage. message Embedded { oneof mark { int64 progress = 1; string note = 2; } } message NestedMessage { string n_id = 1; string val = 2; } // SimpleMessage represents a simple message sent to the Echo service. message SimpleMessage { // Id represents the message identifier. string id = 1; int64 num = 2; oneof code { int64 line_num = 3; string lang = 4; } Embedded status = 5; oneof ext { int64 en = 6; Embedded no = 7; } string resource_id = 8; NestedMessage n_id = 9; } // DynamicMessage represents a message which can have its structure // built dynamically using Struct and Values. message DynamicMessage { google.protobuf.Struct struct_field = 1; google.protobuf.Value value_field = 2; } message DynamicMessageUpdate { DynamicMessage body = 1; google.protobuf.FieldMask update_mask = 2; } // Echo service responds to incoming echo requests. service EchoService { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. rpc Echo(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { post: "/v1/example/echo/{id}" additional_bindings {get: "/v1/example/echo/{id}/{num}"} additional_bindings {get: "/v1/example/echo/{id}/{num}/{lang}"} additional_bindings {get: "/v1/example/echo1/{id}/{line_num}/{status.note}"} additional_bindings {get: "/v1/example/echo2/{no.note}"} additional_bindings {get: "/v1/example/echo/resource/{resource_id}"} additional_bindings {get: "/v1/example/echo/nested/{n_id.n_id}"} }; } // EchoBody method receives a simple message and returns it. rpc EchoBody(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { post: "/v1/example/echo_body" body: "*" additional_bindings { put: "/v1/example/echo_body/{id}" body: "no" } }; } // EchoDelete method receives a simple message and returns it. rpc EchoDelete(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = {delete: "/v1/example/echo_delete"}; } // EchoPatch method receives a NonStandardUpdateRequest and returns it. rpc EchoPatch(DynamicMessageUpdate) returns (DynamicMessageUpdate) { option (google.api.http) = { patch: "/v1/example/echo_patch" body: "body" }; } // EchoUnauthorized method receives a simple message and returns it. It must // always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code // of 401. rpc EchoUnauthorized(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = {get: "/v1/example/echo_unauthorized"}; } } echo_service.swagger.json000066400000000000000000001063641465037340600353600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "Echo Service", "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, "tags": [ { "name": "EchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/nested/{nId.nId}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo7", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "nId.nId", "in": "path", "required": true, "type": "string" }, { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo/resource/{resourceId}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo6", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "resourceId", "in": "path", "required": true, "type": "string" }, { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo/{id}/{num}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo/{id}/{num}/{lang}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo3", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "lang", "in": "path", "required": true, "type": "string" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo1/{id}/{lineNum}/{status.note}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo4", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "lineNum", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "status.note", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo2/{no.note}": { "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "EchoService_Echo5", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "no.note", "in": "path", "required": true, "type": "string" }, { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo_body": { "post": { "summary": "EchoBody method receives a simple message and returns it.", "operationId": "EchoService_EchoBody", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "SimpleMessage represents a simple message sent to the Echo service.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } } ], "tags": [ "EchoService" ] } }, "/v1/example/echo_body/{id}": { "put": { "summary": "EchoBody method receives a simple message and returns it.", "operationId": "EchoService_EchoBody2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "no", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbEmbedded" } }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo_delete": { "delete": { "summary": "EchoDelete method receives a simple message and returns it.", "operationId": "EchoService_EchoDelete", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } }, "/v1/example/echo_patch": { "patch": { "summary": "EchoPatch method receives a NonStandardUpdateRequest and returns it.", "operationId": "EchoService_EchoPatch", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbDynamicMessageUpdate" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbDynamicMessage" } } ], "tags": [ "EchoService" ] } }, "/v1/example/echo_unauthorized": { "get": { "summary": "EchoUnauthorized method receives a simple message and returns it. It must\nalways return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code\nof 401.", "operationId": "EchoService_EchoUnauthorized", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "EchoService" ] } } }, "definitions": { "examplepbDynamicMessage": { "type": "object", "properties": { "structField": { "type": "object" }, "valueField": {} }, "description": "DynamicMessage represents a message which can have its structure\nbuilt dynamically using Struct and Values." }, "examplepbDynamicMessageUpdate": { "type": "object", "properties": { "body": { "$ref": "#/definitions/examplepbDynamicMessage" }, "updateMask": { "type": "string" } } }, "examplepbEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbNestedMessage": { "type": "object", "properties": { "nId": { "type": "string" }, "val": { "type": "string" } } }, "examplepbSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbEmbedded" }, "resourceId": { "type": "string" }, "nId": { "$ref": "#/definitions/examplepbNestedMessage" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "protobufNullValue": { "type": "string", "enum": [ "NULL_VALUE" ], "default": "NULL_VALUE", "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } echo_service_grpc.pb.go000066400000000000000000000245461465037340600347720ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/echo_service.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // EchoServiceClient is the client API for EchoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type EchoServiceClient interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) // EchoPatch method receives a NonStandardUpdateRequest and returns it. EchoPatch(ctx context.Context, in *DynamicMessageUpdate, opts ...grpc.CallOption) (*DynamicMessageUpdate, error) // EchoUnauthorized method receives a simple message and returns it. It must // always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code // of 401. EchoUnauthorized(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) } type echoServiceClient struct { cc grpc.ClientConnInterface } func NewEchoServiceClient(cc grpc.ClientConnInterface) EchoServiceClient { return &echoServiceClient{cc} } func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *echoServiceClient) EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *echoServiceClient) EchoPatch(ctx context.Context, in *DynamicMessageUpdate, opts ...grpc.CallOption) (*DynamicMessageUpdate, error) { out := new(DynamicMessageUpdate) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *echoServiceClient) EchoUnauthorized(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", in, out, opts...) if err != nil { return nil, err } return out, nil } // EchoServiceServer is the server API for EchoService service. // All implementations should embed UnimplementedEchoServiceServer // for forward compatibility type EchoServiceServer interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error) // EchoPatch method receives a NonStandardUpdateRequest and returns it. EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error) // EchoUnauthorized method receives a simple message and returns it. It must // always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code // of 401. EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error) } // UnimplementedEchoServiceServer should be embedded to have forward compatible implementations. type UnimplementedEchoServiceServer struct { } func (UnimplementedEchoServiceServer) Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } func (UnimplementedEchoServiceServer) EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") } func (UnimplementedEchoServiceServer) EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") } func (UnimplementedEchoServiceServer) EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoPatch not implemented") } func (UnimplementedEchoServiceServer) EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoUnauthorized not implemented") } // UnsafeEchoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to EchoServiceServer will // result in compilation errors. type UnsafeEchoServiceServer interface { mustEmbedUnimplementedEchoServiceServer() } func RegisterEchoServiceServer(s grpc.ServiceRegistrar, srv EchoServiceServer) { s.RegisterService(&EchoService_ServiceDesc, srv) } func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EchoServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) } return interceptor(ctx, in, info, handler) } func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EchoServiceServer).EchoBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) } return interceptor(ctx, in, info, handler) } func _EchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EchoServiceServer).EchoDelete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoDelete(ctx, req.(*SimpleMessage)) } return interceptor(ctx, in, info, handler) } func _EchoService_EchoPatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DynamicMessageUpdate) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EchoServiceServer).EchoPatch(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoPatch(ctx, req.(*DynamicMessageUpdate)) } return interceptor(ctx, in, info, handler) } func _EchoService_EchoUnauthorized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EchoServiceServer).EchoUnauthorized(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoUnauthorized(ctx, req.(*SimpleMessage)) } return interceptor(ctx, in, info, handler) } // EchoService_ServiceDesc is the grpc.ServiceDesc for EchoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var EchoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.EchoService", HandlerType: (*EchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _EchoService_Echo_Handler, }, { MethodName: "EchoBody", Handler: _EchoService_EchoBody_Handler, }, { MethodName: "EchoDelete", Handler: _EchoService_EchoDelete_Handler, }, { MethodName: "EchoPatch", Handler: _EchoService_EchoPatch_Handler, }, { MethodName: "EchoUnauthorized", Handler: _EchoService_EchoUnauthorized_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/echo_service.proto", } enum_with_single_value.buf.gen.yaml000066400000000000000000000001421465037340600373170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - omit_enum_default_value=true enum_with_single_value.pb.go000066400000000000000000000335351465037340600360530ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/enum_with_single_value.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // EnumWithSingleValue is an enum with a single value. Since it has just a single value // the `enum` field should be omitted in the generated OpenAPI spec for the type when // the omit_enum_default_value option is set to true. type EnumWithSingleValue int32 const ( EnumWithSingleValue_ENUM_WITH_SINGLE_VALUE_UNSPECIFIED EnumWithSingleValue = 0 ) // Enum value maps for EnumWithSingleValue. var ( EnumWithSingleValue_name = map[int32]string{ 0: "ENUM_WITH_SINGLE_VALUE_UNSPECIFIED", } EnumWithSingleValue_value = map[string]int32{ "ENUM_WITH_SINGLE_VALUE_UNSPECIFIED": 0, } ) func (x EnumWithSingleValue) Enum() *EnumWithSingleValue { p := new(EnumWithSingleValue) *p = x return p } func (x EnumWithSingleValue) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (EnumWithSingleValue) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_enum_with_single_value_proto_enumTypes[0].Descriptor() } func (EnumWithSingleValue) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_enum_with_single_value_proto_enumTypes[0] } func (x EnumWithSingleValue) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use EnumWithSingleValue.Descriptor instead. func (EnumWithSingleValue) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescGZIP(), []int{0} } type EnumWithSingleValueServiceEchoRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Value EnumWithSingleValue `protobuf:"varint,1,opt,name=value,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValue" json:"value,omitempty"` } func (x *EnumWithSingleValueServiceEchoRequest) Reset() { *x = EnumWithSingleValueServiceEchoRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EnumWithSingleValueServiceEchoRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*EnumWithSingleValueServiceEchoRequest) ProtoMessage() {} func (x *EnumWithSingleValueServiceEchoRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_enum_with_single_value_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 EnumWithSingleValueServiceEchoRequest.ProtoReflect.Descriptor instead. func (*EnumWithSingleValueServiceEchoRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescGZIP(), []int{0} } func (x *EnumWithSingleValueServiceEchoRequest) GetValue() EnumWithSingleValue { if x != nil { return x.Value } return EnumWithSingleValue_ENUM_WITH_SINGLE_VALUE_UNSPECIFIED } type EnumWithSingleValueServiceEchoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *EnumWithSingleValueServiceEchoResponse) Reset() { *x = EnumWithSingleValueServiceEchoResponse{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EnumWithSingleValueServiceEchoResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*EnumWithSingleValueServiceEchoResponse) ProtoMessage() {} func (x *EnumWithSingleValueServiceEchoResponse) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_enum_with_single_value_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 EnumWithSingleValueServiceEchoResponse.ProtoReflect.Descriptor instead. func (*EnumWithSingleValueServiceEchoResponse) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescGZIP(), []int{1} } var File_examples_internal_proto_examplepb_enum_with_single_value_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDesc = []byte{ 0x0a, 0x3e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, 0x01, 0x0a, 0x25, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x28, 0x0a, 0x26, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x3d, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x53, 0x49, 0x4e, 0x47, 0x4c, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x32, 0x88, 0x02, 0x0a, 0x1a, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xe9, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x55, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x56, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x3a, 0x01, 0x2a, 0x22, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x2d, 0x77, 0x69, 0x74, 0x68, 0x2d, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x2d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescData = file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDesc ) func file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescData) }) return file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDescData } var file_examples_internal_proto_examplepb_enum_with_single_value_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_examples_internal_proto_examplepb_enum_with_single_value_proto_goTypes = []interface{}{ (EnumWithSingleValue)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValue (*EnumWithSingleValueServiceEchoRequest)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueServiceEchoRequest (*EnumWithSingleValueServiceEchoResponse)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueServiceEchoResponse } var file_examples_internal_proto_examplepb_enum_with_single_value_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueServiceEchoRequest.value:type_name -> grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValue 1, // 1: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueServiceEchoRequest 2, // 2: grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueServiceEchoResponse 2, // [2:3] is the sub-list for method output_type 1, // [1:2] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_enum_with_single_value_proto_init() } func file_examples_internal_proto_examplepb_enum_with_single_value_proto_init() { if File_examples_internal_proto_examplepb_enum_with_single_value_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EnumWithSingleValueServiceEchoRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EnumWithSingleValueServiceEchoResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDesc, NumEnums: 1, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_enum_with_single_value_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_enum_with_single_value_proto_depIdxs, EnumInfos: file_examples_internal_proto_examplepb_enum_with_single_value_proto_enumTypes, MessageInfos: file_examples_internal_proto_examplepb_enum_with_single_value_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_enum_with_single_value_proto = out.File file_examples_internal_proto_examplepb_enum_with_single_value_proto_rawDesc = nil file_examples_internal_proto_examplepb_enum_with_single_value_proto_goTypes = nil file_examples_internal_proto_examplepb_enum_with_single_value_proto_depIdxs = nil } enum_with_single_value.pb.gw.go000066400000000000000000000162001465037340600364550ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/enum_with_single_value.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_EnumWithSingleValueService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EnumWithSingleValueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EnumWithSingleValueServiceEchoRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_EnumWithSingleValueService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server EnumWithSingleValueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EnumWithSingleValueServiceEchoRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } // RegisterEnumWithSingleValueServiceHandlerServer registers the http handlers for service EnumWithSingleValueService to "mux". // UnaryRPC :call EnumWithSingleValueServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEnumWithSingleValueServiceHandlerFromEndpoint instead. func RegisterEnumWithSingleValueServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EnumWithSingleValueServiceServer) error { mux.Handle("POST", pattern_EnumWithSingleValueService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService/Echo", runtime.WithHTTPPathPattern("/v1/example/enum-with-single-value/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_EnumWithSingleValueService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EnumWithSingleValueService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterEnumWithSingleValueServiceHandlerFromEndpoint is same as RegisterEnumWithSingleValueServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterEnumWithSingleValueServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterEnumWithSingleValueServiceHandler(ctx, mux, conn) } // RegisterEnumWithSingleValueServiceHandler registers the http handlers for service EnumWithSingleValueService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterEnumWithSingleValueServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterEnumWithSingleValueServiceHandlerClient(ctx, mux, NewEnumWithSingleValueServiceClient(conn)) } // RegisterEnumWithSingleValueServiceHandlerClient registers the http handlers for service EnumWithSingleValueService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EnumWithSingleValueServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EnumWithSingleValueServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "EnumWithSingleValueServiceClient" to call the correct interceptors. func RegisterEnumWithSingleValueServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EnumWithSingleValueServiceClient) error { mux.Handle("POST", pattern_EnumWithSingleValueService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService/Echo", runtime.WithHTTPPathPattern("/v1/example/enum-with-single-value/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_EnumWithSingleValueService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_EnumWithSingleValueService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_EnumWithSingleValueService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "enum-with-single-value", "echo"}, "")) ) var ( forward_EnumWithSingleValueService_Echo_0 = runtime.ForwardResponseMessage ) enum_with_single_value.proto000066400000000000000000000016121465037340600362000ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; service EnumWithSingleValueService { rpc Echo(EnumWithSingleValueServiceEchoRequest) returns (EnumWithSingleValueServiceEchoResponse) { option (google.api.http) = { post: "/v1/example/enum-with-single-value/echo" body: "*" }; } } // EnumWithSingleValue is an enum with a single value. Since it has just a single value // the `enum` field should be omitted in the generated OpenAPI spec for the type when // the omit_enum_default_value option is set to true. enum EnumWithSingleValue { ENUM_WITH_SINGLE_VALUE_UNSPECIFIED = 0; } message EnumWithSingleValueServiceEchoRequest { EnumWithSingleValue value = 1; } message EnumWithSingleValueServiceEchoResponse {} enum_with_single_value.swagger.json000066400000000000000000000045661465037340600374570ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/enum_with_single_value.proto", "version": "version not set" }, "tags": [ { "name": "EnumWithSingleValueService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/enum-with-single-value/echo": { "post": { "operationId": "EnumWithSingleValueService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEnumWithSingleValueServiceEchoResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbEnumWithSingleValueServiceEchoRequest" } } ], "tags": [ "EnumWithSingleValueService" ] } } }, "definitions": { "examplepbEnumWithSingleValue": { "type": "string", "description": "EnumWithSingleValue is an enum with a single value. Since it has just a single value\nthe `enum` field should be omitted in the generated OpenAPI spec for the type when\nthe omit_enum_default_value option is set to true." }, "examplepbEnumWithSingleValueServiceEchoRequest": { "type": "object", "properties": { "value": { "$ref": "#/definitions/examplepbEnumWithSingleValue" } } }, "examplepbEnumWithSingleValueServiceEchoResponse": { "type": "object" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } enum_with_single_value_grpc.pb.go000066400000000000000000000105471465037340600370640ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/enum_with_single_value.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // EnumWithSingleValueServiceClient is the client API for EnumWithSingleValueService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type EnumWithSingleValueServiceClient interface { Echo(ctx context.Context, in *EnumWithSingleValueServiceEchoRequest, opts ...grpc.CallOption) (*EnumWithSingleValueServiceEchoResponse, error) } type enumWithSingleValueServiceClient struct { cc grpc.ClientConnInterface } func NewEnumWithSingleValueServiceClient(cc grpc.ClientConnInterface) EnumWithSingleValueServiceClient { return &enumWithSingleValueServiceClient{cc} } func (c *enumWithSingleValueServiceClient) Echo(ctx context.Context, in *EnumWithSingleValueServiceEchoRequest, opts ...grpc.CallOption) (*EnumWithSingleValueServiceEchoResponse, error) { out := new(EnumWithSingleValueServiceEchoResponse) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } // EnumWithSingleValueServiceServer is the server API for EnumWithSingleValueService service. // All implementations should embed UnimplementedEnumWithSingleValueServiceServer // for forward compatibility type EnumWithSingleValueServiceServer interface { Echo(context.Context, *EnumWithSingleValueServiceEchoRequest) (*EnumWithSingleValueServiceEchoResponse, error) } // UnimplementedEnumWithSingleValueServiceServer should be embedded to have forward compatible implementations. type UnimplementedEnumWithSingleValueServiceServer struct { } func (UnimplementedEnumWithSingleValueServiceServer) Echo(context.Context, *EnumWithSingleValueServiceEchoRequest) (*EnumWithSingleValueServiceEchoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } // UnsafeEnumWithSingleValueServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to EnumWithSingleValueServiceServer will // result in compilation errors. type UnsafeEnumWithSingleValueServiceServer interface { mustEmbedUnimplementedEnumWithSingleValueServiceServer() } func RegisterEnumWithSingleValueServiceServer(s grpc.ServiceRegistrar, srv EnumWithSingleValueServiceServer) { s.RegisterService(&EnumWithSingleValueService_ServiceDesc, srv) } func _EnumWithSingleValueService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EnumWithSingleValueServiceEchoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(EnumWithSingleValueServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnumWithSingleValueServiceServer).Echo(ctx, req.(*EnumWithSingleValueServiceEchoRequest)) } return interceptor(ctx, in, info, handler) } // EnumWithSingleValueService_ServiceDesc is the grpc.ServiceDesc for EnumWithSingleValueService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var EnumWithSingleValueService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.EnumWithSingleValueService", HandlerType: (*EnumWithSingleValueServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _EnumWithSingleValueService_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/enum_with_single_value.proto", } flow_combination.pb.go000066400000000000000000001000771465037340600346440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/flow_combination.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 EmptyProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *EmptyProto) Reset() { *x = EmptyProto{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EmptyProto) String() string { return protoimpl.X.MessageStringOf(x) } func (*EmptyProto) ProtoMessage() {} func (x *EmptyProto) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_flow_combination_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 EmptyProto.ProtoReflect.Descriptor instead. func (*EmptyProto) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{0} } type NonEmptyProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` } func (x *NonEmptyProto) Reset() { *x = NonEmptyProto{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonEmptyProto) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonEmptyProto) ProtoMessage() {} func (x *NonEmptyProto) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_flow_combination_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 NonEmptyProto.ProtoReflect.Descriptor instead. func (*NonEmptyProto) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{1} } func (x *NonEmptyProto) GetA() string { if x != nil { return x.A } return "" } func (x *NonEmptyProto) GetB() string { if x != nil { return x.B } return "" } func (x *NonEmptyProto) GetC() string { if x != nil { return x.C } return "" } type UnaryProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Str string `protobuf:"bytes,1,opt,name=str,proto3" json:"str,omitempty"` } func (x *UnaryProto) Reset() { *x = UnaryProto{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UnaryProto) String() string { return protoimpl.X.MessageStringOf(x) } func (*UnaryProto) ProtoMessage() {} func (x *UnaryProto) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_flow_combination_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 UnaryProto.ProtoReflect.Descriptor instead. func (*UnaryProto) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{2} } func (x *UnaryProto) GetStr() string { if x != nil { return x.Str } return "" } type NestedProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` } func (x *NestedProto) Reset() { *x = NestedProto{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedProto) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedProto) ProtoMessage() {} func (x *NestedProto) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_flow_combination_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 NestedProto.ProtoReflect.Descriptor instead. func (*NestedProto) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{3} } func (x *NestedProto) GetA() *UnaryProto { if x != nil { return x.A } return nil } func (x *NestedProto) GetB() string { if x != nil { return x.B } return "" } func (x *NestedProto) GetC() string { if x != nil { return x.C } return "" } type SingleNestedProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` } func (x *SingleNestedProto) Reset() { *x = SingleNestedProto{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SingleNestedProto) String() string { return protoimpl.X.MessageStringOf(x) } func (*SingleNestedProto) ProtoMessage() {} func (x *SingleNestedProto) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_flow_combination_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 SingleNestedProto.ProtoReflect.Descriptor instead. func (*SingleNestedProto) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{4} } func (x *SingleNestedProto) GetA() *UnaryProto { if x != nil { return x.A } return nil } var File_examples_internal_proto_examplepb_flow_combination_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_flow_combination_proto_rawDesc = []byte{ 0x0a, 0x38, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0c, 0x0a, 0x0a, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0d, 0x4e, 0x6f, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x62, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x63, 0x22, 0x1e, 0x0a, 0x0a, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x22, 0x73, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x48, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x01, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x62, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x63, 0x22, 0x5d, 0x0a, 0x11, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x48, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x01, 0x61, 0x32, 0xfd, 0x11, 0x0a, 0x0f, 0x46, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x9d, 0x01, 0x0a, 0x0b, 0x52, 0x70, 0x63, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x70, 0x63, 0x12, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, 0x0e, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x12, 0xa5, 0x01, 0x0a, 0x0e, 0x52, 0x70, 0x63, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x30, 0x01, 0x12, 0xa5, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x70, 0x63, 0x12, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x28, 0x01, 0x12, 0xad, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x14, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x28, 0x01, 0x30, 0x01, 0x12, 0xcb, 0x02, 0x0a, 0x0a, 0x52, 0x70, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x70, 0x63, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xba, 0x01, 0x3a, 0x01, 0x2a, 0x5a, 0x1b, 0x22, 0x19, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x7b, 0x63, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x10, 0x22, 0x0e, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x1f, 0x3a, 0x01, 0x63, 0x22, 0x1a, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x18, 0x3a, 0x01, 0x63, 0x22, 0x13, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x21, 0x3a, 0x01, 0x63, 0x22, 0x1c, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x19, 0x22, 0x17, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x22, 0x0d, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x12, 0xbd, 0x01, 0x0a, 0x16, 0x52, 0x70, 0x63, 0x50, 0x61, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x70, 0x63, 0x12, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x1c, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x12, 0xfd, 0x01, 0x0a, 0x10, 0x52, 0x70, 0x63, 0x50, 0x61, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x70, 0x63, 0x12, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x6a, 0x3a, 0x01, 0x63, 0x5a, 0x1f, 0x22, 0x1d, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x31, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x5a, 0x22, 0x3a, 0x01, 0x63, 0x22, 0x1d, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x32, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x22, 0x20, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x72, 0x70, 0x63, 0x12, 0xe5, 0x02, 0x0a, 0x0d, 0x52, 0x70, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xcf, 0x01, 0x3a, 0x01, 0x2a, 0x5a, 0x1e, 0x22, 0x1c, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x7b, 0x63, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x13, 0x22, 0x11, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x22, 0x3a, 0x01, 0x63, 0x22, 0x1d, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x1b, 0x3a, 0x01, 0x63, 0x22, 0x16, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x24, 0x3a, 0x01, 0x63, 0x22, 0x1f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x1c, 0x22, 0x1a, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x10, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x30, 0x01, 0x12, 0xc5, 0x01, 0x0a, 0x19, 0x52, 0x70, 0x63, 0x50, 0x61, 0x74, 0x68, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x30, 0x01, 0x12, 0x8b, 0x02, 0x0a, 0x13, 0x52, 0x70, 0x63, 0x50, 0x61, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x79, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x73, 0x3a, 0x01, 0x63, 0x5a, 0x22, 0x22, 0x20, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x31, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5a, 0x25, 0x3a, 0x01, 0x63, 0x22, 0x20, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x32, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x23, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x7d, 0x2f, 0x7b, 0x62, 0x7d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x30, 0x01, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_flow_combination_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_flow_combination_proto_rawDescData = file_examples_internal_proto_examplepb_flow_combination_proto_rawDesc ) func file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_flow_combination_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_flow_combination_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_flow_combination_proto_rawDescData) }) return file_examples_internal_proto_examplepb_flow_combination_proto_rawDescData } var file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_examples_internal_proto_examplepb_flow_combination_proto_goTypes = []interface{}{ (*EmptyProto)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.EmptyProto (*NonEmptyProto)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.NonEmptyProto (*UnaryProto)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.UnaryProto (*NestedProto)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.NestedProto (*SingleNestedProto)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.SingleNestedProto } var file_examples_internal_proto_examplepb_flow_combination_proto_depIdxs = []int32{ 2, // 0: grpc.gateway.examples.internal.proto.examplepb.NestedProto.a:type_name -> grpc.gateway.examples.internal.proto.examplepb.UnaryProto 2, // 1: grpc.gateway.examples.internal.proto.examplepb.SingleNestedProto.a:type_name -> grpc.gateway.examples.internal.proto.examplepb.UnaryProto 0, // 2: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcEmptyRpc:input_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 3: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcEmptyStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 4: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.StreamEmptyRpc:input_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 5: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.StreamEmptyStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 1, // 6: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcBodyRpc:input_type -> grpc.gateway.examples.internal.proto.examplepb.NonEmptyProto 4, // 7: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathSingleNestedRpc:input_type -> grpc.gateway.examples.internal.proto.examplepb.SingleNestedProto 3, // 8: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathNestedRpc:input_type -> grpc.gateway.examples.internal.proto.examplepb.NestedProto 1, // 9: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcBodyStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.NonEmptyProto 4, // 10: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathSingleNestedStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.SingleNestedProto 3, // 11: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathNestedStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.NestedProto 0, // 12: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcEmptyRpc:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 13: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcEmptyStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 14: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.StreamEmptyRpc:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 15: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.StreamEmptyStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 16: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcBodyRpc:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 17: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathSingleNestedRpc:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 18: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathNestedRpc:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 19: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcBodyStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 20: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathSingleNestedStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 0, // 21: grpc.gateway.examples.internal.proto.examplepb.FlowCombination.RpcPathNestedStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.EmptyProto 12, // [12:22] is the sub-list for method output_type 2, // [2:12] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_flow_combination_proto_init() } func file_examples_internal_proto_examplepb_flow_combination_proto_init() { if File_examples_internal_proto_examplepb_flow_combination_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EmptyProto); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonEmptyProto); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UnaryProto); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedProto); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SingleNestedProto); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_flow_combination_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_flow_combination_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_flow_combination_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_flow_combination_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_flow_combination_proto = out.File file_examples_internal_proto_examplepb_flow_combination_proto_rawDesc = nil file_examples_internal_proto_examplepb_flow_combination_proto_goTypes = nil file_examples_internal_proto_examplepb_flow_combination_proto_depIdxs = nil } flow_combination.pb.gw.go000066400000000000000000003153101465037340600352560ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/flow_combination.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata msg, err := client.RpcEmptyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata msg, err := server.RpcEmptyRpc(ctx, &protoReq) return msg, metadata, err } func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcEmptyStreamClient, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata stream, err := client.RpcEmptyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyRpc(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) for { var protoReq EmptyProto err = dec.Decode(&protoReq) if err == io.EOF { break } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { if err == io.EOF { break } grpclog.Errorf("Failed to send request: %v", err) return nil, metadata, err } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) return nil, metadata, err } header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header msg, err := stream.CloseAndRecv() metadata.TrailerMD = stream.Trailer() return msg, metadata, err } func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyStream(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq EmptyProto err := dec.Decode(&protoReq) if err == io.EOF { return err } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return err } if err := stream.Send(&protoReq); err != nil { grpclog.Errorf("Failed to send request: %v", err) return err } return nil } go func() { for { if err := handleSend(); err != nil { break } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) } }() header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } val, ok = pathParams["c"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") } protoReq.C, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } val, ok = pathParams["c"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") } protoReq.C, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcBodyRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcBodyRpc_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcBodyRpc_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcBodyRpc_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcPathSingleNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SingleNestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathSingleNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SingleNestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcPathSingleNestedRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcPathNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcPathNestedRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcPathNestedRpc_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcPathNestedRpc(ctx, &protoReq) return msg, metadata, err } var ( filter_FlowCombination_RpcPathNestedRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.RpcPathNestedRpc(ctx, &protoReq) return msg, metadata, err } func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } val, ok = pathParams["c"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") } protoReq.C, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcBodyStream_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcBodyStream_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcBodyStream_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcBodyStream_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcPathSingleNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathSingleNestedStreamClient, runtime.ServerMetadata, error) { var protoReq SingleNestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathSingleNestedStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcPathNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } val, ok = pathParams["b"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcPathNestedStream_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_FlowCombination_RpcPathNestedStream_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( val string ok bool err error _ = err ) val, ok = pathParams["a.str"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } // RegisterFlowCombinationHandlerServer registers the http handlers for service FlowCombination to "mux". // UnaryRPC :call FlowCombinationServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFlowCombinationHandlerFromEndpoint instead. func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyRpc", runtime.WithHTTPPathPattern("/rpc/empty/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcEmptyRpc_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcEmptyRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/path/{a}/{b}/{c}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/{b}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_3(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_4(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_5(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/path/{a}/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcBodyRpc_6(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcPathSingleNestedRpc_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathSingleNestedRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/{b}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested1/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested2/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) return nil } // RegisterFlowCombinationHandlerFromEndpoint is same as RegisterFlowCombinationHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterFlowCombinationHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterFlowCombinationHandler(ctx, mux, conn) } // RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterFlowCombinationHandlerClient(ctx, mux, NewFlowCombinationClient(conn)) } // RegisterFlowCombinationHandlerClient registers the http handlers for service FlowCombination // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FlowCombinationClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FlowCombinationClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "FlowCombinationClient" to call the correct interceptors. func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FlowCombinationClient) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyRpc", runtime.WithHTTPPathPattern("/rpc/empty/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcEmptyRpc_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcEmptyRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyStream", runtime.WithHTTPPathPattern("/rpc/empty/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcEmptyStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcEmptyStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/StreamEmptyRpc", runtime.WithHTTPPathPattern("/stream/empty/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_StreamEmptyRpc_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_StreamEmptyRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/StreamEmptyStream", runtime.WithHTTPPathPattern("/stream/empty/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_StreamEmptyStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_StreamEmptyStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/path/{a}/{b}/{c}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/{b}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_3(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_4(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_5(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_5(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", runtime.WithHTTPPathPattern("/rpc/path/{a}/query/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyRpc_6(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyRpc_6(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathSingleNestedRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/{b}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested1/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", runtime.WithHTTPPathPattern("/rpc/path-nested2/{a.str}/rpc")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedRpc_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/body/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/path/{a}/{b}/{c}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_1(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/query/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_2(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/{b}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_3(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_3(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/body/query/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_4(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_4(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/body/path/{a}/query/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_5(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_5(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", runtime.WithHTTPPathPattern("/rpc/path/{a}/query/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcBodyStream_6(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcBodyStream_6(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedStream", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathSingleNestedStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedStream", runtime.WithHTTPPathPattern("/rpc/path-nested/{a.str}/{b}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedStream", runtime.WithHTTPPathPattern("/rpc/path-nested1/{a.str}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedStream_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedStream_1(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedStream", runtime.WithHTTPPathPattern("/rpc/path-nested2/{a.str}/stream")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FlowCombination_RpcPathNestedStream_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FlowCombination_RpcPathNestedStream_2(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_FlowCombination_RpcEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "empty"}, "")) pattern_FlowCombination_RpcEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "empty", "stream"}, "")) pattern_FlowCombination_StreamEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stream", "empty", "rpc"}, "")) pattern_FlowCombination_StreamEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"stream", "empty"}, "")) pattern_FlowCombination_RpcBodyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "body"}, "")) pattern_FlowCombination_RpcBodyRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "path", "a", "b", "c"}, "")) pattern_FlowCombination_RpcBodyRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "query"}, "")) pattern_FlowCombination_RpcBodyRpc_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "body", "path", "a", "b"}, "")) pattern_FlowCombination_RpcBodyRpc_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 0}, []string{"rpc", "body", "query"}, "")) pattern_FlowCombination_RpcBodyRpc_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 0}, []string{"rpc", "body", "path", "a", "query"}, "")) pattern_FlowCombination_RpcBodyRpc_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 0}, []string{"rpc", "path", "a", "query"}, "")) pattern_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) pattern_FlowCombination_RpcPathNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 0}, []string{"rpc", "path-nested", "a.str", "b"}, "")) pattern_FlowCombination_RpcPathNestedRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested1", "a.str"}, "")) pattern_FlowCombination_RpcPathNestedRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested2", "a.str"}, "")) pattern_FlowCombination_RpcBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "body", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "path", "a", "b", "c", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "query", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "body", "path", "a", "b", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rpc", "body", "query", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"rpc", "body", "path", "a", "query", "stream"}, "")) pattern_FlowCombination_RpcBodyStream_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4}, []string{"rpc", "path", "a", "query", "stream"}, "")) pattern_FlowCombination_RpcPathSingleNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) pattern_FlowCombination_RpcPathNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"rpc", "path-nested", "a.str", "b", "stream"}, "")) pattern_FlowCombination_RpcPathNestedStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested1", "a.str", "stream"}, "")) pattern_FlowCombination_RpcPathNestedStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested2", "a.str", "stream"}, "")) ) var ( forward_FlowCombination_RpcEmptyRpc_0 = runtime.ForwardResponseMessage forward_FlowCombination_RpcEmptyStream_0 = runtime.ForwardResponseStream forward_FlowCombination_StreamEmptyRpc_0 = runtime.ForwardResponseMessage forward_FlowCombination_StreamEmptyStream_0 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyRpc_0 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_1 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_2 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_3 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_4 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_5 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyRpc_6 = runtime.ForwardResponseMessage forward_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.ForwardResponseMessage forward_FlowCombination_RpcPathNestedRpc_0 = runtime.ForwardResponseMessage forward_FlowCombination_RpcPathNestedRpc_1 = runtime.ForwardResponseMessage forward_FlowCombination_RpcPathNestedRpc_2 = runtime.ForwardResponseMessage forward_FlowCombination_RpcBodyStream_0 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_1 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_2 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_3 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_4 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_5 = runtime.ForwardResponseStream forward_FlowCombination_RpcBodyStream_6 = runtime.ForwardResponseStream forward_FlowCombination_RpcPathSingleNestedStream_0 = runtime.ForwardResponseStream forward_FlowCombination_RpcPathNestedStream_0 = runtime.ForwardResponseStream forward_FlowCombination_RpcPathNestedStream_1 = runtime.ForwardResponseStream forward_FlowCombination_RpcPathNestedStream_2 = runtime.ForwardResponseStream ) flow_combination.proto000066400000000000000000000102041465037340600347720ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; message EmptyProto {} message NonEmptyProto { string a = 1; string b = 2; string c = 3; } message UnaryProto { string str = 1; } message NestedProto { UnaryProto a = 1; string b = 2; string c = 3; } message SingleNestedProto { UnaryProto a = 1; } service FlowCombination { rpc RpcEmptyRpc(EmptyProto) returns (EmptyProto) { option (google.api.http) = {post: "/rpc/empty/rpc"}; } rpc RpcEmptyStream(EmptyProto) returns (stream EmptyProto) { option (google.api.http) = {post: "/rpc/empty/stream"}; } rpc StreamEmptyRpc(stream EmptyProto) returns (EmptyProto) { option (google.api.http) = {post: "/stream/empty/rpc"}; } rpc StreamEmptyStream(stream EmptyProto) returns (stream EmptyProto) { option (google.api.http) = {post: "/stream/empty/stream"}; } rpc RpcBodyRpc(NonEmptyProto) returns (EmptyProto) { option (google.api.http) = { // w/ body; w/o path; w/o query post: "/rpc/body/rpc" body: "*" // w/o body; w/ path; w/o query additional_bindings {post: "/rpc/path/{a}/{b}/{c}/rpc"} // w/o body; w/o path; w/ query additional_bindings {post: "/rpc/query/rpc"} // w/ body; w/ path; w/o query additional_bindings { post: "/rpc/body/path/{a}/{b}/rpc" body: "c" } // w/ body; w/o path; w/ query additional_bindings { post: "/rpc/body/query/rpc" body: "c" } // w/ body; w/ path; w/ query additional_bindings { post: "/rpc/body/path/{a}/query/rpc" body: "c" } // w/o body; w/ path; w/ query additional_bindings {post: "/rpc/path/{a}/query/rpc"} }; } rpc RpcPathSingleNestedRpc(SingleNestedProto) returns (EmptyProto) { option (google.api.http) = { // w/o body; w/ path (IsNestedProto3); w/o query post: "/rpc/path-nested/{a.str}/rpc" }; } rpc RpcPathNestedRpc(NestedProto) returns (EmptyProto) { option (google.api.http) = { // w/ body; w/ path (IsNestedProto3); w/o query post: "/rpc/path-nested/{a.str}/{b}/rpc" body: "c" // w/o body; w/ path (IsNestedProto3); w/ query additional_bindings {post: "/rpc/path-nested1/{a.str}/rpc"} // w/ body; w/ path (IsNestedProto3); w/ query additional_bindings { post: "/rpc/path-nested2/{a.str}/rpc" body: "c" } }; } rpc RpcBodyStream(NonEmptyProto) returns (stream EmptyProto) { option (google.api.http) = { // w/ body; w/o path; w/o query post: "/rpc/body/stream" body: "*" // w/o body; w/ path; w/o query additional_bindings {post: "/rpc/path/{a}/{b}/{c}/stream"} // w/o body; w/o path; w/ query additional_bindings {post: "/rpc/query/stream"} // w/ body; w/ path; w/o query additional_bindings { post: "/rpc/body/path/{a}/{b}/stream" body: "c" } // w/ body; w/o path; w/ query additional_bindings { post: "/rpc/body/query/stream" body: "c" } // w/ body; w/ path; w/ query additional_bindings { post: "/rpc/body/path/{a}/query/stream" body: "c" } // w/o body; w/ path; w/ query additional_bindings {post: "/rpc/path/{a}/query/stream"} }; } rpc RpcPathSingleNestedStream(SingleNestedProto) returns (stream EmptyProto) { option (google.api.http) = { // w/o body; w/ path (IsNestedProto3); w/o query post: "/rpc/path-nested/{a.str}/stream" }; } rpc RpcPathNestedStream(NestedProto) returns (stream EmptyProto) { option (google.api.http) = { // w/ body; w/ path (IsNestedProto3); w/o query post: "/rpc/path-nested/{a.str}/{b}/stream" body: "c" // w/o body; w/ path (IsNestedProto3); w/ query additional_bindings {post: "/rpc/path-nested1/{a.str}/stream"} // w/ body; w/ path (IsNestedProto3); w/ query additional_bindings { post: "/rpc/path-nested2/{a.str}/stream" body: "c" } }; } } flow_combination.swagger.json000066400000000000000000001025151465037340600362450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/flow_combination.proto", "version": "version not set" }, "tags": [ { "name": "FlowCombination" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/rpc/body/path/{a}/query/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc6", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/path/{a}/query/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream6", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/path/{a}/{b}/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc4", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/path/{a}/{b}/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream4", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/query/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc5", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "a", "in": "query", "required": false, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/query/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream5", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "a", "in": "query", "required": false, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonEmptyProto" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/body/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonEmptyProto" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/empty/rpc": { "post": { "operationId": "FlowCombination_RpcEmptyRpc", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "FlowCombination" ] } }, "/rpc/empty/stream": { "post": { "operationId": "FlowCombination_RpcEmptyStream", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "FlowCombination" ] } }, "/rpc/path-nested/{a.str}/rpc": { "post": { "operationId": "FlowCombination_RpcPathSingleNestedRpc", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested/{a.str}/stream": { "post": { "operationId": "FlowCombination_RpcPathSingleNestedStream", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested/{a.str}/{b}/rpc": { "post": { "operationId": "FlowCombination_RpcPathNestedRpc", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested/{a.str}/{b}/stream": { "post": { "operationId": "FlowCombination_RpcPathNestedStream", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested1/{a.str}/rpc": { "post": { "operationId": "FlowCombination_RpcPathNestedRpc2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested1/{a.str}/stream": { "post": { "operationId": "FlowCombination_RpcPathNestedStream2", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested2/{a.str}/rpc": { "post": { "operationId": "FlowCombination_RpcPathNestedRpc3", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path-nested2/{a.str}/stream": { "post": { "operationId": "FlowCombination_RpcPathNestedStream3", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a.str", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "body", "required": true, "schema": { "type": "string" } }, { "name": "b", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path/{a}/query/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc7", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path/{a}/query/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream7", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path/{a}/{b}/{c}/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "path", "required": true, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/path/{a}/{b}/{c}/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream2", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "path", "required": true, "type": "string" }, { "name": "b", "in": "path", "required": true, "type": "string" }, { "name": "c", "in": "path", "required": true, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/query/rpc": { "post": { "operationId": "FlowCombination_RpcBodyRpc3", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "query", "required": false, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/rpc/query/stream": { "post": { "operationId": "FlowCombination_RpcBodyStream3", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "a", "in": "query", "required": false, "type": "string" }, { "name": "b", "in": "query", "required": false, "type": "string" }, { "name": "c", "in": "query", "required": false, "type": "string" } ], "tags": [ "FlowCombination" ] } }, "/stream/empty/rpc": { "post": { "operationId": "FlowCombination_StreamEmptyRpc", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "FlowCombination" ] } }, "/stream/empty/stream": { "post": { "operationId": "FlowCombination_StreamEmptyStream", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbEmptyProto" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbEmptyProto" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "tags": [ "FlowCombination" ] } } }, "definitions": { "examplepbEmptyProto": { "type": "object" }, "examplepbNonEmptyProto": { "type": "object", "properties": { "a": { "type": "string" }, "b": { "type": "string" }, "c": { "type": "string" } } }, "examplepbUnaryProto": { "type": "object", "properties": { "str": { "type": "string" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } flow_combination_grpc.pb.go000066400000000000000000000516551465037340600356660ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/flow_combination.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // FlowCombinationClient is the client API for FlowCombination service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type FlowCombinationClient interface { RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) } type flowCombinationClient struct { cc grpc.ClientConnInterface } func NewFlowCombinationClient(cc grpc.ClientConnInterface) FlowCombinationClient { return &flowCombinationClient{cc} } func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyRpc", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[0], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyStream", opts...) if err != nil { return nil, err } x := &flowCombinationRpcEmptyStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type FlowCombination_RpcEmptyStreamClient interface { Recv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationRpcEmptyStreamClient struct { grpc.ClientStream } func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[1], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/StreamEmptyRpc", opts...) if err != nil { return nil, err } x := &flowCombinationStreamEmptyRpcClient{stream} return x, nil } type FlowCombination_StreamEmptyRpcClient interface { Send(*EmptyProto) error CloseAndRecv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationStreamEmptyRpcClient struct { grpc.ClientStream } func (x *flowCombinationStreamEmptyRpcClient) Send(m *EmptyProto) error { return x.ClientStream.SendMsg(m) } func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[2], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/StreamEmptyStream", opts...) if err != nil { return nil, err } x := &flowCombinationStreamEmptyStreamClient{stream} return x, nil } type FlowCombination_StreamEmptyStreamClient interface { Send(*EmptyProto) error Recv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationStreamEmptyStreamClient struct { grpc.ClientStream } func (x *flowCombinationStreamEmptyStreamClient) Send(m *EmptyProto) error { return x.ClientStream.SendMsg(m) } func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[3], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyStream", opts...) if err != nil { return nil, err } x := &flowCombinationRpcBodyStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type FlowCombination_RpcBodyStreamClient interface { Recv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationRpcBodyStreamClient struct { grpc.ClientStream } func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[4], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) if err != nil { return nil, err } x := &flowCombinationRpcPathSingleNestedStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type FlowCombination_RpcPathSingleNestedStreamClient interface { Recv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationRpcPathSingleNestedStreamClient struct { grpc.ClientStream } func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { stream, err := c.cc.NewStream(ctx, &FlowCombination_ServiceDesc.Streams[5], "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedStream", opts...) if err != nil { return nil, err } x := &flowCombinationRpcPathNestedStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type FlowCombination_RpcPathNestedStreamClient interface { Recv() (*EmptyProto, error) grpc.ClientStream } type flowCombinationRpcPathNestedStreamClient struct { grpc.ClientStream } func (x *flowCombinationRpcPathNestedStreamClient) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } // FlowCombinationServer is the server API for FlowCombination service. // All implementations should embed UnimplementedFlowCombinationServer // for forward compatibility type FlowCombinationServer interface { RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error) RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error StreamEmptyRpc(FlowCombination_StreamEmptyRpcServer) error StreamEmptyStream(FlowCombination_StreamEmptyStreamServer) error RpcBodyRpc(context.Context, *NonEmptyProto) (*EmptyProto, error) RpcPathSingleNestedRpc(context.Context, *SingleNestedProto) (*EmptyProto, error) RpcPathNestedRpc(context.Context, *NestedProto) (*EmptyProto, error) RpcBodyStream(*NonEmptyProto, FlowCombination_RpcBodyStreamServer) error RpcPathSingleNestedStream(*SingleNestedProto, FlowCombination_RpcPathSingleNestedStreamServer) error RpcPathNestedStream(*NestedProto, FlowCombination_RpcPathNestedStreamServer) error } // UnimplementedFlowCombinationServer should be embedded to have forward compatible implementations. type UnimplementedFlowCombinationServer struct { } func (UnimplementedFlowCombinationServer) RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error) { return nil, status.Errorf(codes.Unimplemented, "method RpcEmptyRpc not implemented") } func (UnimplementedFlowCombinationServer) RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error { return status.Errorf(codes.Unimplemented, "method RpcEmptyStream not implemented") } func (UnimplementedFlowCombinationServer) StreamEmptyRpc(FlowCombination_StreamEmptyRpcServer) error { return status.Errorf(codes.Unimplemented, "method StreamEmptyRpc not implemented") } func (UnimplementedFlowCombinationServer) StreamEmptyStream(FlowCombination_StreamEmptyStreamServer) error { return status.Errorf(codes.Unimplemented, "method StreamEmptyStream not implemented") } func (UnimplementedFlowCombinationServer) RpcBodyRpc(context.Context, *NonEmptyProto) (*EmptyProto, error) { return nil, status.Errorf(codes.Unimplemented, "method RpcBodyRpc not implemented") } func (UnimplementedFlowCombinationServer) RpcPathSingleNestedRpc(context.Context, *SingleNestedProto) (*EmptyProto, error) { return nil, status.Errorf(codes.Unimplemented, "method RpcPathSingleNestedRpc not implemented") } func (UnimplementedFlowCombinationServer) RpcPathNestedRpc(context.Context, *NestedProto) (*EmptyProto, error) { return nil, status.Errorf(codes.Unimplemented, "method RpcPathNestedRpc not implemented") } func (UnimplementedFlowCombinationServer) RpcBodyStream(*NonEmptyProto, FlowCombination_RpcBodyStreamServer) error { return status.Errorf(codes.Unimplemented, "method RpcBodyStream not implemented") } func (UnimplementedFlowCombinationServer) RpcPathSingleNestedStream(*SingleNestedProto, FlowCombination_RpcPathSingleNestedStreamServer) error { return status.Errorf(codes.Unimplemented, "method RpcPathSingleNestedStream not implemented") } func (UnimplementedFlowCombinationServer) RpcPathNestedStream(*NestedProto, FlowCombination_RpcPathNestedStreamServer) error { return status.Errorf(codes.Unimplemented, "method RpcPathNestedStream not implemented") } // UnsafeFlowCombinationServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to FlowCombinationServer will // result in compilation errors. type UnsafeFlowCombinationServer interface { mustEmbedUnimplementedFlowCombinationServer() } func RegisterFlowCombinationServer(s grpc.ServiceRegistrar, srv FlowCombinationServer) { s.RegisterService(&FlowCombination_ServiceDesc, srv) } func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyProto) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcEmptyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) } return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(EmptyProto) if err := stream.RecvMsg(m); err != nil { return err } return srv.(FlowCombinationServer).RpcEmptyStream(m, &flowCombinationRpcEmptyStreamServer{stream}) } type FlowCombination_RpcEmptyStreamServer interface { Send(*EmptyProto) error grpc.ServerStream } type flowCombinationRpcEmptyStreamServer struct { grpc.ServerStream } func (x *flowCombinationRpcEmptyStreamServer) Send(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } func _FlowCombination_StreamEmptyRpc_Handler(srv interface{}, stream grpc.ServerStream) error { return srv.(FlowCombinationServer).StreamEmptyRpc(&flowCombinationStreamEmptyRpcServer{stream}) } type FlowCombination_StreamEmptyRpcServer interface { SendAndClose(*EmptyProto) error Recv() (*EmptyProto, error) grpc.ServerStream } type flowCombinationStreamEmptyRpcServer struct { grpc.ServerStream } func (x *flowCombinationStreamEmptyRpcServer) SendAndClose(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } func (x *flowCombinationStreamEmptyRpcServer) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func _FlowCombination_StreamEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { return srv.(FlowCombinationServer).StreamEmptyStream(&flowCombinationStreamEmptyStreamServer{stream}) } type FlowCombination_StreamEmptyStreamServer interface { Send(*EmptyProto) error Recv() (*EmptyProto, error) grpc.ServerStream } type flowCombinationStreamEmptyStreamServer struct { grpc.ServerStream } func (x *flowCombinationStreamEmptyStreamServer) Send(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { m := new(EmptyProto) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonEmptyProto) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcBodyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) } return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SingleNestedProto) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathSingleNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) } return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NestedProto) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.FlowCombination/RpcPathNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) } return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(NonEmptyProto) if err := stream.RecvMsg(m); err != nil { return err } return srv.(FlowCombinationServer).RpcBodyStream(m, &flowCombinationRpcBodyStreamServer{stream}) } type FlowCombination_RpcBodyStreamServer interface { Send(*EmptyProto) error grpc.ServerStream } type flowCombinationRpcBodyStreamServer struct { grpc.ServerStream } func (x *flowCombinationRpcBodyStreamServer) Send(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } func _FlowCombination_RpcPathSingleNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SingleNestedProto) if err := stream.RecvMsg(m); err != nil { return err } return srv.(FlowCombinationServer).RpcPathSingleNestedStream(m, &flowCombinationRpcPathSingleNestedStreamServer{stream}) } type FlowCombination_RpcPathSingleNestedStreamServer interface { Send(*EmptyProto) error grpc.ServerStream } type flowCombinationRpcPathSingleNestedStreamServer struct { grpc.ServerStream } func (x *flowCombinationRpcPathSingleNestedStreamServer) Send(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } func _FlowCombination_RpcPathNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(NestedProto) if err := stream.RecvMsg(m); err != nil { return err } return srv.(FlowCombinationServer).RpcPathNestedStream(m, &flowCombinationRpcPathNestedStreamServer{stream}) } type FlowCombination_RpcPathNestedStreamServer interface { Send(*EmptyProto) error grpc.ServerStream } type flowCombinationRpcPathNestedStreamServer struct { grpc.ServerStream } func (x *flowCombinationRpcPathNestedStreamServer) Send(m *EmptyProto) error { return x.ServerStream.SendMsg(m) } // FlowCombination_ServiceDesc is the grpc.ServiceDesc for FlowCombination service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var FlowCombination_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.FlowCombination", HandlerType: (*FlowCombinationServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "RpcEmptyRpc", Handler: _FlowCombination_RpcEmptyRpc_Handler, }, { MethodName: "RpcBodyRpc", Handler: _FlowCombination_RpcBodyRpc_Handler, }, { MethodName: "RpcPathSingleNestedRpc", Handler: _FlowCombination_RpcPathSingleNestedRpc_Handler, }, { MethodName: "RpcPathNestedRpc", Handler: _FlowCombination_RpcPathNestedRpc_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "RpcEmptyStream", Handler: _FlowCombination_RpcEmptyStream_Handler, ServerStreams: true, }, { StreamName: "StreamEmptyRpc", Handler: _FlowCombination_StreamEmptyRpc_Handler, ClientStreams: true, }, { StreamName: "StreamEmptyStream", Handler: _FlowCombination_StreamEmptyStream_Handler, ServerStreams: true, ClientStreams: true, }, { StreamName: "RpcBodyStream", Handler: _FlowCombination_RpcBodyStream_Handler, ServerStreams: true, }, { StreamName: "RpcPathSingleNestedStream", Handler: _FlowCombination_RpcPathSingleNestedStream_Handler, ServerStreams: true, }, { StreamName: "RpcPathNestedStream", Handler: _FlowCombination_RpcPathNestedStream_Handler, ServerStreams: true, }, }, Metadata: "examples/internal/proto/examplepb/flow_combination.proto", } generate_unbound_methods.buf.gen.yaml000066400000000000000000000003261465037340600376360ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - plugin: grpc-gateway out: . opt: - paths=source_relative - generate_unbound_methods=true - plugin: openapiv2 out: . opt: - generate_unbound_methods=true generate_unbound_methods.pb.go000066400000000000000000000322121465037340600363550ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/generate_unbound_methods.proto // Generate Unannotated Methods Echo Service // Similar to echo_service.proto but without annotations and without external configuration. // // Generate Unannotated Methods Echo Service API consists of a single service which returns // a message. package examplepb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" 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) ) // GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. type GenerateUnboundMethodsSimpleMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` Duration *durationpb.Duration `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"` } func (x *GenerateUnboundMethodsSimpleMessage) Reset() { *x = GenerateUnboundMethodsSimpleMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_generate_unbound_methods_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *GenerateUnboundMethodsSimpleMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*GenerateUnboundMethodsSimpleMessage) ProtoMessage() {} func (x *GenerateUnboundMethodsSimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_generate_unbound_methods_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 GenerateUnboundMethodsSimpleMessage.ProtoReflect.Descriptor instead. func (*GenerateUnboundMethodsSimpleMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescGZIP(), []int{0} } func (x *GenerateUnboundMethodsSimpleMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *GenerateUnboundMethodsSimpleMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *GenerateUnboundMethodsSimpleMessage) GetDuration() *durationpb.Duration { if x != nil { return x.Duration } return nil } var File_examples_internal_proto_examplepb_generate_unbound_methods_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDesc = []byte{ 0x0a, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7e, 0x0a, 0x23, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc6, 0x04, 0x0a, 0x21, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb0, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0xb4, 0x01, 0x0a, 0x08, 0x45, 0x63, 0x68, 0x6f, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0xb6, 0x01, 0x0a, 0x0a, 0x45, 0x63, 0x68, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x53, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescData = file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDesc ) func file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescData) }) return file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescData } var file_examples_internal_proto_examplepb_generate_unbound_methods_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_examplepb_generate_unbound_methods_proto_goTypes = []interface{}{ (*GenerateUnboundMethodsSimpleMessage)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage (*durationpb.Duration)(nil), // 1: google.protobuf.Duration } var file_examples_internal_proto_examplepb_generate_unbound_methods_proto_depIdxs = []int32{ 1, // 0: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage.duration:type_name -> google.protobuf.Duration 0, // 1: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 0, // 2: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.EchoBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 0, // 3: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.EchoDelete:input_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 0, // 4: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 0, // 5: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.EchoBody:output_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 0, // 6: grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService.EchoDelete:output_type -> grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsSimpleMessage 4, // [4:7] is the sub-list for method output_type 1, // [1:4] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_generate_unbound_methods_proto_init() } func file_examples_internal_proto_examplepb_generate_unbound_methods_proto_init() { if File_examples_internal_proto_examplepb_generate_unbound_methods_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_generate_unbound_methods_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenerateUnboundMethodsSimpleMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_generate_unbound_methods_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_generate_unbound_methods_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_generate_unbound_methods_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_generate_unbound_methods_proto = out.File file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDesc = nil file_examples_internal_proto_examplepb_generate_unbound_methods_proto_goTypes = nil file_examples_internal_proto_examplepb_generate_unbound_methods_proto_depIdxs = nil } generate_unbound_methods.pb.gw.go000066400000000000000000000373671465037340600370110ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/generate_unbound_methods.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_GenerateUnboundMethodsEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client GenerateUnboundMethodsEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_GenerateUnboundMethodsEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server GenerateUnboundMethodsEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_GenerateUnboundMethodsEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client GenerateUnboundMethodsEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_GenerateUnboundMethodsEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server GenerateUnboundMethodsEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoBody(ctx, &protoReq) return msg, metadata, err } func request_GenerateUnboundMethodsEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client GenerateUnboundMethodsEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_GenerateUnboundMethodsEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server GenerateUnboundMethodsEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GenerateUnboundMethodsSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoDelete(ctx, &protoReq) return msg, metadata, err } // RegisterGenerateUnboundMethodsEchoServiceHandlerServer registers the http handlers for service GenerateUnboundMethodsEchoService to "mux". // UnaryRPC :call GenerateUnboundMethodsEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGenerateUnboundMethodsEchoServiceHandlerFromEndpoint instead. func RegisterGenerateUnboundMethodsEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GenerateUnboundMethodsEchoServiceServer) error { mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_GenerateUnboundMethodsEchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_GenerateUnboundMethodsEchoService_EchoBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_GenerateUnboundMethodsEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterGenerateUnboundMethodsEchoServiceHandlerFromEndpoint is same as RegisterGenerateUnboundMethodsEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterGenerateUnboundMethodsEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterGenerateUnboundMethodsEchoServiceHandler(ctx, mux, conn) } // RegisterGenerateUnboundMethodsEchoServiceHandler registers the http handlers for service GenerateUnboundMethodsEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterGenerateUnboundMethodsEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterGenerateUnboundMethodsEchoServiceHandlerClient(ctx, mux, NewGenerateUnboundMethodsEchoServiceClient(conn)) } // RegisterGenerateUnboundMethodsEchoServiceHandlerClient registers the http handlers for service GenerateUnboundMethodsEchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GenerateUnboundMethodsEchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GenerateUnboundMethodsEchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "GenerateUnboundMethodsEchoServiceClient" to call the correct interceptors. func RegisterGenerateUnboundMethodsEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GenerateUnboundMethodsEchoServiceClient) error { mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_GenerateUnboundMethodsEchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_GenerateUnboundMethodsEchoService_EchoBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_GenerateUnboundMethodsEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete", runtime.WithHTTPPathPattern("/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_GenerateUnboundMethodsEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_GenerateUnboundMethodsEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_GenerateUnboundMethodsEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService", "Echo"}, "")) pattern_GenerateUnboundMethodsEchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService", "EchoBody"}, "")) pattern_GenerateUnboundMethodsEchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService", "EchoDelete"}, "")) ) var ( forward_GenerateUnboundMethodsEchoService_Echo_0 = runtime.ForwardResponseMessage forward_GenerateUnboundMethodsEchoService_EchoBody_0 = runtime.ForwardResponseMessage forward_GenerateUnboundMethodsEchoService_EchoDelete_0 = runtime.ForwardResponseMessage ) generate_unbound_methods.proto000066400000000000000000000027711465037340600365220ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Generate Unannotated Methods Echo Service // Similar to echo_service.proto but without annotations and without external configuration. // // Generate Unannotated Methods Echo Service API consists of a single service which returns // a message. package grpc.gateway.examples.internal.proto.examplepb; // Do not need annotations.proto, can still use well known types as usual import "google/protobuf/duration.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service. message GenerateUnboundMethodsSimpleMessage { // Id represents the message identifier. string id = 1; int64 num = 2; google.protobuf.Duration duration = 3; } // GenerateUnboundMethodsEchoService service responds to incoming echo requests. service GenerateUnboundMethodsEchoService { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. rpc Echo(GenerateUnboundMethodsSimpleMessage) returns (GenerateUnboundMethodsSimpleMessage); // EchoBody method receives a simple message and returns it. rpc EchoBody(GenerateUnboundMethodsSimpleMessage) returns (GenerateUnboundMethodsSimpleMessage); // EchoDelete method receives a simple message and returns it. rpc EchoDelete(GenerateUnboundMethodsSimpleMessage) returns (GenerateUnboundMethodsSimpleMessage); } generate_unbound_methods.swagger.json000066400000000000000000000124321465037340600377610ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/generate_unbound_methods.proto", "description": "Generate Unannotated Methods Echo Service\nSimilar to echo_service.proto but without annotations and without external configuration.\n\nGenerate Unannotated Methods Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, "tags": [ { "name": "GenerateUnboundMethodsEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo": { "post": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "GenerateUnboundMethodsEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } } ], "tags": [ "GenerateUnboundMethodsEchoService" ] } }, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody": { "post": { "summary": "EchoBody method receives a simple message and returns it.", "operationId": "GenerateUnboundMethodsEchoService_EchoBody", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } } ], "tags": [ "GenerateUnboundMethodsEchoService" ] } }, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete": { "post": { "summary": "EchoDelete method receives a simple message and returns it.", "operationId": "GenerateUnboundMethodsEchoService_EchoDelete", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbGenerateUnboundMethodsSimpleMessage" } } ], "tags": [ "GenerateUnboundMethodsEchoService" ] } } }, "definitions": { "examplepbGenerateUnboundMethodsSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "duration": { "type": "string" } }, "description": "GenerateUnboundMethodsSimpleMessage represents a simple message sent to the unannotated GenerateUnboundMethodsEchoService service." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } generate_unbound_methods_grpc.pb.go000066400000000000000000000213011465037340600373650ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/generate_unbound_methods.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // GenerateUnboundMethodsEchoServiceClient is the client API for GenerateUnboundMethodsEchoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type GenerateUnboundMethodsEchoServiceClient interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) } type generateUnboundMethodsEchoServiceClient struct { cc grpc.ClientConnInterface } func NewGenerateUnboundMethodsEchoServiceClient(cc grpc.ClientConnInterface) GenerateUnboundMethodsEchoServiceClient { return &generateUnboundMethodsEchoServiceClient{cc} } func (c *generateUnboundMethodsEchoServiceClient) Echo(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) { out := new(GenerateUnboundMethodsSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *generateUnboundMethodsEchoServiceClient) EchoBody(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) { out := new(GenerateUnboundMethodsSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *generateUnboundMethodsEchoServiceClient) EchoDelete(ctx context.Context, in *GenerateUnboundMethodsSimpleMessage, opts ...grpc.CallOption) (*GenerateUnboundMethodsSimpleMessage, error) { out := new(GenerateUnboundMethodsSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } return out, nil } // GenerateUnboundMethodsEchoServiceServer is the server API for GenerateUnboundMethodsEchoService service. // All implementations should embed UnimplementedGenerateUnboundMethodsEchoServiceServer // for forward compatibility type GenerateUnboundMethodsEchoServiceServer interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) } // UnimplementedGenerateUnboundMethodsEchoServiceServer should be embedded to have forward compatible implementations. type UnimplementedGenerateUnboundMethodsEchoServiceServer struct { } func (UnimplementedGenerateUnboundMethodsEchoServiceServer) Echo(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } func (UnimplementedGenerateUnboundMethodsEchoServiceServer) EchoBody(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") } func (UnimplementedGenerateUnboundMethodsEchoServiceServer) EchoDelete(context.Context, *GenerateUnboundMethodsSimpleMessage) (*GenerateUnboundMethodsSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") } // UnsafeGenerateUnboundMethodsEchoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GenerateUnboundMethodsEchoServiceServer will // result in compilation errors. type UnsafeGenerateUnboundMethodsEchoServiceServer interface { mustEmbedUnimplementedGenerateUnboundMethodsEchoServiceServer() } func RegisterGenerateUnboundMethodsEchoServiceServer(s grpc.ServiceRegistrar, srv GenerateUnboundMethodsEchoServiceServer) { s.RegisterService(&GenerateUnboundMethodsEchoService_ServiceDesc, srv) } func _GenerateUnboundMethodsEchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GenerateUnboundMethodsSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(GenerateUnboundMethodsEchoServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GenerateUnboundMethodsEchoServiceServer).Echo(ctx, req.(*GenerateUnboundMethodsSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _GenerateUnboundMethodsEchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GenerateUnboundMethodsSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(GenerateUnboundMethodsEchoServiceServer).EchoBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GenerateUnboundMethodsEchoServiceServer).EchoBody(ctx, req.(*GenerateUnboundMethodsSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _GenerateUnboundMethodsEchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GenerateUnboundMethodsSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(GenerateUnboundMethodsEchoServiceServer).EchoDelete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService/EchoDelete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GenerateUnboundMethodsEchoServiceServer).EchoDelete(ctx, req.(*GenerateUnboundMethodsSimpleMessage)) } return interceptor(ctx, in, info, handler) } // GenerateUnboundMethodsEchoService_ServiceDesc is the grpc.ServiceDesc for GenerateUnboundMethodsEchoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var GenerateUnboundMethodsEchoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.GenerateUnboundMethodsEchoService", HandlerType: (*GenerateUnboundMethodsEchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _GenerateUnboundMethodsEchoService_Echo_Handler, }, { MethodName: "EchoBody", Handler: _GenerateUnboundMethodsEchoService_EchoBody_Handler, }, { MethodName: "EchoDelete", Handler: _GenerateUnboundMethodsEchoService_EchoDelete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/generate_unbound_methods.proto", } generated_input.proto000066400000000000000000000012151465037340600346200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "examples/internal/proto/examplepb/a_bit_of_everything.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // This file is run through a genrule. // Defines some more operations to be added to ABitOfEverythingService service GeneratedService { rpc Create(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/generated_create" body: "*" }; } } generated_input.swagger.json000066400000000000000000000360161465037340600360730ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/generated_input.proto", "version": "version not set" }, "tags": [ { "name": "GeneratedService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/a_bit_of_everything/generated_create": { "post": { "operationId": "GeneratedService_Create", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "Intentionally complicated message type to cover many features of Protobuf.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } } ], "tags": [ "GeneratedService" ] } } }, "definitions": { "ABitOfEverythingNested": { "type": "object", "example": { "ok": "TRUE" }, "properties": { "name": { "type": "string", "description": "name is nested field." }, "amount": { "type": "integer", "format": "int64" }, "ok": { "$ref": "#/definitions/NestedDeepEnum", "description": "DeepEnum description." } }, "description": "Nested is nested type." }, "MessagePathEnumNestedPathEnum": { "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, "NestedDeepEnum": { "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE", "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." }, "examplepbABitOfEverything": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { "type": "string", "format": "uuid", "minLength": 1, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "uuid", "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "examplepbNumericEnum": { "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, "pathenumPathEnum": { "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } ignore_comment.buf.gen.yaml000066400000000000000000000001321465037340600355670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - ignore_comments=true ignore_comment.pb.go000066400000000000000000000247561465037340600343310ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/ignore_comment.proto package examplepb import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // This comment should be excluded from OpenAPI output type FooRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // This comment should be excluded from OpenAPI output Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // This comment should be excluded from OpenAPI output Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` } func (x *FooRequest) Reset() { *x = FooRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *FooRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*FooRequest) ProtoMessage() {} func (x *FooRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_ignore_comment_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 FooRequest.ProtoReflect.Descriptor instead. func (*FooRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescGZIP(), []int{0} } func (x *FooRequest) GetUsername() string { if x != nil { return x.Username } return "" } func (x *FooRequest) GetPassword() string { if x != nil { return x.Password } return "" } // This comment should be excluded from OpenAPI output type FooReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *FooReply) Reset() { *x = FooReply{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *FooReply) String() string { return protoimpl.X.MessageStringOf(x) } func (*FooReply) ProtoMessage() {} func (x *FooReply) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_ignore_comment_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 FooReply.ProtoReflect.Descriptor instead. func (*FooReply) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescGZIP(), []int{1} } var File_examples_internal_proto_examplepb_ignore_comment_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_ignore_comment_proto_rawDesc = []byte{ 0x0a, 0x36, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x46, 0x6f, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x28, 0x92, 0x41, 0x25, 0x32, 0x23, 0x54, 0x68, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x28, 0x92, 0x41, 0x25, 0x2a, 0x23, 0x54, 0x68, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x0a, 0x0a, 0x08, 0x46, 0x6f, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0xa6, 0x01, 0x0a, 0x0a, 0x46, 0x6f, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x97, 0x01, 0x0a, 0x03, 0x46, 0x6f, 0x6f, 0x12, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x66, 0x6f, 0x6f, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescData = file_examples_internal_proto_examplepb_ignore_comment_proto_rawDesc ) func file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescData) }) return file_examples_internal_proto_examplepb_ignore_comment_proto_rawDescData } var file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_examples_internal_proto_examplepb_ignore_comment_proto_goTypes = []interface{}{ (*FooRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.FooRequest (*FooReply)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.FooReply } var file_examples_internal_proto_examplepb_ignore_comment_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.examplepb.FooService.Foo:input_type -> grpc.gateway.examples.internal.proto.examplepb.FooRequest 1, // 1: grpc.gateway.examples.internal.proto.examplepb.FooService.Foo:output_type -> grpc.gateway.examples.internal.proto.examplepb.FooReply 1, // [1:2] is the sub-list for method output_type 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_ignore_comment_proto_init() } func file_examples_internal_proto_examplepb_ignore_comment_proto_init() { if File_examples_internal_proto_examplepb_ignore_comment_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FooRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FooReply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_ignore_comment_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_ignore_comment_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_ignore_comment_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_ignore_comment_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_ignore_comment_proto = out.File file_examples_internal_proto_examplepb_ignore_comment_proto_rawDesc = nil file_examples_internal_proto_examplepb_ignore_comment_proto_goTypes = nil file_examples_internal_proto_examplepb_ignore_comment_proto_depIdxs = nil } ignore_comment.pb.gw.go000066400000000000000000000146431465037340600347370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/ignore_comment.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_FooService_Foo_0(ctx context.Context, marshaler runtime.Marshaler, client FooServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq FooRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Foo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_FooService_Foo_0(ctx context.Context, marshaler runtime.Marshaler, server FooServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq FooRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Foo(ctx, &protoReq) return msg, metadata, err } // RegisterFooServiceHandlerServer registers the http handlers for service FooService to "mux". // UnaryRPC :call FooServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFooServiceHandlerFromEndpoint instead. func RegisterFooServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FooServiceServer) error { mux.Handle("POST", pattern_FooService_Foo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FooService/Foo", runtime.WithHTTPPathPattern("/v1/example/foo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_FooService_Foo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FooService_Foo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterFooServiceHandlerFromEndpoint is same as RegisterFooServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterFooServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterFooServiceHandler(ctx, mux, conn) } // RegisterFooServiceHandler registers the http handlers for service FooService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterFooServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterFooServiceHandlerClient(ctx, mux, NewFooServiceClient(conn)) } // RegisterFooServiceHandlerClient registers the http handlers for service FooService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FooServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FooServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "FooServiceClient" to call the correct interceptors. func RegisterFooServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FooServiceClient) error { mux.Handle("POST", pattern_FooService_Foo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.FooService/Foo", runtime.WithHTTPPathPattern("/v1/example/foo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_FooService_Foo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_FooService_Foo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_FooService_Foo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "foo"}, "")) ) var ( forward_FooService_Foo_0 = runtime.ForwardResponseMessage ) ignore_comment.proto000066400000000000000000000020751465037340600344550ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // This comment should be excluded from OpenAPI output service FooService { // This comment should be excluded from OpenAPI output rpc Foo(FooRequest) returns (FooReply) { option (google.api.http) = { post: "/v1/example/foo" body: "*" }; } } // This comment should be excluded from OpenAPI output message FooRequest { // This comment should be excluded from OpenAPI output string username = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "This annotation should be preserved"}]; // This comment should be excluded from OpenAPI output string password = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {title: "This annotation should be preserved"}]; } // This comment should be excluded from OpenAPI output message FooReply {} ignore_comment.swagger.json000066400000000000000000000040171465037340600357170ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/ignore_comment.proto", "version": "version not set" }, "tags": [ { "name": "FooService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/foo": { "post": { "operationId": "FooService_Foo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbFooReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbFooRequest" } } ], "tags": [ "FooService" ] } } }, "definitions": { "examplepbFooReply": { "type": "object" }, "examplepbFooRequest": { "type": "object", "properties": { "username": { "type": "string", "description": "This annotation should be preserved" }, "password": { "type": "string", "title": "This annotation should be preserved" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } ignore_comment_grpc.pb.go000066400000000000000000000071631465037340600353350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/ignore_comment.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // FooServiceClient is the client API for FooService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type FooServiceClient interface { // This comment should be excluded from OpenAPI output Foo(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooReply, error) } type fooServiceClient struct { cc grpc.ClientConnInterface } func NewFooServiceClient(cc grpc.ClientConnInterface) FooServiceClient { return &fooServiceClient{cc} } func (c *fooServiceClient) Foo(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooReply, error) { out := new(FooReply) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.FooService/Foo", in, out, opts...) if err != nil { return nil, err } return out, nil } // FooServiceServer is the server API for FooService service. // All implementations should embed UnimplementedFooServiceServer // for forward compatibility type FooServiceServer interface { // This comment should be excluded from OpenAPI output Foo(context.Context, *FooRequest) (*FooReply, error) } // UnimplementedFooServiceServer should be embedded to have forward compatible implementations. type UnimplementedFooServiceServer struct { } func (UnimplementedFooServiceServer) Foo(context.Context, *FooRequest) (*FooReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Foo not implemented") } // UnsafeFooServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to FooServiceServer will // result in compilation errors. type UnsafeFooServiceServer interface { mustEmbedUnimplementedFooServiceServer() } func RegisterFooServiceServer(s grpc.ServiceRegistrar, srv FooServiceServer) { s.RegisterService(&FooService_ServiceDesc, srv) } func _FooService_Foo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(FooRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(FooServiceServer).Foo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.FooService/Foo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FooServiceServer).Foo(ctx, req.(*FooRequest)) } return interceptor(ctx, in, info, handler) } // FooService_ServiceDesc is the grpc.ServiceDesc for FooService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var FooService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.FooService", HandlerType: (*FooServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Foo", Handler: _FooService_Foo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/ignore_comment.proto", } non_standard_names.pb.go000066400000000000000000001111471465037340600351500ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/non_standard_names.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 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) ) // NonStandardMessage has oddly named fields. type NonStandardMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3" json:"line_num,omitempty"` LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` STATUS string `protobuf:"bytes,5,opt,name=STATUS,proto3" json:"STATUS,omitempty"` En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=enGB,proto3" json:"en_GB,omitempty"` No string `protobuf:"bytes,7,opt,name=no,proto3" json:"no,omitempty"` Thing *NonStandardMessage_Thing `protobuf:"bytes,8,opt,name=thing,proto3" json:"thing,omitempty"` } func (x *NonStandardMessage) Reset() { *x = NonStandardMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage) ProtoMessage() {} func (x *NonStandardMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessage.ProtoReflect.Descriptor instead. func (*NonStandardMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0} } func (x *NonStandardMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *NonStandardMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *NonStandardMessage) GetLineNum() int64 { if x != nil { return x.LineNum } return 0 } func (x *NonStandardMessage) GetLangIdent() string { if x != nil { return x.LangIdent } return "" } func (x *NonStandardMessage) GetSTATUS() string { if x != nil { return x.STATUS } return "" } func (x *NonStandardMessage) GetEn_GB() int64 { if x != nil { return x.En_GB } return 0 } func (x *NonStandardMessage) GetNo() string { if x != nil { return x.No } return "" } func (x *NonStandardMessage) GetThing() *NonStandardMessage_Thing { if x != nil { return x.Thing } return nil } type NonStandardUpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Body *NonStandardMessage `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *NonStandardUpdateRequest) Reset() { *x = NonStandardUpdateRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardUpdateRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardUpdateRequest) ProtoMessage() {} func (x *NonStandardUpdateRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardUpdateRequest.ProtoReflect.Descriptor instead. func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{1} } func (x *NonStandardUpdateRequest) GetBody() *NonStandardMessage { if x != nil { return x.Body } return nil } func (x *NonStandardUpdateRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } // NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. type NonStandardMessageWithJSONNames struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,json=ID,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=LineNum,proto3" json:"line_num,omitempty"` LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` STATUS string `protobuf:"bytes,5,opt,name=STATUS,json=status,proto3" json:"STATUS,omitempty"` En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=En_GB,proto3" json:"en_GB,omitempty"` No string `protobuf:"bytes,7,opt,name=no,json=yes,proto3" json:"no,omitempty"` Thing *NonStandardMessageWithJSONNames_Thing `protobuf:"bytes,8,opt,name=thing,json=Thingy,proto3" json:"thing,omitempty"` } func (x *NonStandardMessageWithJSONNames) Reset() { *x = NonStandardMessageWithJSONNames{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2} } func (x *NonStandardMessageWithJSONNames) GetId() string { if x != nil { return x.Id } return "" } func (x *NonStandardMessageWithJSONNames) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *NonStandardMessageWithJSONNames) GetLineNum() int64 { if x != nil { return x.LineNum } return 0 } func (x *NonStandardMessageWithJSONNames) GetLangIdent() string { if x != nil { return x.LangIdent } return "" } func (x *NonStandardMessageWithJSONNames) GetSTATUS() string { if x != nil { return x.STATUS } return "" } func (x *NonStandardMessageWithJSONNames) GetEn_GB() int64 { if x != nil { return x.En_GB } return 0 } func (x *NonStandardMessageWithJSONNames) GetNo() string { if x != nil { return x.No } return "" } func (x *NonStandardMessageWithJSONNames) GetThing() *NonStandardMessageWithJSONNames_Thing { if x != nil { return x.Thing } return nil } type NonStandardWithJSONNamesUpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Body *NonStandardMessageWithJSONNames `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *NonStandardWithJSONNamesUpdateRequest) Reset() { *x = NonStandardWithJSONNamesUpdateRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardWithJSONNamesUpdateRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} func (x *NonStandardWithJSONNamesUpdateRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardWithJSONNamesUpdateRequest.ProtoReflect.Descriptor instead. func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{3} } func (x *NonStandardWithJSONNamesUpdateRequest) GetBody() *NonStandardMessageWithJSONNames { if x != nil { return x.Body } return nil } func (x *NonStandardWithJSONNamesUpdateRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } type NonStandardMessage_Thing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubThing *NonStandardMessage_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,proto3" json:"subThing,omitempty"` } func (x *NonStandardMessage_Thing) Reset() { *x = NonStandardMessage_Thing{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage_Thing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage_Thing) ProtoMessage() {} func (x *NonStandardMessage_Thing) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessage_Thing.ProtoReflect.Descriptor instead. func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0, 0} } func (x *NonStandardMessage_Thing) GetSubThing() *NonStandardMessage_Thing_SubThing { if x != nil { return x.SubThing } return nil } type NonStandardMessage_Thing_SubThing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=subValue,proto3" json:"sub_value,omitempty"` } func (x *NonStandardMessage_Thing_SubThing) Reset() { *x = NonStandardMessage_Thing_SubThing{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage_Thing_SubThing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} func (x *NonStandardMessage_Thing_SubThing) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessage_Thing_SubThing.ProtoReflect.Descriptor instead. func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0, 0, 0} } func (x *NonStandardMessage_Thing_SubThing) GetSubValue() string { if x != nil { return x.SubValue } return "" } type NonStandardMessageWithJSONNames_Thing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubThing *NonStandardMessageWithJSONNames_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,json=SubThing,proto3" json:"subThing,omitempty"` } func (x *NonStandardMessageWithJSONNames_Thing) Reset() { *x = NonStandardMessageWithJSONNames_Thing{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames_Thing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames_Thing) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames_Thing.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2, 0} } func (x *NonStandardMessageWithJSONNames_Thing) GetSubThing() *NonStandardMessageWithJSONNames_Thing_SubThing { if x != nil { return x.SubThing } return nil } type NonStandardMessageWithJSONNames_Thing_SubThing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=sub_Value,proto3" json:"sub_value,omitempty"` } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) Reset() { *x = NonStandardMessageWithJSONNames_Thing_SubThing{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames_Thing_SubThing) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames_Thing_SubThing.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) GetSubValue() string { if x != nil { return x.SubValue } return "" } var File_examples_internal_proto_examplepb_non_standard_names_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_non_standard_names_proto_rawDesc = []byte{ 0x0a, 0x3a, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x03, 0x0a, 0x12, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x12, 0x13, 0x0a, 0x05, 0x65, 0x6e, 0x5f, 0x47, 0x42, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x65, 0x6e, 0x47, 0x42, 0x12, 0x0e, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x5e, 0x0a, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x9f, 0x01, 0x0a, 0x05, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x6d, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x51, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x27, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x18, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0xd9, 0x03, 0x0a, 0x1f, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x5f, 0x47, 0x42, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x45, 0x6e, 0x5f, 0x47, 0x42, 0x12, 0x0f, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x79, 0x65, 0x73, 0x12, 0x6c, 0x0a, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x55, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x79, 0x1a, 0xad, 0x01, 0x0a, 0x05, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x7a, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x5e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x28, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc9, 0x01, 0x0a, 0x25, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x32, 0xdb, 0x03, 0x0a, 0x12, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc5, 0x01, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0xfc, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x55, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x3a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, 0x2f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescData = file_examples_internal_proto_examplepb_non_standard_names_proto_rawDesc ) func file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescData) }) return file_examples_internal_proto_examplepb_non_standard_names_proto_rawDescData } var file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_examples_internal_proto_examplepb_non_standard_names_proto_goTypes = []interface{}{ (*NonStandardMessage)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage (*NonStandardUpdateRequest)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.NonStandardUpdateRequest (*NonStandardMessageWithJSONNames)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames (*NonStandardWithJSONNamesUpdateRequest)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.NonStandardWithJSONNamesUpdateRequest (*NonStandardMessage_Thing)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.Thing (*NonStandardMessage_Thing_SubThing)(nil), // 5: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.Thing.SubThing (*NonStandardMessageWithJSONNames_Thing)(nil), // 6: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.Thing (*NonStandardMessageWithJSONNames_Thing_SubThing)(nil), // 7: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing (*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask } var file_examples_internal_proto_examplepb_non_standard_names_proto_depIdxs = []int32{ 4, // 0: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.thing:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.Thing 0, // 1: grpc.gateway.examples.internal.proto.examplepb.NonStandardUpdateRequest.body:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage 8, // 2: grpc.gateway.examples.internal.proto.examplepb.NonStandardUpdateRequest.update_mask:type_name -> google.protobuf.FieldMask 6, // 3: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.thing:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.Thing 2, // 4: grpc.gateway.examples.internal.proto.examplepb.NonStandardWithJSONNamesUpdateRequest.body:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames 8, // 5: grpc.gateway.examples.internal.proto.examplepb.NonStandardWithJSONNamesUpdateRequest.update_mask:type_name -> google.protobuf.FieldMask 5, // 6: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.Thing.subThing:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage.Thing.SubThing 7, // 7: grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.Thing.subThing:type_name -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing 1, // 8: grpc.gateway.examples.internal.proto.examplepb.NonStandardService.Update:input_type -> grpc.gateway.examples.internal.proto.examplepb.NonStandardUpdateRequest 3, // 9: grpc.gateway.examples.internal.proto.examplepb.NonStandardService.UpdateWithJSONNames:input_type -> grpc.gateway.examples.internal.proto.examplepb.NonStandardWithJSONNamesUpdateRequest 0, // 10: grpc.gateway.examples.internal.proto.examplepb.NonStandardService.Update:output_type -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessage 2, // 11: grpc.gateway.examples.internal.proto.examplepb.NonStandardService.UpdateWithJSONNames:output_type -> grpc.gateway.examples.internal.proto.examplepb.NonStandardMessageWithJSONNames 10, // [10:12] is the sub-list for method output_type 8, // [8:10] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_non_standard_names_proto_init() } func file_examples_internal_proto_examplepb_non_standard_names_proto_init() { if File_examples_internal_proto_examplepb_non_standard_names_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardUpdateRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardWithJSONNamesUpdateRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage_Thing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage_Thing_SubThing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames_Thing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames_Thing_SubThing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_non_standard_names_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_non_standard_names_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_non_standard_names_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_non_standard_names_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_non_standard_names_proto = out.File file_examples_internal_proto_examplepb_non_standard_names_proto_rawDesc = nil file_examples_internal_proto_examplepb_non_standard_names_proto_goTypes = nil file_examples_internal_proto_examplepb_non_standard_names_proto_depIdxs = nil } non_standard_names.pb.gw.go000066400000000000000000000341421465037340600355630ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/non_standard_names.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_NonStandardService_Update_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_NonStandardService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client NonStandardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonStandardUpdateRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_Update_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_NonStandardService_Update_0(ctx context.Context, marshaler runtime.Marshaler, server NonStandardServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonStandardUpdateRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_Update_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Update(ctx, &protoReq) return msg, metadata, err } var ( filter_NonStandardService_UpdateWithJSONNames_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, marshaler runtime.Marshaler, client NonStandardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonStandardWithJSONNamesUpdateRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_UpdateWithJSONNames_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UpdateWithJSONNames(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, marshaler runtime.Marshaler, server NonStandardServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonStandardWithJSONNamesUpdateRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Body); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_UpdateWithJSONNames_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UpdateWithJSONNames(ctx, &protoReq) return msg, metadata, err } // RegisterNonStandardServiceHandlerServer registers the http handlers for service NonStandardService to "mux". // UnaryRPC :call NonStandardServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterNonStandardServiceHandlerFromEndpoint instead. func RegisterNonStandardServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NonStandardServiceServer) error { mux.Handle("PATCH", pattern_NonStandardService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/Update", runtime.WithHTTPPathPattern("/v1/example/non_standard/update")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_NonStandardService_Update_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_NonStandardService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_NonStandardService_UpdateWithJSONNames_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/UpdateWithJSONNames", runtime.WithHTTPPathPattern("/v1/example/non_standard/update_with_json_names")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_NonStandardService_UpdateWithJSONNames_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_NonStandardService_UpdateWithJSONNames_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterNonStandardServiceHandlerFromEndpoint is same as RegisterNonStandardServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterNonStandardServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterNonStandardServiceHandler(ctx, mux, conn) } // RegisterNonStandardServiceHandler registers the http handlers for service NonStandardService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterNonStandardServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterNonStandardServiceHandlerClient(ctx, mux, NewNonStandardServiceClient(conn)) } // RegisterNonStandardServiceHandlerClient registers the http handlers for service NonStandardService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NonStandardServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NonStandardServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "NonStandardServiceClient" to call the correct interceptors. func RegisterNonStandardServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NonStandardServiceClient) error { mux.Handle("PATCH", pattern_NonStandardService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/Update", runtime.WithHTTPPathPattern("/v1/example/non_standard/update")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_NonStandardService_Update_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_NonStandardService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("PATCH", pattern_NonStandardService_UpdateWithJSONNames_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/UpdateWithJSONNames", runtime.WithHTTPPathPattern("/v1/example/non_standard/update_with_json_names")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_NonStandardService_UpdateWithJSONNames_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_NonStandardService_UpdateWithJSONNames_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_NonStandardService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "non_standard", "update"}, "")) pattern_NonStandardService_UpdateWithJSONNames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "non_standard", "update_with_json_names"}, "")) ) var ( forward_NonStandardService_Update_0 = runtime.ForwardResponseMessage forward_NonStandardService_UpdateWithJSONNames_0 = runtime.ForwardResponseMessage ) non_standard_names.proto000066400000000000000000000043471465037340600353110ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // NonStandardMessage has oddly named fields. message NonStandardMessage { // Id represents the message identifier. string id = 1; int64 Num = 2; int64 line_num = 3; string langIdent = 4; string STATUS = 5; int64 en_GB = 6; string no = 7; message Thing { message SubThing { string sub_value = 1; } SubThing subThing = 1; } Thing thing = 8; } message NonStandardUpdateRequest { NonStandardMessage body = 1; google.protobuf.FieldMask update_mask = 2; } // NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. message NonStandardMessageWithJSONNames { // Id represents the message identifier. string id = 1 [json_name = "ID"]; int64 Num = 2 [json_name = "Num"]; int64 line_num = 3 [json_name = "LineNum"]; string langIdent = 4 [json_name = "langIdent"]; string STATUS = 5 [json_name = "status"]; int64 en_GB = 6 [json_name = "En_GB"]; string no = 7 [json_name = "yes"]; message Thing { message SubThing { string sub_value = 1 [json_name = "sub_Value"]; } SubThing subThing = 1 [json_name = "SubThing"]; } Thing thing = 8 [json_name = "Thingy"]; } message NonStandardWithJSONNamesUpdateRequest { NonStandardMessageWithJSONNames body = 1; google.protobuf.FieldMask update_mask = 2; } // NonStandardService responds to incoming messages, applies a field mask and returns the masked response. service NonStandardService { // Apply field mask to empty NonStandardMessage and return result. rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) { option (google.api.http) = { patch: "/v1/example/non_standard/update" body: "body" }; } // Apply field mask to empty NonStandardMessageWithJSONNames and return result. rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) { option (google.api.http) = { patch: "/v1/example/non_standard/update_with_json_names" body: "body" }; } } non_standard_names.swagger.json000066400000000000000000000232601465037340600365500ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/non_standard_names.proto", "version": "version not set" }, "tags": [ { "name": "NonStandardService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/non_standard/update": { "patch": { "summary": "Apply field mask to empty NonStandardMessage and return result.", "operationId": "NonStandardService_Update", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbNonStandardMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonStandardMessage" } } ], "tags": [ "NonStandardService" ] } }, "/v1/example/non_standard/update_with_json_names": { "patch": { "summary": "Apply field mask to empty NonStandardMessageWithJSONNames and return result.", "operationId": "NonStandardService_UpdateWithJSONNames", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNames" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNames" } } ], "tags": [ "NonStandardService" ] } } }, "definitions": { "examplepbNonStandardMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "Num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "langIdent": { "type": "string" }, "STATUS": { "type": "string" }, "enGB": { "type": "string", "format": "int64" }, "no": { "type": "string" }, "thing": { "$ref": "#/definitions/examplepbNonStandardMessageThing" } }, "description": "NonStandardMessage has oddly named fields." }, "examplepbNonStandardMessageThing": { "type": "object", "properties": { "subThing": { "$ref": "#/definitions/examplepbNonStandardMessageThingSubThing" } } }, "examplepbNonStandardMessageThingSubThing": { "type": "object", "properties": { "subValue": { "type": "string" } } }, "examplepbNonStandardMessageWithJSONNames": { "type": "object", "properties": { "ID": { "type": "string", "description": "Id represents the message identifier." }, "Num": { "type": "string", "format": "int64" }, "LineNum": { "type": "string", "format": "int64" }, "langIdent": { "type": "string" }, "status": { "type": "string" }, "En_GB": { "type": "string", "format": "int64" }, "yes": { "type": "string" }, "Thingy": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNamesThing" } }, "description": "NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion." }, "examplepbNonStandardMessageWithJSONNamesThing": { "type": "object", "properties": { "SubThing": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNamesThingSubThing" } } }, "examplepbNonStandardMessageWithJSONNamesThingSubThing": { "type": "object", "properties": { "sub_Value": { "type": "string" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } non_standard_names_grpc.pb.go000066400000000000000000000140421465037340600361570ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/non_standard_names.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // NonStandardServiceClient is the client API for NonStandardService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type NonStandardServiceClient interface { // Apply field mask to empty NonStandardMessage and return result. Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) // Apply field mask to empty NonStandardMessageWithJSONNames and return result. UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) } type nonStandardServiceClient struct { cc grpc.ClientConnInterface } func NewNonStandardServiceClient(cc grpc.ClientConnInterface) NonStandardServiceClient { return &nonStandardServiceClient{cc} } func (c *nonStandardServiceClient) Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) { out := new(NonStandardMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/Update", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *nonStandardServiceClient) UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) { out := new(NonStandardMessageWithJSONNames) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/UpdateWithJSONNames", in, out, opts...) if err != nil { return nil, err } return out, nil } // NonStandardServiceServer is the server API for NonStandardService service. // All implementations should embed UnimplementedNonStandardServiceServer // for forward compatibility type NonStandardServiceServer interface { // Apply field mask to empty NonStandardMessage and return result. Update(context.Context, *NonStandardUpdateRequest) (*NonStandardMessage, error) // Apply field mask to empty NonStandardMessageWithJSONNames and return result. UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) } // UnimplementedNonStandardServiceServer should be embedded to have forward compatible implementations. type UnimplementedNonStandardServiceServer struct { } func (UnimplementedNonStandardServiceServer) Update(context.Context, *NonStandardUpdateRequest) (*NonStandardMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") } func (UnimplementedNonStandardServiceServer) UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateWithJSONNames not implemented") } // UnsafeNonStandardServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NonStandardServiceServer will // result in compilation errors. type UnsafeNonStandardServiceServer interface { mustEmbedUnimplementedNonStandardServiceServer() } func RegisterNonStandardServiceServer(s grpc.ServiceRegistrar, srv NonStandardServiceServer) { s.RegisterService(&NonStandardService_ServiceDesc, srv) } func _NonStandardService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonStandardUpdateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NonStandardServiceServer).Update(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).Update(ctx, req.(*NonStandardUpdateRequest)) } return interceptor(ctx, in, info, handler) } func _NonStandardService_UpdateWithJSONNames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonStandardWithJSONNamesUpdateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.NonStandardService/UpdateWithJSONNames", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, req.(*NonStandardWithJSONNamesUpdateRequest)) } return interceptor(ctx, in, info, handler) } // NonStandardService_ServiceDesc is the grpc.ServiceDesc for NonStandardService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var NonStandardService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.NonStandardService", HandlerType: (*NonStandardServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Update", Handler: _NonStandardService_Update_Handler, }, { MethodName: "UpdateWithJSONNames", Handler: _NonStandardService_UpdateWithJSONNames_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/non_standard_names.proto", } openapi_merge.buf.gen.yaml000066400000000000000000000002401465037340600353740ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - plugin: openapiv2 out: . opt: - allow_merge=true - merge_file_name=examples/internal/proto/examplepb/openapi_merge openapi_merge.swagger.json000066400000000000000000000212061465037340600355230ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "Merging Services", "description": "This is an example of merging two proto files.", "version": "version not set" }, "tags": [ { "name": "ServiceA" }, { "name": "ServiceC" }, { "name": "ServiceB" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/a/1": { "post": { "summary": "ServiceA.MethodOne receives InMessageA and returns OutMessageA", "description": "Here is the detail explanation about ServiceA.MethodOne.", "operationId": "ServiceA_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageA represents a message to ServiceA and ServiceC.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageA" } } ], "tags": [ "ServiceA" ] } }, "/v1/example/a/2": { "post": { "summary": "ServiceA.MethodTwo receives OutMessageA and returns InMessageA", "description": "Here is the detail explanation about ServiceA.MethodTwo.", "operationId": "ServiceA_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageA represents a message returned from ServiceA.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageA" } } ], "tags": [ "ServiceA" ] } }, "/v1/example/b/1": { "post": { "summary": "ServiceB.MethodOne receives InMessageB and returns OutMessageB", "description": "Here is the detail explanation about ServiceB.MethodOne.", "operationId": "ServiceB_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageB" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageB represents a message to ServiceB.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageB" } } ], "tags": [ "ServiceB" ] } }, "/v1/example/b/2": { "post": { "summary": "ServiceB.MethodTwo receives OutMessageB and returns InMessageB", "description": "Here is the detail explanation about ServiceB.MethodTwo.", "operationId": "ServiceB_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageB" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageB represents a message returned from ServiceB.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageB" } } ], "tags": [ "ServiceB" ] } }, "/v1/example/c/1": { "post": { "summary": "ServiceC.MethodOne receives InMessageA and returns OutMessageC", "description": "Here is the detail explanation about ServiceC.MethodOne.", "operationId": "ServiceC_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageC" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageA represents a message to ServiceA and ServiceC.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageA" } } ], "tags": [ "ServiceC" ] } }, "/v1/example/c/2": { "post": { "summary": "ServiceC.MethodTwo receives OutMessageA and returns InMessageA", "description": "Here is the detail explanation about ServiceC.MethodTwo.", "operationId": "ServiceC_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageA represents a message returned from ServiceA.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageA" } } ], "tags": [ "ServiceC" ] } } }, "definitions": { "examplepbInMessageA": { "type": "object", "properties": { "values": { "type": "array", "items": { "type": "string" }, "title": "Here is the explanation about InMessageA.values" } }, "description": "InMessageA represents a message to ServiceA and ServiceC." }, "examplepbInMessageB": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about InMessageB.values" } }, "description": "InMessageB represents a message to ServiceB." }, "examplepbOutMessageA": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about OutMessageA.value" } }, "description": "OutMessageA represents a message returned from ServiceA." }, "examplepbOutMessageB": { "type": "object", "properties": { "values": { "type": "array", "items": { "type": "string" }, "title": "Here is the explanation about OutMessageB.value" } }, "description": "OutMessageB represents a message returned from ServiceB." }, "examplepbOutMessageC": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about OutMessageC.value" } }, "description": "OutMessageC represents a message returned from ServiceC." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } openapi_merge_a.pb.go000066400000000000000000000361471465037340600344330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/openapi_merge_a.proto // Merging Services // // This is an example of merging two proto files. package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // InMessageA represents a message to ServiceA and ServiceC. type InMessageA struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Here is the explanation about InMessageA.values Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` } func (x *InMessageA) Reset() { *x = InMessageA{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *InMessageA) String() string { return protoimpl.X.MessageStringOf(x) } func (*InMessageA) ProtoMessage() {} func (x *InMessageA) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_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 InMessageA.ProtoReflect.Descriptor instead. func (*InMessageA) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescGZIP(), []int{0} } func (x *InMessageA) GetValues() []string { if x != nil { return x.Values } return nil } // OutMessageA represents a message returned from ServiceA. type OutMessageA struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Here is the explanation about OutMessageA.value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } func (x *OutMessageA) Reset() { *x = OutMessageA{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OutMessageA) String() string { return protoimpl.X.MessageStringOf(x) } func (*OutMessageA) ProtoMessage() {} func (x *OutMessageA) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_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 OutMessageA.ProtoReflect.Descriptor instead. func (*OutMessageA) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescGZIP(), []int{1} } func (x *OutMessageA) GetValue() string { if x != nil { return x.Value } return "" } // OutMessageC represents a message returned from ServiceC. type OutMessageC struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Here is the explanation about OutMessageC.value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } func (x *OutMessageC) Reset() { *x = OutMessageC{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OutMessageC) String() string { return protoimpl.X.MessageStringOf(x) } func (*OutMessageC) ProtoMessage() {} func (x *OutMessageC) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_openapi_merge_a_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 OutMessageC.ProtoReflect.Descriptor instead. func (*OutMessageC) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescGZIP(), []int{2} } func (x *OutMessageC) GetValue() string { if x != nil { return x.Value } return "" } var File_examples_internal_proto_examplepb_openapi_merge_a_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDesc = []byte{ 0x0a, 0x37, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x0a, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0xb8, 0x02, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x6e, 0x65, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x1a, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x2f, 0x31, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x54, 0x77, 0x6f, 0x12, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x1a, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x2f, 0x32, 0x32, 0xb8, 0x02, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x6e, 0x65, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x1a, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x63, 0x2f, 0x31, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x54, 0x77, 0x6f, 0x12, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x1a, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x63, 0x2f, 0x32, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescData = file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDesc ) func file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescData) }) return file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDescData } var file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_examples_internal_proto_examplepb_openapi_merge_a_proto_goTypes = []interface{}{ (*InMessageA)(nil), // 0: grpc.gateway.examples.internal.examplepb.InMessageA (*OutMessageA)(nil), // 1: grpc.gateway.examples.internal.examplepb.OutMessageA (*OutMessageC)(nil), // 2: grpc.gateway.examples.internal.examplepb.OutMessageC } var file_examples_internal_proto_examplepb_openapi_merge_a_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.examplepb.ServiceA.MethodOne:input_type -> grpc.gateway.examples.internal.examplepb.InMessageA 1, // 1: grpc.gateway.examples.internal.examplepb.ServiceA.MethodTwo:input_type -> grpc.gateway.examples.internal.examplepb.OutMessageA 0, // 2: grpc.gateway.examples.internal.examplepb.ServiceC.MethodOne:input_type -> grpc.gateway.examples.internal.examplepb.InMessageA 1, // 3: grpc.gateway.examples.internal.examplepb.ServiceC.MethodTwo:input_type -> grpc.gateway.examples.internal.examplepb.OutMessageA 1, // 4: grpc.gateway.examples.internal.examplepb.ServiceA.MethodOne:output_type -> grpc.gateway.examples.internal.examplepb.OutMessageA 0, // 5: grpc.gateway.examples.internal.examplepb.ServiceA.MethodTwo:output_type -> grpc.gateway.examples.internal.examplepb.InMessageA 2, // 6: grpc.gateway.examples.internal.examplepb.ServiceC.MethodOne:output_type -> grpc.gateway.examples.internal.examplepb.OutMessageC 0, // 7: grpc.gateway.examples.internal.examplepb.ServiceC.MethodTwo:output_type -> grpc.gateway.examples.internal.examplepb.InMessageA 4, // [4:8] is the sub-list for method output_type 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_openapi_merge_a_proto_init() } func file_examples_internal_proto_examplepb_openapi_merge_a_proto_init() { if File_examples_internal_proto_examplepb_openapi_merge_a_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InMessageA); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OutMessageA); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OutMessageC); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 2, }, GoTypes: file_examples_internal_proto_examplepb_openapi_merge_a_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_openapi_merge_a_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_openapi_merge_a_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_openapi_merge_a_proto = out.File file_examples_internal_proto_examplepb_openapi_merge_a_proto_rawDesc = nil file_examples_internal_proto_examplepb_openapi_merge_a_proto_goTypes = nil file_examples_internal_proto_examplepb_openapi_merge_a_proto_depIdxs = nil } openapi_merge_a.pb.gw.go000066400000000000000000000462221465037340600350420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/openapi_merge_a.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_ServiceA_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceAClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodOne(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceA_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceAServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodOne(ctx, &protoReq) return msg, metadata, err } func request_ServiceA_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceAClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodTwo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceA_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceAServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodTwo(ctx, &protoReq) return msg, metadata, err } func request_ServiceC_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodOne(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceC_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodOne(ctx, &protoReq) return msg, metadata, err } func request_ServiceC_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodTwo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceC_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageA var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodTwo(ctx, &protoReq) return msg, metadata, err } // RegisterServiceAHandlerServer registers the http handlers for service ServiceA to "mux". // UnaryRPC :call ServiceAServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceAHandlerFromEndpoint instead. func RegisterServiceAHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceAServer) error { mux.Handle("POST", pattern_ServiceA_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodOne", runtime.WithHTTPPathPattern("/v1/example/a/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceA_MethodOne_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceA_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceA_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/a/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceA_MethodTwo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceA_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterServiceCHandlerServer registers the http handlers for service ServiceC to "mux". // UnaryRPC :call ServiceCServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceCHandlerFromEndpoint instead. func RegisterServiceCHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceCServer) error { mux.Handle("POST", pattern_ServiceC_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodOne", runtime.WithHTTPPathPattern("/v1/example/c/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceC_MethodOne_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceC_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceC_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/c/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceC_MethodTwo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceC_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterServiceAHandlerFromEndpoint is same as RegisterServiceAHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterServiceAHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterServiceAHandler(ctx, mux, conn) } // RegisterServiceAHandler registers the http handlers for service ServiceA to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterServiceAHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterServiceAHandlerClient(ctx, mux, NewServiceAClient(conn)) } // RegisterServiceAHandlerClient registers the http handlers for service ServiceA // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceAClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceAClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "ServiceAClient" to call the correct interceptors. func RegisterServiceAHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceAClient) error { mux.Handle("POST", pattern_ServiceA_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodOne", runtime.WithHTTPPathPattern("/v1/example/a/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceA_MethodOne_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceA_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceA_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/a/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceA_MethodTwo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceA_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_ServiceA_MethodOne_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a", "1"}, "")) pattern_ServiceA_MethodTwo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a", "2"}, "")) ) var ( forward_ServiceA_MethodOne_0 = runtime.ForwardResponseMessage forward_ServiceA_MethodTwo_0 = runtime.ForwardResponseMessage ) // RegisterServiceCHandlerFromEndpoint is same as RegisterServiceCHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterServiceCHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterServiceCHandler(ctx, mux, conn) } // RegisterServiceCHandler registers the http handlers for service ServiceC to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterServiceCHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterServiceCHandlerClient(ctx, mux, NewServiceCClient(conn)) } // RegisterServiceCHandlerClient registers the http handlers for service ServiceC // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceCClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceCClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "ServiceCClient" to call the correct interceptors. func RegisterServiceCHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceCClient) error { mux.Handle("POST", pattern_ServiceC_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodOne", runtime.WithHTTPPathPattern("/v1/example/c/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceC_MethodOne_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceC_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceC_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/c/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceC_MethodTwo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceC_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_ServiceC_MethodOne_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "c", "1"}, "")) pattern_ServiceC_MethodTwo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "c", "2"}, "")) ) var ( forward_ServiceC_MethodOne_0 = runtime.ForwardResponseMessage forward_ServiceC_MethodTwo_0 = runtime.ForwardResponseMessage ) openapi_merge_a.proto000066400000000000000000000037451465037340600345670ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Merging Services // // This is an example of merging two proto files. package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // InMessageA represents a message to ServiceA and ServiceC. message InMessageA { // Here is the explanation about InMessageA.values repeated string values = 1; } // OutMessageA represents a message returned from ServiceA. message OutMessageA { // Here is the explanation about OutMessageA.value string value = 1; } // OutMessageC represents a message returned from ServiceC. message OutMessageC { // Here is the explanation about OutMessageC.value string value = 1; } // ServiceA provices MethodOne and MethodTwo service ServiceA { // ServiceA.MethodOne receives InMessageA and returns OutMessageA // // Here is the detail explanation about ServiceA.MethodOne. rpc MethodOne(InMessageA) returns (OutMessageA) { option (google.api.http) = { post: "/v1/example/a/1" body: "*" }; } // ServiceA.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceA.MethodTwo. rpc MethodTwo(OutMessageA) returns (InMessageA) { option (google.api.http) = { post: "/v1/example/a/2" body: "*" }; } } // ServiceC service responds to incoming merge requests. service ServiceC { // ServiceC.MethodOne receives InMessageA and returns OutMessageC // // Here is the detail explanation about ServiceC.MethodOne. rpc MethodOne(InMessageA) returns (OutMessageC) { option (google.api.http) = { post: "/v1/example/c/1" body: "*" }; } // ServiceC.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceC.MethodTwo. rpc MethodTwo(OutMessageA) returns (InMessageA) { option (google.api.http) = { post: "/v1/example/c/2" body: "*" }; } } openapi_merge_a.swagger.json000066400000000000000000000246561465037340600360370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "Merging Services", "description": "This is an example of merging two proto files.", "version": "version not set" }, "tags": [ { "name": "ServiceA" }, { "name": "ServiceC" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/a/1": { "post": { "summary": "ServiceA.MethodOne receives InMessageA and returns OutMessageA", "description": "Here is the detail explanation about ServiceA.MethodOne.", "operationId": "ServiceA_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageA represents a message to ServiceA and ServiceC.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageA" } } ], "tags": [ "ServiceA" ] } }, "/v1/example/a/2": { "post": { "summary": "ServiceA.MethodTwo receives OutMessageA and returns InMessageA", "description": "Here is the detail explanation about ServiceA.MethodTwo.", "operationId": "ServiceA_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageA represents a message returned from ServiceA.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageA" } } ], "tags": [ "ServiceA" ] } }, "/v1/example/c/1": { "post": { "summary": "ServiceC.MethodOne receives InMessageA and returns OutMessageC", "description": "Here is the detail explanation about ServiceC.MethodOne.", "operationId": "ServiceC_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageC" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageA represents a message to ServiceA and ServiceC.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageA" } } ], "tags": [ "ServiceC" ] } }, "/v1/example/c/2": { "post": { "summary": "ServiceC.MethodTwo receives OutMessageA and returns InMessageA", "description": "Here is the detail explanation about ServiceC.MethodTwo.", "operationId": "ServiceC_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageA" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageA represents a message returned from ServiceA.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageA" } } ], "tags": [ "ServiceC" ] } } }, "definitions": { "examplepbInMessageA": { "type": "object", "properties": { "values": { "type": "array", "items": { "type": "string" }, "title": "Here is the explanation about InMessageA.values" } }, "description": "InMessageA represents a message to ServiceA and ServiceC." }, "examplepbOutMessageA": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about OutMessageA.value" } }, "description": "OutMessageA represents a message returned from ServiceA." }, "examplepbOutMessageC": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about OutMessageC.value" } }, "description": "OutMessageC represents a message returned from ServiceC." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } openapi_merge_a_grpc.pb.go000066400000000000000000000242631465037340600354420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/openapi_merge_a.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // ServiceAClient is the client API for ServiceA service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ServiceAClient interface { // ServiceA.MethodOne receives InMessageA and returns OutMessageA // // Here is the detail explanation about ServiceA.MethodOne. MethodOne(ctx context.Context, in *InMessageA, opts ...grpc.CallOption) (*OutMessageA, error) // ServiceA.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceA.MethodTwo. MethodTwo(ctx context.Context, in *OutMessageA, opts ...grpc.CallOption) (*InMessageA, error) } type serviceAClient struct { cc grpc.ClientConnInterface } func NewServiceAClient(cc grpc.ClientConnInterface) ServiceAClient { return &serviceAClient{cc} } func (c *serviceAClient) MethodOne(ctx context.Context, in *InMessageA, opts ...grpc.CallOption) (*OutMessageA, error) { out := new(OutMessageA) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodOne", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *serviceAClient) MethodTwo(ctx context.Context, in *OutMessageA, opts ...grpc.CallOption) (*InMessageA, error) { out := new(InMessageA) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodTwo", in, out, opts...) if err != nil { return nil, err } return out, nil } // ServiceAServer is the server API for ServiceA service. // All implementations should embed UnimplementedServiceAServer // for forward compatibility type ServiceAServer interface { // ServiceA.MethodOne receives InMessageA and returns OutMessageA // // Here is the detail explanation about ServiceA.MethodOne. MethodOne(context.Context, *InMessageA) (*OutMessageA, error) // ServiceA.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceA.MethodTwo. MethodTwo(context.Context, *OutMessageA) (*InMessageA, error) } // UnimplementedServiceAServer should be embedded to have forward compatible implementations. type UnimplementedServiceAServer struct { } func (UnimplementedServiceAServer) MethodOne(context.Context, *InMessageA) (*OutMessageA, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodOne not implemented") } func (UnimplementedServiceAServer) MethodTwo(context.Context, *OutMessageA) (*InMessageA, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodTwo not implemented") } // UnsafeServiceAServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServiceAServer will // result in compilation errors. type UnsafeServiceAServer interface { mustEmbedUnimplementedServiceAServer() } func RegisterServiceAServer(s grpc.ServiceRegistrar, srv ServiceAServer) { s.RegisterService(&ServiceA_ServiceDesc, srv) } func _ServiceA_MethodOne_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InMessageA) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceAServer).MethodOne(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodOne", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceAServer).MethodOne(ctx, req.(*InMessageA)) } return interceptor(ctx, in, info, handler) } func _ServiceA_MethodTwo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OutMessageA) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceAServer).MethodTwo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceA/MethodTwo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceAServer).MethodTwo(ctx, req.(*OutMessageA)) } return interceptor(ctx, in, info, handler) } // ServiceA_ServiceDesc is the grpc.ServiceDesc for ServiceA service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ServiceA_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.examplepb.ServiceA", HandlerType: (*ServiceAServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "MethodOne", Handler: _ServiceA_MethodOne_Handler, }, { MethodName: "MethodTwo", Handler: _ServiceA_MethodTwo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/openapi_merge_a.proto", } // ServiceCClient is the client API for ServiceC service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ServiceCClient interface { // ServiceC.MethodOne receives InMessageA and returns OutMessageC // // Here is the detail explanation about ServiceC.MethodOne. MethodOne(ctx context.Context, in *InMessageA, opts ...grpc.CallOption) (*OutMessageC, error) // ServiceC.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceC.MethodTwo. MethodTwo(ctx context.Context, in *OutMessageA, opts ...grpc.CallOption) (*InMessageA, error) } type serviceCClient struct { cc grpc.ClientConnInterface } func NewServiceCClient(cc grpc.ClientConnInterface) ServiceCClient { return &serviceCClient{cc} } func (c *serviceCClient) MethodOne(ctx context.Context, in *InMessageA, opts ...grpc.CallOption) (*OutMessageC, error) { out := new(OutMessageC) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodOne", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *serviceCClient) MethodTwo(ctx context.Context, in *OutMessageA, opts ...grpc.CallOption) (*InMessageA, error) { out := new(InMessageA) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodTwo", in, out, opts...) if err != nil { return nil, err } return out, nil } // ServiceCServer is the server API for ServiceC service. // All implementations should embed UnimplementedServiceCServer // for forward compatibility type ServiceCServer interface { // ServiceC.MethodOne receives InMessageA and returns OutMessageC // // Here is the detail explanation about ServiceC.MethodOne. MethodOne(context.Context, *InMessageA) (*OutMessageC, error) // ServiceC.MethodTwo receives OutMessageA and returns InMessageA // // Here is the detail explanation about ServiceC.MethodTwo. MethodTwo(context.Context, *OutMessageA) (*InMessageA, error) } // UnimplementedServiceCServer should be embedded to have forward compatible implementations. type UnimplementedServiceCServer struct { } func (UnimplementedServiceCServer) MethodOne(context.Context, *InMessageA) (*OutMessageC, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodOne not implemented") } func (UnimplementedServiceCServer) MethodTwo(context.Context, *OutMessageA) (*InMessageA, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodTwo not implemented") } // UnsafeServiceCServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServiceCServer will // result in compilation errors. type UnsafeServiceCServer interface { mustEmbedUnimplementedServiceCServer() } func RegisterServiceCServer(s grpc.ServiceRegistrar, srv ServiceCServer) { s.RegisterService(&ServiceC_ServiceDesc, srv) } func _ServiceC_MethodOne_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InMessageA) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceCServer).MethodOne(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodOne", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceCServer).MethodOne(ctx, req.(*InMessageA)) } return interceptor(ctx, in, info, handler) } func _ServiceC_MethodTwo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OutMessageA) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceCServer).MethodTwo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceC/MethodTwo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceCServer).MethodTwo(ctx, req.(*OutMessageA)) } return interceptor(ctx, in, info, handler) } // ServiceC_ServiceDesc is the grpc.ServiceDesc for ServiceC service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ServiceC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.examplepb.ServiceC", HandlerType: (*ServiceCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "MethodOne", Handler: _ServiceC_MethodOne_Handler, }, { MethodName: "MethodTwo", Handler: _ServiceC_MethodTwo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/openapi_merge_a.proto", } openapi_merge_b.pb.go000066400000000000000000000254201465037340600344240ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/openapi_merge_b.proto // Merging Services // // This is an example of merging two proto files. package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // InMessageB represents a message to ServiceB. type InMessageB struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Here is the explanation about InMessageB.values Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } func (x *InMessageB) Reset() { *x = InMessageB{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *InMessageB) String() string { return protoimpl.X.MessageStringOf(x) } func (*InMessageB) ProtoMessage() {} func (x *InMessageB) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_openapi_merge_b_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 InMessageB.ProtoReflect.Descriptor instead. func (*InMessageB) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescGZIP(), []int{0} } func (x *InMessageB) GetValue() string { if x != nil { return x.Value } return "" } // OutMessageB represents a message returned from ServiceB. type OutMessageB struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Here is the explanation about OutMessageB.value Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` } func (x *OutMessageB) Reset() { *x = OutMessageB{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OutMessageB) String() string { return protoimpl.X.MessageStringOf(x) } func (*OutMessageB) ProtoMessage() {} func (x *OutMessageB) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_openapi_merge_b_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 OutMessageB.ProtoReflect.Descriptor instead. func (*OutMessageB) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescGZIP(), []int{1} } func (x *OutMessageB) GetValues() []string { if x != nil { return x.Values } return nil } var File_examples_internal_proto_examplepb_openapi_merge_b_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDesc = []byte{ 0x0a, 0x37, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x25, 0x0a, 0x0b, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x32, 0xb8, 0x02, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x6e, 0x65, 0x12, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x1a, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x62, 0x2f, 0x31, 0x12, 0x94, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x54, 0x77, 0x6f, 0x12, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x1a, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x62, 0x2f, 0x32, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescData = file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDesc ) func file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescData) }) return file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDescData } var file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_examples_internal_proto_examplepb_openapi_merge_b_proto_goTypes = []interface{}{ (*InMessageB)(nil), // 0: grpc.gateway.examples.internal.examplepb.InMessageB (*OutMessageB)(nil), // 1: grpc.gateway.examples.internal.examplepb.OutMessageB } var file_examples_internal_proto_examplepb_openapi_merge_b_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.examplepb.ServiceB.MethodOne:input_type -> grpc.gateway.examples.internal.examplepb.InMessageB 1, // 1: grpc.gateway.examples.internal.examplepb.ServiceB.MethodTwo:input_type -> grpc.gateway.examples.internal.examplepb.OutMessageB 1, // 2: grpc.gateway.examples.internal.examplepb.ServiceB.MethodOne:output_type -> grpc.gateway.examples.internal.examplepb.OutMessageB 0, // 3: grpc.gateway.examples.internal.examplepb.ServiceB.MethodTwo:output_type -> grpc.gateway.examples.internal.examplepb.InMessageB 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_openapi_merge_b_proto_init() } func file_examples_internal_proto_examplepb_openapi_merge_b_proto_init() { if File_examples_internal_proto_examplepb_openapi_merge_b_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InMessageB); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OutMessageB); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_openapi_merge_b_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_openapi_merge_b_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_openapi_merge_b_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_openapi_merge_b_proto = out.File file_examples_internal_proto_examplepb_openapi_merge_b_proto_rawDesc = nil file_examples_internal_proto_examplepb_openapi_merge_b_proto_goTypes = nil file_examples_internal_proto_examplepb_openapi_merge_b_proto_depIdxs = nil } openapi_merge_b.pb.gw.go000066400000000000000000000237021465037340600350410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/openapi_merge_b.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_ServiceB_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceBClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageB var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodOne(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceB_MethodOne_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceBServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq InMessageB var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodOne(ctx, &protoReq) return msg, metadata, err } func request_ServiceB_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceBClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageB var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.MethodTwo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ServiceB_MethodTwo_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceBServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq OutMessageB var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.MethodTwo(ctx, &protoReq) return msg, metadata, err } // RegisterServiceBHandlerServer registers the http handlers for service ServiceB to "mux". // UnaryRPC :call ServiceBServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceBHandlerFromEndpoint instead. func RegisterServiceBHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceBServer) error { mux.Handle("POST", pattern_ServiceB_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodOne", runtime.WithHTTPPathPattern("/v1/example/b/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceB_MethodOne_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceB_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceB_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/b/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ServiceB_MethodTwo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceB_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterServiceBHandlerFromEndpoint is same as RegisterServiceBHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterServiceBHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterServiceBHandler(ctx, mux, conn) } // RegisterServiceBHandler registers the http handlers for service ServiceB to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterServiceBHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterServiceBHandlerClient(ctx, mux, NewServiceBClient(conn)) } // RegisterServiceBHandlerClient registers the http handlers for service ServiceB // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceBClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceBClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "ServiceBClient" to call the correct interceptors. func RegisterServiceBHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceBClient) error { mux.Handle("POST", pattern_ServiceB_MethodOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodOne", runtime.WithHTTPPathPattern("/v1/example/b/1")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceB_MethodOne_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceB_MethodOne_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_ServiceB_MethodTwo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodTwo", runtime.WithHTTPPathPattern("/v1/example/b/2")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ServiceB_MethodTwo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ServiceB_MethodTwo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_ServiceB_MethodOne_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "b", "1"}, "")) pattern_ServiceB_MethodTwo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "b", "2"}, "")) ) var ( forward_ServiceB_MethodOne_0 = runtime.ForwardResponseMessage forward_ServiceB_MethodTwo_0 = runtime.ForwardResponseMessage ) openapi_merge_b.proto000066400000000000000000000023151465037340600345600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Merging Services // // This is an example of merging two proto files. package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // InMessageB represents a message to ServiceB. message InMessageB { // Here is the explanation about InMessageB.values string value = 1; } // OutMessageB represents a message returned from ServiceB. message OutMessageB { // Here is the explanation about OutMessageB.value repeated string values = 1; } // ServiceB service responds to incoming merge requests. service ServiceB { // ServiceB.MethodOne receives InMessageB and returns OutMessageB // // Here is the detail explanation about ServiceB.MethodOne. rpc MethodOne(InMessageB) returns (OutMessageB) { option (google.api.http) = { post: "/v1/example/b/1" body: "*" }; } // ServiceB.MethodTwo receives OutMessageB and returns InMessageB // // Here is the detail explanation about ServiceB.MethodTwo. rpc MethodTwo(OutMessageB) returns (InMessageB) { option (google.api.http) = { post: "/v1/example/b/2" body: "*" }; } } openapi_merge_b.swagger.json000066400000000000000000000200411465037340600360200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "Merging Services", "description": "This is an example of merging two proto files.", "version": "version not set" }, "tags": [ { "name": "ServiceB" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/b/1": { "post": { "summary": "ServiceB.MethodOne receives InMessageB and returns OutMessageB", "description": "Here is the detail explanation about ServiceB.MethodOne.", "operationId": "ServiceB_MethodOne", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbOutMessageB" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "InMessageB represents a message to ServiceB.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbInMessageB" } } ], "tags": [ "ServiceB" ] } }, "/v1/example/b/2": { "post": { "summary": "ServiceB.MethodTwo receives OutMessageB and returns InMessageB", "description": "Here is the detail explanation about ServiceB.MethodTwo.", "operationId": "ServiceB_MethodTwo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbInMessageB" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "OutMessageB represents a message returned from ServiceB.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbOutMessageB" } } ], "tags": [ "ServiceB" ] } } }, "definitions": { "examplepbInMessageB": { "type": "object", "properties": { "value": { "type": "string", "title": "Here is the explanation about InMessageB.values" } }, "description": "InMessageB represents a message to ServiceB." }, "examplepbOutMessageB": { "type": "object", "properties": { "values": { "type": "array", "items": { "type": "string" }, "title": "Here is the explanation about OutMessageB.value" } }, "description": "OutMessageB represents a message returned from ServiceB." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } openapi_merge_b_grpc.pb.go000066400000000000000000000125721465037340600354430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/openapi_merge_b.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // ServiceBClient is the client API for ServiceB service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ServiceBClient interface { // ServiceB.MethodOne receives InMessageB and returns OutMessageB // // Here is the detail explanation about ServiceB.MethodOne. MethodOne(ctx context.Context, in *InMessageB, opts ...grpc.CallOption) (*OutMessageB, error) // ServiceB.MethodTwo receives OutMessageB and returns InMessageB // // Here is the detail explanation about ServiceB.MethodTwo. MethodTwo(ctx context.Context, in *OutMessageB, opts ...grpc.CallOption) (*InMessageB, error) } type serviceBClient struct { cc grpc.ClientConnInterface } func NewServiceBClient(cc grpc.ClientConnInterface) ServiceBClient { return &serviceBClient{cc} } func (c *serviceBClient) MethodOne(ctx context.Context, in *InMessageB, opts ...grpc.CallOption) (*OutMessageB, error) { out := new(OutMessageB) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodOne", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *serviceBClient) MethodTwo(ctx context.Context, in *OutMessageB, opts ...grpc.CallOption) (*InMessageB, error) { out := new(InMessageB) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodTwo", in, out, opts...) if err != nil { return nil, err } return out, nil } // ServiceBServer is the server API for ServiceB service. // All implementations should embed UnimplementedServiceBServer // for forward compatibility type ServiceBServer interface { // ServiceB.MethodOne receives InMessageB and returns OutMessageB // // Here is the detail explanation about ServiceB.MethodOne. MethodOne(context.Context, *InMessageB) (*OutMessageB, error) // ServiceB.MethodTwo receives OutMessageB and returns InMessageB // // Here is the detail explanation about ServiceB.MethodTwo. MethodTwo(context.Context, *OutMessageB) (*InMessageB, error) } // UnimplementedServiceBServer should be embedded to have forward compatible implementations. type UnimplementedServiceBServer struct { } func (UnimplementedServiceBServer) MethodOne(context.Context, *InMessageB) (*OutMessageB, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodOne not implemented") } func (UnimplementedServiceBServer) MethodTwo(context.Context, *OutMessageB) (*InMessageB, error) { return nil, status.Errorf(codes.Unimplemented, "method MethodTwo not implemented") } // UnsafeServiceBServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServiceBServer will // result in compilation errors. type UnsafeServiceBServer interface { mustEmbedUnimplementedServiceBServer() } func RegisterServiceBServer(s grpc.ServiceRegistrar, srv ServiceBServer) { s.RegisterService(&ServiceB_ServiceDesc, srv) } func _ServiceB_MethodOne_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InMessageB) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceBServer).MethodOne(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodOne", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceBServer).MethodOne(ctx, req.(*InMessageB)) } return interceptor(ctx, in, info, handler) } func _ServiceB_MethodTwo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OutMessageB) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ServiceBServer).MethodTwo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.examplepb.ServiceB/MethodTwo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceBServer).MethodTwo(ctx, req.(*OutMessageB)) } return interceptor(ctx, in, info, handler) } // ServiceB_ServiceDesc is the grpc.ServiceDesc for ServiceB service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ServiceB_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.examplepb.ServiceB", HandlerType: (*ServiceBServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "MethodOne", Handler: _ServiceB_MethodOne_Handler, }, { MethodName: "MethodTwo", Handler: _ServiceB_MethodTwo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/openapi_merge_b.proto", } remove_internal_comment.buf.gen.yaml000066400000000000000000000001431465037340600374770ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - remove_internal_comments=true remove_internal_comment.pb.go000066400000000000000000000242721465037340600362300ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/remove_internal_comment.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // Foo2Request (-- This comment should be excluded from OpenAPI output --) type Foo2Request struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Username. // (-- This comment should be excluded // from OpenAPI output --) // Same row, single line break doesn't count on markdown. Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // Password. // (-- This comment should be excluded // from OpenAPI output --) // // New row. Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` } func (x *Foo2Request) Reset() { *x = Foo2Request{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Foo2Request) String() string { return protoimpl.X.MessageStringOf(x) } func (*Foo2Request) ProtoMessage() {} func (x *Foo2Request) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_remove_internal_comment_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 Foo2Request.ProtoReflect.Descriptor instead. func (*Foo2Request) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescGZIP(), []int{0} } func (x *Foo2Request) GetUsername() string { if x != nil { return x.Username } return "" } func (x *Foo2Request) GetPassword() string { if x != nil { return x.Password } return "" } // (-- This comment should be excluded from OpenAPI output --) type Foo2Reply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *Foo2Reply) Reset() { *x = Foo2Reply{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Foo2Reply) String() string { return protoimpl.X.MessageStringOf(x) } func (*Foo2Reply) ProtoMessage() {} func (x *Foo2Reply) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_remove_internal_comment_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 Foo2Reply.ProtoReflect.Descriptor instead. func (*Foo2Reply) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescGZIP(), []int{1} } var File_examples_internal_proto_examplepb_remove_internal_comment_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDesc = []byte{ 0x0a, 0x3f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x0b, 0x46, 0x6f, 0x6f, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x0b, 0x0a, 0x09, 0x46, 0x6f, 0x6f, 0x32, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x32, 0xaa, 0x01, 0x0a, 0x0b, 0x46, 0x6f, 0x6f, 0x32, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9a, 0x01, 0x0a, 0x04, 0x46, 0x6f, 0x6f, 0x32, 0x12, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x32, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x66, 0x6f, 0x6f, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescData = file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDesc ) func file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescData) }) return file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDescData } var file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_examples_internal_proto_examplepb_remove_internal_comment_proto_goTypes = []interface{}{ (*Foo2Request)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.Foo2Request (*Foo2Reply)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.Foo2Reply } var file_examples_internal_proto_examplepb_remove_internal_comment_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.examplepb.Foo2Service.Foo2:input_type -> grpc.gateway.examples.internal.proto.examplepb.Foo2Request 1, // 1: grpc.gateway.examples.internal.proto.examplepb.Foo2Service.Foo2:output_type -> grpc.gateway.examples.internal.proto.examplepb.Foo2Reply 1, // [1:2] is the sub-list for method output_type 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_remove_internal_comment_proto_init() } func file_examples_internal_proto_examplepb_remove_internal_comment_proto_init() { if File_examples_internal_proto_examplepb_remove_internal_comment_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Foo2Request); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Foo2Reply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_remove_internal_comment_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_remove_internal_comment_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_remove_internal_comment_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_remove_internal_comment_proto = out.File file_examples_internal_proto_examplepb_remove_internal_comment_proto_rawDesc = nil file_examples_internal_proto_examplepb_remove_internal_comment_proto_goTypes = nil file_examples_internal_proto_examplepb_remove_internal_comment_proto_depIdxs = nil } remove_internal_comment.pb.gw.go000066400000000000000000000147401465037340600366430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/remove_internal_comment.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_Foo2Service_Foo2_0(ctx context.Context, marshaler runtime.Marshaler, client Foo2ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Foo2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Foo2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Foo2Service_Foo2_0(ctx context.Context, marshaler runtime.Marshaler, server Foo2ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Foo2Request var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Foo2(ctx, &protoReq) return msg, metadata, err } // RegisterFoo2ServiceHandlerServer registers the http handlers for service Foo2Service to "mux". // UnaryRPC :call Foo2ServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFoo2ServiceHandlerFromEndpoint instead. func RegisterFoo2ServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server Foo2ServiceServer) error { mux.Handle("POST", pattern_Foo2Service_Foo2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Foo2Service/Foo2", runtime.WithHTTPPathPattern("/v1/example/foo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Foo2Service_Foo2_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Foo2Service_Foo2_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterFoo2ServiceHandlerFromEndpoint is same as RegisterFoo2ServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterFoo2ServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterFoo2ServiceHandler(ctx, mux, conn) } // RegisterFoo2ServiceHandler registers the http handlers for service Foo2Service to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterFoo2ServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterFoo2ServiceHandlerClient(ctx, mux, NewFoo2ServiceClient(conn)) } // RegisterFoo2ServiceHandlerClient registers the http handlers for service Foo2Service // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "Foo2ServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "Foo2ServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "Foo2ServiceClient" to call the correct interceptors. func RegisterFoo2ServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client Foo2ServiceClient) error { mux.Handle("POST", pattern_Foo2Service_Foo2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.Foo2Service/Foo2", runtime.WithHTTPPathPattern("/v1/example/foo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Foo2Service_Foo2_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_Foo2Service_Foo2_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_Foo2Service_Foo2_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "foo"}, "")) ) var ( forward_Foo2Service_Foo2_0 = runtime.ForwardResponseMessage ) remove_internal_comment.proto000066400000000000000000000021101465037340600363510ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // Foo2Service (-- This comment should be excluded from OpenAPI output --) service Foo2Service { // Foo Summary (-- This comment should be excluded from OpenAPI output --) // // (-- This comment should be excluded from OpenAPI output --) // Description rpc Foo2(Foo2Request) returns (Foo2Reply) { option (google.api.http) = { post: "/v1/example/foo" body: "*" }; } } // Foo2Request (-- This comment should be excluded from OpenAPI output --) message Foo2Request { // Username. // (-- This comment should be excluded // from OpenAPI output --) // Same row, single line break doesn't count on markdown. string username = 1; // Password. // (-- This comment should be excluded // from OpenAPI output --) // // New row. string password = 2; } // (-- This comment should be excluded from OpenAPI output --) message Foo2Reply {} remove_internal_comment.swagger.json000066400000000000000000000042341465037340600376260ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/remove_internal_comment.proto", "version": "version not set" }, "tags": [ { "name": "Foo2Service" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/foo": { "post": { "summary": "Foo Summary", "description": "Description", "operationId": "Foo2Service_Foo2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbFoo2Reply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbFoo2Request" } } ], "tags": [ "Foo2Service" ] } } }, "definitions": { "examplepbFoo2Reply": { "type": "object" }, "examplepbFoo2Request": { "type": "object", "properties": { "username": { "type": "string", "description": "Username.\nSame row, single line break doesn't count on markdown." }, "password": { "type": "string", "description": "Password.\n\nNew row." } }, "title": "Foo2Request" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } remove_internal_comment_grpc.pb.go000066400000000000000000000076151465037340600372450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/remove_internal_comment.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // Foo2ServiceClient is the client API for Foo2Service service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type Foo2ServiceClient interface { // Foo Summary (-- This comment should be excluded from OpenAPI output --) // // (-- This comment should be excluded from OpenAPI output --) // Description Foo2(ctx context.Context, in *Foo2Request, opts ...grpc.CallOption) (*Foo2Reply, error) } type foo2ServiceClient struct { cc grpc.ClientConnInterface } func NewFoo2ServiceClient(cc grpc.ClientConnInterface) Foo2ServiceClient { return &foo2ServiceClient{cc} } func (c *foo2ServiceClient) Foo2(ctx context.Context, in *Foo2Request, opts ...grpc.CallOption) (*Foo2Reply, error) { out := new(Foo2Reply) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.Foo2Service/Foo2", in, out, opts...) if err != nil { return nil, err } return out, nil } // Foo2ServiceServer is the server API for Foo2Service service. // All implementations should embed UnimplementedFoo2ServiceServer // for forward compatibility type Foo2ServiceServer interface { // Foo Summary (-- This comment should be excluded from OpenAPI output --) // // (-- This comment should be excluded from OpenAPI output --) // Description Foo2(context.Context, *Foo2Request) (*Foo2Reply, error) } // UnimplementedFoo2ServiceServer should be embedded to have forward compatible implementations. type UnimplementedFoo2ServiceServer struct { } func (UnimplementedFoo2ServiceServer) Foo2(context.Context, *Foo2Request) (*Foo2Reply, error) { return nil, status.Errorf(codes.Unimplemented, "method Foo2 not implemented") } // UnsafeFoo2ServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to Foo2ServiceServer will // result in compilation errors. type UnsafeFoo2ServiceServer interface { mustEmbedUnimplementedFoo2ServiceServer() } func RegisterFoo2ServiceServer(s grpc.ServiceRegistrar, srv Foo2ServiceServer) { s.RegisterService(&Foo2Service_ServiceDesc, srv) } func _Foo2Service_Foo2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Foo2Request) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(Foo2ServiceServer).Foo2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.Foo2Service/Foo2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(Foo2ServiceServer).Foo2(ctx, req.(*Foo2Request)) } return interceptor(ctx, in, info, handler) } // Foo2Service_ServiceDesc is the grpc.ServiceDesc for Foo2Service service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Foo2Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.Foo2Service", HandlerType: (*Foo2ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Foo2", Handler: _Foo2Service_Foo2_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/remove_internal_comment.proto", } response_body_service.pb.go000066400000000000000000000702011465037340600357010ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/response_body_service.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 RepeatedResponseBodyOut_Response_ResponseType int32 const ( // UNKNOWN RepeatedResponseBodyOut_Response_UNKNOWN RepeatedResponseBodyOut_Response_ResponseType = 0 // A is 1 RepeatedResponseBodyOut_Response_A RepeatedResponseBodyOut_Response_ResponseType = 1 // B is 2 RepeatedResponseBodyOut_Response_B RepeatedResponseBodyOut_Response_ResponseType = 2 ) // Enum value maps for RepeatedResponseBodyOut_Response_ResponseType. var ( RepeatedResponseBodyOut_Response_ResponseType_name = map[int32]string{ 0: "UNKNOWN", 1: "A", 2: "B", } RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ "UNKNOWN": 0, "A": 1, "B": 2, } ) func (x RepeatedResponseBodyOut_Response_ResponseType) Enum() *RepeatedResponseBodyOut_Response_ResponseType { p := new(RepeatedResponseBodyOut_Response_ResponseType) *p = x return p } func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (RepeatedResponseBodyOut_Response_ResponseType) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_response_body_service_proto_enumTypes[0].Descriptor() } func (RepeatedResponseBodyOut_Response_ResponseType) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_response_body_service_proto_enumTypes[0] } func (x RepeatedResponseBodyOut_Response_ResponseType) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use RepeatedResponseBodyOut_Response_ResponseType.Descriptor instead. func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{2, 0, 0} } type ResponseBodyIn struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (x *ResponseBodyIn) Reset() { *x = ResponseBodyIn{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ResponseBodyIn) String() string { return protoimpl.X.MessageStringOf(x) } func (*ResponseBodyIn) ProtoMessage() {} func (x *ResponseBodyIn) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 ResponseBodyIn.ProtoReflect.Descriptor instead. func (*ResponseBodyIn) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{0} } func (x *ResponseBodyIn) GetData() string { if x != nil { return x.Data } return "" } type ResponseBodyOut struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` } func (x *ResponseBodyOut) Reset() { *x = ResponseBodyOut{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ResponseBodyOut) String() string { return protoimpl.X.MessageStringOf(x) } func (*ResponseBodyOut) ProtoMessage() {} func (x *ResponseBodyOut) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 ResponseBodyOut.ProtoReflect.Descriptor instead. func (*ResponseBodyOut) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{1} } func (x *ResponseBodyOut) GetResponse() *ResponseBodyOut_Response { if x != nil { return x.Response } return nil } type RepeatedResponseBodyOut struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Response []*RepeatedResponseBodyOut_Response `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"` } func (x *RepeatedResponseBodyOut) Reset() { *x = RepeatedResponseBodyOut{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RepeatedResponseBodyOut) String() string { return protoimpl.X.MessageStringOf(x) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (x *RepeatedResponseBodyOut) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 RepeatedResponseBodyOut.ProtoReflect.Descriptor instead. func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{2} } func (x *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Response { if x != nil { return x.Response } return nil } type RepeatedResponseStrings struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` } func (x *RepeatedResponseStrings) Reset() { *x = RepeatedResponseStrings{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RepeatedResponseStrings) String() string { return protoimpl.X.MessageStringOf(x) } func (*RepeatedResponseStrings) ProtoMessage() {} func (x *RepeatedResponseStrings) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 RepeatedResponseStrings.ProtoReflect.Descriptor instead. func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{3} } func (x *RepeatedResponseStrings) GetValues() []string { if x != nil { return x.Values } return nil } type ResponseBodyOut_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (x *ResponseBodyOut_Response) Reset() { *x = ResponseBodyOut_Response{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ResponseBodyOut_Response) String() string { return protoimpl.X.MessageStringOf(x) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (x *ResponseBodyOut_Response) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 ResponseBodyOut_Response.ProtoReflect.Descriptor instead. func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{1, 0} } func (x *ResponseBodyOut_Response) GetData() string { if x != nil { return x.Data } return "" } type RepeatedResponseBodyOut_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` } func (x *RepeatedResponseBodyOut_Response) Reset() { *x = RepeatedResponseBodyOut_Response{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RepeatedResponseBodyOut_Response) String() string { return protoimpl.X.MessageStringOf(x) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (x *RepeatedResponseBodyOut_Response) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_response_body_service_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 RepeatedResponseBodyOut_Response.ProtoReflect.Descriptor instead. func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP(), []int{2, 0} } func (x *RepeatedResponseBodyOut_Response) GetData() string { if x != nil { return x.Data } return "" } func (x *RepeatedResponseBodyOut_Response) GetType() RepeatedResponseBodyOut_Response_ResponseType { if x != nil { return x.Type } return RepeatedResponseBodyOut_Response_UNKNOWN } var File_examples_internal_proto_examplepb_response_body_service_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_response_body_service_proto_rawDesc = []byte{ 0x0a, 0x3d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x49, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x97, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x12, 0x64, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc6, 0x02, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x12, 0x6c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0xbc, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x71, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x5d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x29, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x22, 0x31, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x32, 0xb2, 0x06, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xba, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x49, 0x6e, 0x1a, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x62, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x12, 0xc7, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x12, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x49, 0x6e, 0x1a, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x62, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x12, 0xc7, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x49, 0x6e, 0x1a, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x62, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x12, 0xc9, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x49, 0x6e, 0x1a, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x62, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x6f, 0x64, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x30, 0x01, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_response_body_service_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_response_body_service_proto_rawDescData = file_examples_internal_proto_examplepb_response_body_service_proto_rawDesc ) func file_examples_internal_proto_examplepb_response_body_service_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_response_body_service_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_response_body_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_response_body_service_proto_rawDescData) }) return file_examples_internal_proto_examplepb_response_body_service_proto_rawDescData } var file_examples_internal_proto_examplepb_response_body_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_examples_internal_proto_examplepb_response_body_service_proto_goTypes = []interface{}{ (RepeatedResponseBodyOut_Response_ResponseType)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.Response.ResponseType (*ResponseBodyIn)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyIn (*ResponseBodyOut)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut (*RepeatedResponseBodyOut)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut (*RepeatedResponseStrings)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseStrings (*ResponseBodyOut_Response)(nil), // 5: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut.Response (*RepeatedResponseBodyOut_Response)(nil), // 6: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.Response } var file_examples_internal_proto_examplepb_response_body_service_proto_depIdxs = []int32{ 5, // 0: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut.response:type_name -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut.Response 6, // 1: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.response:type_name -> grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.Response 0, // 2: grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.Response.type:type_name -> grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut.Response.ResponseType 1, // 3: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.GetResponseBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyIn 1, // 4: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.ListResponseBodies:input_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyIn 1, // 5: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.ListResponseStrings:input_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyIn 1, // 6: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.GetResponseBodyStream:input_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyIn 2, // 7: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.GetResponseBody:output_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut 3, // 8: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.ListResponseBodies:output_type -> grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseBodyOut 4, // 9: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.ListResponseStrings:output_type -> grpc.gateway.examples.internal.proto.examplepb.RepeatedResponseStrings 2, // 10: grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService.GetResponseBodyStream:output_type -> grpc.gateway.examples.internal.proto.examplepb.ResponseBodyOut 7, // [7:11] is the sub-list for method output_type 3, // [3:7] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_response_body_service_proto_init() } func file_examples_internal_proto_examplepb_response_body_service_proto_init() { if File_examples_internal_proto_examplepb_response_body_service_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseBodyIn); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseBodyOut); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepeatedResponseBodyOut); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepeatedResponseStrings); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseBodyOut_Response); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepeatedResponseBodyOut_Response); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_response_body_service_proto_rawDesc, NumEnums: 1, NumMessages: 6, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_response_body_service_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_response_body_service_proto_depIdxs, EnumInfos: file_examples_internal_proto_examplepb_response_body_service_proto_enumTypes, MessageInfos: file_examples_internal_proto_examplepb_response_body_service_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_response_body_service_proto = out.File file_examples_internal_proto_examplepb_response_body_service_proto_rawDesc = nil file_examples_internal_proto_examplepb_response_body_service_proto_goTypes = nil file_examples_internal_proto_examplepb_response_body_service_proto_depIdxs = nil } response_body_service.pb.gw.go000066400000000000000000000476431465037340600363330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/response_body_service.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := client.GetResponseBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := server.GetResponseBody(ctx, &protoReq) return msg, metadata, err } func request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := client.ListResponseBodies(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := server.ListResponseBodies(ctx, &protoReq) return msg, metadata, err } func request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := client.ListResponseStrings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } msg, err := server.ListResponseStrings(ctx, &protoReq) return msg, metadata, err } func request_ResponseBodyService_GetResponseBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (ResponseBodyService_GetResponseBodyStreamClient, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["data"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") } protoReq.Data, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) } stream, err := client.GetResponseBodyStream(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterResponseBodyServiceHandlerFromEndpoint instead. func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer) error { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody", runtime.WithHTTPPathPattern("/responsebody/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ResponseBodyService_GetResponseBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_GetResponseBody_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_GetResponseBody_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_ListResponseBodies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies", runtime.WithHTTPPathPattern("/responsebodies/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ResponseBodyService_ListResponseBodies_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_ListResponseBodies_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseBodies_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_ListResponseStrings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings", runtime.WithHTTPPathPattern("/responsestrings/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_ResponseBodyService_ListResponseStrings_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_ListResponseStrings_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseStrings_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) return nil } // RegisterResponseBodyServiceHandlerFromEndpoint is same as RegisterResponseBodyServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterResponseBodyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterResponseBodyServiceHandler(ctx, mux, conn) } // RegisterResponseBodyServiceHandler registers the http handlers for service ResponseBodyService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterResponseBodyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterResponseBodyServiceHandlerClient(ctx, mux, NewResponseBodyServiceClient(conn)) } // RegisterResponseBodyServiceHandlerClient registers the http handlers for service ResponseBodyService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ResponseBodyServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ResponseBodyServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "ResponseBodyServiceClient" to call the correct interceptors. func RegisterResponseBodyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ResponseBodyServiceClient) error { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody", runtime.WithHTTPPathPattern("/responsebody/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ResponseBodyService_GetResponseBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_GetResponseBody_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_GetResponseBody_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_ListResponseBodies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies", runtime.WithHTTPPathPattern("/responsebodies/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ResponseBodyService_ListResponseBodies_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_ListResponseBodies_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseBodies_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_ListResponseStrings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings", runtime.WithHTTPPathPattern("/responsestrings/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ResponseBodyService_ListResponseStrings_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_ListResponseStrings_0(annotatedContext, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseStrings_0{resp}, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBodyStream", runtime.WithHTTPPathPattern("/responsebody/stream/{data}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_ResponseBodyService_GetResponseBodyStream_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_ResponseBodyService_GetResponseBodyStream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { res, err := resp.Recv() return response_ResponseBodyService_GetResponseBodyStream_0{res}, err }, mux.GetForwardResponseOptions()...) }) return nil } type response_ResponseBodyService_GetResponseBody_0 struct { proto.Message } func (m response_ResponseBodyService_GetResponseBody_0) XXX_ResponseBody() interface{} { response := m.Message.(*ResponseBodyOut) return response.Response } type response_ResponseBodyService_ListResponseBodies_0 struct { proto.Message } func (m response_ResponseBodyService_ListResponseBodies_0) XXX_ResponseBody() interface{} { response := m.Message.(*RepeatedResponseBodyOut) return response.Response } type response_ResponseBodyService_ListResponseStrings_0 struct { proto.Message } func (m response_ResponseBodyService_ListResponseStrings_0) XXX_ResponseBody() interface{} { response := m.Message.(*RepeatedResponseStrings) return response.Values } type response_ResponseBodyService_GetResponseBodyStream_0 struct { proto.Message } func (m response_ResponseBodyService_GetResponseBodyStream_0) XXX_ResponseBody() interface{} { response := m.Message.(*ResponseBodyOut) return response.Response } var ( pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "")) pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "")) pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "")) pattern_ResponseBodyService_GetResponseBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"responsebody", "stream", "data"}, "")) ) var ( forward_ResponseBodyService_GetResponseBody_0 = runtime.ForwardResponseMessage forward_ResponseBodyService_ListResponseBodies_0 = runtime.ForwardResponseMessage forward_ResponseBodyService_ListResponseStrings_0 = runtime.ForwardResponseMessage forward_ResponseBodyService_GetResponseBodyStream_0 = runtime.ForwardResponseStream ) response_body_service.proto000066400000000000000000000027121465037340600360410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; message ResponseBodyIn { string data = 1; } message ResponseBodyOut { message Response { string data = 1; } Response response = 2; } message RepeatedResponseBodyOut { message Response { string data = 1; enum ResponseType { // UNKNOWN UNKNOWN = 0; // A is 1 A = 1; // B is 2 B = 2; } ResponseType type = 3; } repeated Response response = 2; } message RepeatedResponseStrings { repeated string values = 1; } service ResponseBodyService { rpc GetResponseBody(ResponseBodyIn) returns (ResponseBodyOut) { option (google.api.http) = { get: "/responsebody/{data}" response_body: "response" }; } rpc ListResponseBodies(ResponseBodyIn) returns (RepeatedResponseBodyOut) { option (google.api.http) = { get: "/responsebodies/{data}" response_body: "response" }; } rpc ListResponseStrings(ResponseBodyIn) returns (RepeatedResponseStrings) { option (google.api.http) = { get: "/responsestrings/{data}" response_body: "values" }; } rpc GetResponseBodyStream(ResponseBodyIn) returns (stream ResponseBodyOut) { option (google.api.http) = { get: "/responsebody/stream/{data}" response_body: "response" }; } } response_body_service.swagger.json000066400000000000000000000240721465037340600373100ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/response_body_service.proto", "version": "version not set" }, "tags": [ { "name": "ResponseBodyService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/responsebodies/{data}": { "get": { "operationId": "ResponseBodyService_ListResponseBodies", "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "data", "in": "path", "required": true, "type": "string" } ], "tags": [ "ResponseBodyService" ] } }, "/responsebody/stream/{data}": { "get": { "operationId": "ResponseBodyService_GetResponseBodyStream", "responses": { "200": { "description": "(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbResponseBodyOutResponse" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbResponseBodyOut" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "data", "in": "path", "required": true, "type": "string" } ], "tags": [ "ResponseBodyService" ] } }, "/responsebody/{data}": { "get": { "operationId": "ResponseBodyService_GetResponseBody", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/examplepbResponseBodyOutResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "data", "in": "path", "required": true, "type": "string" } ], "tags": [ "ResponseBodyService" ] } }, "/responsestrings/{data}": { "get": { "operationId": "ResponseBodyService_ListResponseStrings", "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "data", "in": "path", "required": true, "type": "string" } ], "tags": [ "ResponseBodyService" ] } } }, "definitions": { "ResponseResponseType": { "type": "string", "enum": [ "UNKNOWN", "A", "B" ], "default": "UNKNOWN", "title": "- UNKNOWN: UNKNOWN\n - A: A is 1\n - B: B is 2" }, "examplepbRepeatedResponseBodyOut": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" } } } }, "examplepbRepeatedResponseBodyOutResponse": { "type": "object", "properties": { "data": { "type": "string" }, "type": { "$ref": "#/definitions/ResponseResponseType" } } }, "examplepbRepeatedResponseStrings": { "type": "object", "properties": { "values": { "type": "array", "items": { "type": "string" } } } }, "examplepbResponseBodyOut": { "type": "object", "properties": { "response": { "$ref": "#/definitions/examplepbResponseBodyOutResponse" } } }, "examplepbResponseBodyOutResponse": { "type": "object", "properties": { "data": { "type": "string" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } response_body_service_grpc.pb.go000066400000000000000000000230411465037340600367140ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/response_body_service.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // ResponseBodyServiceClient is the client API for ResponseBodyService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) } type responseBodyServiceClient struct { cc grpc.ClientConnInterface } func NewResponseBodyServiceClient(cc grpc.ClientConnInterface) ResponseBodyServiceClient { return &responseBodyServiceClient{cc} } func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) { out := new(ResponseBodyOut) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *responseBodyServiceClient) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) { out := new(RepeatedResponseBodyOut) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) { out := new(RepeatedResponseStrings) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *responseBodyServiceClient) GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) { stream, err := c.cc.NewStream(ctx, &ResponseBodyService_ServiceDesc.Streams[0], "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBodyStream", opts...) if err != nil { return nil, err } x := &responseBodyServiceGetResponseBodyStreamClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type ResponseBodyService_GetResponseBodyStreamClient interface { Recv() (*ResponseBodyOut, error) grpc.ClientStream } type responseBodyServiceGetResponseBodyStreamClient struct { grpc.ClientStream } func (x *responseBodyServiceGetResponseBodyStreamClient) Recv() (*ResponseBodyOut, error) { m := new(ResponseBodyOut) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } // ResponseBodyServiceServer is the server API for ResponseBodyService service. // All implementations should embed UnimplementedResponseBodyServiceServer // for forward compatibility type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error } // UnimplementedResponseBodyServiceServer should be embedded to have forward compatible implementations. type UnimplementedResponseBodyServiceServer struct { } func (UnimplementedResponseBodyServiceServer) GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) { return nil, status.Errorf(codes.Unimplemented, "method GetResponseBody not implemented") } func (UnimplementedResponseBodyServiceServer) ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) { return nil, status.Errorf(codes.Unimplemented, "method ListResponseBodies not implemented") } func (UnimplementedResponseBodyServiceServer) ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) { return nil, status.Errorf(codes.Unimplemented, "method ListResponseStrings not implemented") } func (UnimplementedResponseBodyServiceServer) GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error { return status.Errorf(codes.Unimplemented, "method GetResponseBodyStream not implemented") } // UnsafeResponseBodyServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ResponseBodyServiceServer will // result in compilation errors. type UnsafeResponseBodyServiceServer interface { mustEmbedUnimplementedResponseBodyServiceServer() } func RegisterResponseBodyServiceServer(s grpc.ServiceRegistrar, srv ResponseBodyServiceServer) { s.RegisterService(&ResponseBodyService_ServiceDesc, srv) } func _ResponseBodyService_GetResponseBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ResponseBodyIn) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ResponseBodyServiceServer).GetResponseBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).GetResponseBody(ctx, req.(*ResponseBodyIn)) } return interceptor(ctx, in, info, handler) } func _ResponseBodyService_ListResponseBodies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ResponseBodyIn) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, req.(*ResponseBodyIn)) } return interceptor(ctx, in, info, handler) } func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ResponseBodyIn) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, req.(*ResponseBodyIn)) } return interceptor(ctx, in, info, handler) } func _ResponseBodyService_GetResponseBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(ResponseBodyIn) if err := stream.RecvMsg(m); err != nil { return err } return srv.(ResponseBodyServiceServer).GetResponseBodyStream(m, &responseBodyServiceGetResponseBodyStreamServer{stream}) } type ResponseBodyService_GetResponseBodyStreamServer interface { Send(*ResponseBodyOut) error grpc.ServerStream } type responseBodyServiceGetResponseBodyStreamServer struct { grpc.ServerStream } func (x *responseBodyServiceGetResponseBodyStreamServer) Send(m *ResponseBodyOut) error { return x.ServerStream.SendMsg(m) } // ResponseBodyService_ServiceDesc is the grpc.ServiceDesc for ResponseBodyService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ResponseBodyService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService", HandlerType: (*ResponseBodyServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetResponseBody", Handler: _ResponseBodyService_GetResponseBody_Handler, }, { MethodName: "ListResponseBodies", Handler: _ResponseBodyService_ListResponseBodies_Handler, }, { MethodName: "ListResponseStrings", Handler: _ResponseBodyService_ListResponseStrings_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "GetResponseBodyStream", Handler: _ResponseBodyService_GetResponseBodyStream_Handler, ServerStreams: true, }, }, Metadata: "examples/internal/proto/examplepb/response_body_service.proto", } standalone_echo_service.buf.gen.yaml000066400000000000000000000003261465037340600374350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - plugin: grpc-gateway out: . opt: - paths=source_relative - standalone=true - grpc_api_configuration=examples/internal/proto/examplepb/standalone_echo_service.yaml standalone_echo_service.yaml000066400000000000000000000013211465037340600361060ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbtype: google.api.Service config_version: 3 http: rules: - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.Echo post: "/v2/example/echo/{id}" additional_bindings: - get: "/v2/example/echo/{id}/{num}" - get: "/v2/example/echo/{id}/{num}/{lang}" - get: "/v2/example/echo1/{id}/{line_num}/{status.note}" - get: "/v2/example/echo2/{no.note}" - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoBody post: "/v2/example/echo_body" body: "*" - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoDelete delete: "/v2/example/echo_delete" golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/stream.pb.go000066400000000000000000000306551465037340600326710ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/stream.proto package examplepb import ( sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" _ "google.golang.org/genproto/googleapis/api/annotations" httpbody "google.golang.org/genproto/googleapis/api/httpbody" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" 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 Options struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Error bool `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"` } func (x *Options) Reset() { *x = Options{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_stream_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Options) String() string { return protoimpl.X.MessageStringOf(x) } func (*Options) ProtoMessage() {} func (x *Options) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_stream_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 Options.ProtoReflect.Descriptor instead. func (*Options) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_stream_proto_rawDescGZIP(), []int{0} } func (x *Options) GetError() bool { if x != nil { return x.Error } return false } var File_examples_internal_proto_examplepb_stream_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_stream_proto_rawDesc = []byte{ 0x0a, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x3b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x89, 0x05, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x99, 0x01, 0x0a, 0x0a, 0x42, 0x75, 0x6c, 0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x62, 0x75, 0x6c, 0x6b, 0x28, 0x01, 0x12, 0xac, 0x01, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x30, 0x01, 0x12, 0xb1, 0x01, 0x0a, 0x08, 0x42, 0x75, 0x6c, 0x6b, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x28, 0x01, 0x30, 0x01, 0x12, 0x79, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x37, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_stream_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_stream_proto_rawDescData = file_examples_internal_proto_examplepb_stream_proto_rawDesc ) func file_examples_internal_proto_examplepb_stream_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_stream_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_stream_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_stream_proto_rawDescData) }) return file_examples_internal_proto_examplepb_stream_proto_rawDescData } var file_examples_internal_proto_examplepb_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_examplepb_stream_proto_goTypes = []interface{}{ (*Options)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.Options (*ABitOfEverything)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything (*sub.StringMessage)(nil), // 2: grpc.gateway.examples.internal.proto.sub.StringMessage (*emptypb.Empty)(nil), // 3: google.protobuf.Empty (*httpbody.HttpBody)(nil), // 4: google.api.HttpBody } var file_examples_internal_proto_examplepb_stream_proto_depIdxs = []int32{ 1, // 0: grpc.gateway.examples.internal.proto.examplepb.StreamService.BulkCreate:input_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 0, // 1: grpc.gateway.examples.internal.proto.examplepb.StreamService.List:input_type -> grpc.gateway.examples.internal.proto.examplepb.Options 2, // 2: grpc.gateway.examples.internal.proto.examplepb.StreamService.BulkEcho:input_type -> grpc.gateway.examples.internal.proto.sub.StringMessage 0, // 3: grpc.gateway.examples.internal.proto.examplepb.StreamService.Download:input_type -> grpc.gateway.examples.internal.proto.examplepb.Options 3, // 4: grpc.gateway.examples.internal.proto.examplepb.StreamService.BulkCreate:output_type -> google.protobuf.Empty 1, // 5: grpc.gateway.examples.internal.proto.examplepb.StreamService.List:output_type -> grpc.gateway.examples.internal.proto.examplepb.ABitOfEverything 2, // 6: grpc.gateway.examples.internal.proto.examplepb.StreamService.BulkEcho:output_type -> grpc.gateway.examples.internal.proto.sub.StringMessage 4, // 7: grpc.gateway.examples.internal.proto.examplepb.StreamService.Download:output_type -> google.api.HttpBody 4, // [4:8] is the sub-list for method output_type 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_stream_proto_init() } func file_examples_internal_proto_examplepb_stream_proto_init() { if File_examples_internal_proto_examplepb_stream_proto != nil { return } file_examples_internal_proto_examplepb_a_bit_of_everything_proto_init() if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Options); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_stream_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_stream_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_stream_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_stream_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_stream_proto = out.File file_examples_internal_proto_examplepb_stream_proto_rawDesc = nil file_examples_internal_proto_examplepb_stream_proto_goTypes = nil file_examples_internal_proto_examplepb_stream_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/stream.pb.gw.go000066400000000000000000000340451465037340600333020ustar00rootroot00000000000000// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/stream.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.BulkCreate(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) for { var protoReq ABitOfEverything err = dec.Decode(&protoReq) if err == io.EOF { break } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { if err == io.EOF { break } grpclog.Errorf("Failed to send request: %v", err) return nil, metadata, err } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) return nil, metadata, err } header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header msg, err := stream.CloseAndRecv() metadata.TrailerMD = stream.Trailer() return msg, metadata, err } var ( filter_StreamService_List_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_ListClient, runtime.ServerMetadata, error) { var protoReq Options var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_StreamService_List_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.List(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_BulkEchoClient, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.BulkEcho(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq sub.StringMessage err := dec.Decode(&protoReq) if err == io.EOF { return err } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return err } if err := stream.Send(&protoReq); err != nil { grpclog.Errorf("Failed to send request: %v", err) return err } return nil } go func() { for { if err := handleSend(); err != nil { break } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) } }() header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } var ( filter_StreamService_Download_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_StreamService_Download_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_DownloadClient, runtime.ServerMetadata, error) { var protoReq Options var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_StreamService_Download_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.Download(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } // RegisterStreamServiceHandlerServer registers the http handlers for service StreamService to "mux". // UnaryRPC :call StreamServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterStreamServiceHandlerFromEndpoint instead. func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) mux.Handle("GET", pattern_StreamService_Download_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) return nil } // RegisterStreamServiceHandlerFromEndpoint is same as RegisterStreamServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterStreamServiceHandler(ctx, mux, conn) } // RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterStreamServiceHandlerClient(ctx, mux, NewStreamServiceClient(conn)) } // RegisterStreamServiceHandlerClient registers the http handlers for service StreamService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StreamServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StreamServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "StreamServiceClient" to call the correct interceptors. func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StreamServiceClient) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.StreamService/BulkCreate", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/bulk")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_StreamService_BulkCreate_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_StreamService_BulkCreate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.StreamService/List", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_StreamService_List_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_StreamService_List_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.StreamService/BulkEcho", runtime.WithHTTPPathPattern("/v1/example/a_bit_of_everything/echo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_StreamService_BulkEcho_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_StreamService_BulkEcho_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_StreamService_Download_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.StreamService/Download", runtime.WithHTTPPathPattern("/v1/example/download")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_StreamService_Download_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_StreamService_Download_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_StreamService_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, "")) pattern_StreamService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) pattern_StreamService_BulkEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "echo"}, "")) pattern_StreamService_Download_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "download"}, "")) ) var ( forward_StreamService_BulkCreate_0 = runtime.ForwardResponseMessage forward_StreamService_List_0 = runtime.ForwardResponseStream forward_StreamService_BulkEcho_0 = runtime.ForwardResponseStream forward_StreamService_Download_0 = runtime.ForwardResponseStream ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/stream.proto000066400000000000000000000023561465037340600330240ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "examples/internal/proto/examplepb/a_bit_of_everything.proto"; import "examples/internal/proto/sub/message.proto"; import "google/api/annotations.proto"; import "google/api/httpbody.proto"; import "google/protobuf/empty.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // Defines some more operations to be added to ABitOfEverythingService service StreamService { rpc BulkCreate(stream ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/bulk" body: "*" }; } rpc List(Options) returns (stream ABitOfEverything) { option (google.api.http) = {get: "/v1/example/a_bit_of_everything"}; } rpc BulkEcho(stream grpc.gateway.examples.internal.proto.sub.StringMessage) returns (stream grpc.gateway.examples.internal.proto.sub.StringMessage) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/echo" body: "*" }; } rpc Download(Options) returns (stream google.api.HttpBody) { option (google.api.http) = {get: "/v1/example/download"}; } } message Options { bool error = 1; } stream.swagger.json000066400000000000000000000502361465037340600342110ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/stream.proto", "version": "version not set" }, "tags": [ { "name": "StreamService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/a_bit_of_everything": { "get": { "operationId": "StreamService_List", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbABitOfEverything" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbABitOfEverything" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "error", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "StreamService" ] } }, "/v1/example/a_bit_of_everything/bulk": { "post": { "operationId": "StreamService_BulkCreate", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "Intentionally complicated message type to cover many features of Protobuf. (streaming inputs)", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } } ], "tags": [ "StreamService" ] } }, "/v1/example/a_bit_of_everything/echo": { "post": { "operationId": "StreamService_BulkEcho", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/subStringMessage" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of subStringMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": " (streaming inputs)", "in": "body", "required": true, "schema": { "$ref": "#/definitions/subStringMessage" } } ], "tags": [ "StreamService" ] } }, "/v1/example/download": { "get": { "operationId": "StreamService_Download", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "string", "format": "binary", "properties": {}, "title": "Free form byte stream" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "error", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "StreamService" ] } } }, "definitions": { "ABitOfEverythingNested": { "type": "object", "example": { "ok": "TRUE" }, "properties": { "name": { "type": "string", "description": "name is nested field." }, "amount": { "type": "integer", "format": "int64" }, "ok": { "$ref": "#/definitions/NestedDeepEnum", "description": "DeepEnum description." } }, "description": "Nested is nested type." }, "MessagePathEnumNestedPathEnum": { "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, "NestedDeepEnum": { "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE", "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." }, "apiHttpBody": { "type": "object", "properties": { "contentType": { "type": "string", "description": "The HTTP Content-Type header value specifying the content type of the body." }, "data": { "type": "string", "format": "byte", "description": "The HTTP request/response body as raw binary." }, "extensions": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "Application specific response metadata. Must be set in the first response\nfor streaming APIs." } }, "description": "Message that represents an arbitrary HTTP body. It should only be used for\npayload formats that can't be represented as JSON, such as raw binary or\nan HTML page.\n\n\nThis message can be used both in streaming and non-streaming API methods in\nthe request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one\nwants to extract parameters from either the URL or HTTP template into the\nrequest fields and also want access to the raw HTTP body.\n\nExample:\n\n message GetResourceRequest {\n // A unique request id.\n string request_id = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest)\n returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody)\n returns (google.protobuf.Empty);\n\n }\n\nExample with streaming methods:\n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n\n }\n\nUse of this type only changes how the request and response bodies are\nhandled, all other features will continue to work unchanged." }, "examplepbABitOfEverything": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { "type": "string", "format": "uuid", "minLength": 1, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "uuid", "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "examplepbNumericEnum": { "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, "pathenumPathEnum": { "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." }, "subStringMessage": { "type": "object", "properties": { "value": { "type": "string" } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/stream_grpc.pb.go000066400000000000000000000241221465037340600336740ustar00rootroot00000000000000// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/stream.proto package examplepb import ( context "context" sub "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" httpbody "google.golang.org/genproto/googleapis/api/httpbody" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // StreamServiceClient is the client API for StreamService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type StreamServiceClient interface { BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) List(ctx context.Context, in *Options, opts ...grpc.CallOption) (StreamService_ListClient, error) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) Download(ctx context.Context, in *Options, opts ...grpc.CallOption) (StreamService_DownloadClient, error) } type streamServiceClient struct { cc grpc.ClientConnInterface } func NewStreamServiceClient(cc grpc.ClientConnInterface) StreamServiceClient { return &streamServiceClient{cc} } func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { stream, err := c.cc.NewStream(ctx, &StreamService_ServiceDesc.Streams[0], "/grpc.gateway.examples.internal.proto.examplepb.StreamService/BulkCreate", opts...) if err != nil { return nil, err } x := &streamServiceBulkCreateClient{stream} return x, nil } type StreamService_BulkCreateClient interface { Send(*ABitOfEverything) error CloseAndRecv() (*emptypb.Empty, error) grpc.ClientStream } type streamServiceBulkCreateClient struct { grpc.ClientStream } func (x *streamServiceBulkCreateClient) Send(m *ABitOfEverything) error { return x.ClientStream.SendMsg(m) } func (x *streamServiceBulkCreateClient) CloseAndRecv() (*emptypb.Empty, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } m := new(emptypb.Empty) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *streamServiceClient) List(ctx context.Context, in *Options, opts ...grpc.CallOption) (StreamService_ListClient, error) { stream, err := c.cc.NewStream(ctx, &StreamService_ServiceDesc.Streams[1], "/grpc.gateway.examples.internal.proto.examplepb.StreamService/List", opts...) if err != nil { return nil, err } x := &streamServiceListClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type StreamService_ListClient interface { Recv() (*ABitOfEverything, error) grpc.ClientStream } type streamServiceListClient struct { grpc.ClientStream } func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { m := new(ABitOfEverything) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { stream, err := c.cc.NewStream(ctx, &StreamService_ServiceDesc.Streams[2], "/grpc.gateway.examples.internal.proto.examplepb.StreamService/BulkEcho", opts...) if err != nil { return nil, err } x := &streamServiceBulkEchoClient{stream} return x, nil } type StreamService_BulkEchoClient interface { Send(*sub.StringMessage) error Recv() (*sub.StringMessage, error) grpc.ClientStream } type streamServiceBulkEchoClient struct { grpc.ClientStream } func (x *streamServiceBulkEchoClient) Send(m *sub.StringMessage) error { return x.ClientStream.SendMsg(m) } func (x *streamServiceBulkEchoClient) Recv() (*sub.StringMessage, error) { m := new(sub.StringMessage) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func (c *streamServiceClient) Download(ctx context.Context, in *Options, opts ...grpc.CallOption) (StreamService_DownloadClient, error) { stream, err := c.cc.NewStream(ctx, &StreamService_ServiceDesc.Streams[3], "/grpc.gateway.examples.internal.proto.examplepb.StreamService/Download", opts...) if err != nil { return nil, err } x := &streamServiceDownloadClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type StreamService_DownloadClient interface { Recv() (*httpbody.HttpBody, error) grpc.ClientStream } type streamServiceDownloadClient struct { grpc.ClientStream } func (x *streamServiceDownloadClient) Recv() (*httpbody.HttpBody, error) { m := new(httpbody.HttpBody) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } // StreamServiceServer is the server API for StreamService service. // All implementations should embed UnimplementedStreamServiceServer // for forward compatibility type StreamServiceServer interface { BulkCreate(StreamService_BulkCreateServer) error List(*Options, StreamService_ListServer) error BulkEcho(StreamService_BulkEchoServer) error Download(*Options, StreamService_DownloadServer) error } // UnimplementedStreamServiceServer should be embedded to have forward compatible implementations. type UnimplementedStreamServiceServer struct { } func (UnimplementedStreamServiceServer) BulkCreate(StreamService_BulkCreateServer) error { return status.Errorf(codes.Unimplemented, "method BulkCreate not implemented") } func (UnimplementedStreamServiceServer) List(*Options, StreamService_ListServer) error { return status.Errorf(codes.Unimplemented, "method List not implemented") } func (UnimplementedStreamServiceServer) BulkEcho(StreamService_BulkEchoServer) error { return status.Errorf(codes.Unimplemented, "method BulkEcho not implemented") } func (UnimplementedStreamServiceServer) Download(*Options, StreamService_DownloadServer) error { return status.Errorf(codes.Unimplemented, "method Download not implemented") } // UnsafeStreamServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to StreamServiceServer will // result in compilation errors. type UnsafeStreamServiceServer interface { mustEmbedUnimplementedStreamServiceServer() } func RegisterStreamServiceServer(s grpc.ServiceRegistrar, srv StreamServiceServer) { s.RegisterService(&StreamService_ServiceDesc, srv) } func _StreamService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { return srv.(StreamServiceServer).BulkCreate(&streamServiceBulkCreateServer{stream}) } type StreamService_BulkCreateServer interface { SendAndClose(*emptypb.Empty) error Recv() (*ABitOfEverything, error) grpc.ServerStream } type streamServiceBulkCreateServer struct { grpc.ServerStream } func (x *streamServiceBulkCreateServer) SendAndClose(m *emptypb.Empty) error { return x.ServerStream.SendMsg(m) } func (x *streamServiceBulkCreateServer) Recv() (*ABitOfEverything, error) { m := new(ABitOfEverything) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func _StreamService_List_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(Options) if err := stream.RecvMsg(m); err != nil { return err } return srv.(StreamServiceServer).List(m, &streamServiceListServer{stream}) } type StreamService_ListServer interface { Send(*ABitOfEverything) error grpc.ServerStream } type streamServiceListServer struct { grpc.ServerStream } func (x *streamServiceListServer) Send(m *ABitOfEverything) error { return x.ServerStream.SendMsg(m) } func _StreamService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { return srv.(StreamServiceServer).BulkEcho(&streamServiceBulkEchoServer{stream}) } type StreamService_BulkEchoServer interface { Send(*sub.StringMessage) error Recv() (*sub.StringMessage, error) grpc.ServerStream } type streamServiceBulkEchoServer struct { grpc.ServerStream } func (x *streamServiceBulkEchoServer) Send(m *sub.StringMessage) error { return x.ServerStream.SendMsg(m) } func (x *streamServiceBulkEchoServer) Recv() (*sub.StringMessage, error) { m := new(sub.StringMessage) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } return m, nil } func _StreamService_Download_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(Options) if err := stream.RecvMsg(m); err != nil { return err } return srv.(StreamServiceServer).Download(m, &streamServiceDownloadServer{stream}) } type StreamService_DownloadServer interface { Send(*httpbody.HttpBody) error grpc.ServerStream } type streamServiceDownloadServer struct { grpc.ServerStream } func (x *streamServiceDownloadServer) Send(m *httpbody.HttpBody) error { return x.ServerStream.SendMsg(m) } // StreamService_ServiceDesc is the grpc.ServiceDesc for StreamService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var StreamService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.StreamService", HandlerType: (*StreamServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "BulkCreate", Handler: _StreamService_BulkCreate_Handler, ClientStreams: true, }, { StreamName: "List", Handler: _StreamService_List_Handler, ServerStreams: true, }, { StreamName: "BulkEcho", Handler: _StreamService_BulkEcho_Handler, ServerStreams: true, ClientStreams: true, }, { StreamName: "Download", Handler: _StreamService_Download_Handler, ServerStreams: true, }, }, Metadata: "examples/internal/proto/examplepb/stream.proto", } unannotated_echo_service.buf.gen.yaml000066400000000000000000000006561465037340600376330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - plugin: grpc-gateway out: . opt: - paths=source_relative - grpc_api_configuration=examples/internal/proto/examplepb/unannotated_echo_service.yaml - plugin: openapiv2 out: . opt: - grpc_api_configuration=examples/internal/proto/examplepb/unannotated_echo_service.yaml - openapi_configuration=examples/internal/proto/examplepb/unannotated_echo_service.swagger.yaml unannotated_echo_service.pb.go000066400000000000000000000575651465037340600363660ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/unannotated_echo_service.proto // Unannotated Echo Service // Similar to echo_service.proto but without annotations. See // unannotated_echo_service.yaml for the equivalent of the annotations in // gRPC API configuration format. // // Echo Service API consists of a single service which returns // a message. package examplepb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" 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) ) // Embedded represents a message embedded in SimpleMessage. type UnannotatedEmbedded struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Mark: // // *UnannotatedEmbedded_Progress // *UnannotatedEmbedded_Note Mark isUnannotatedEmbedded_Mark `protobuf_oneof:"mark"` } func (x *UnannotatedEmbedded) Reset() { *x = UnannotatedEmbedded{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UnannotatedEmbedded) String() string { return protoimpl.X.MessageStringOf(x) } func (*UnannotatedEmbedded) ProtoMessage() {} func (x *UnannotatedEmbedded) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_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 UnannotatedEmbedded.ProtoReflect.Descriptor instead. func (*UnannotatedEmbedded) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescGZIP(), []int{0} } func (m *UnannotatedEmbedded) GetMark() isUnannotatedEmbedded_Mark { if m != nil { return m.Mark } return nil } func (x *UnannotatedEmbedded) GetProgress() int64 { if x, ok := x.GetMark().(*UnannotatedEmbedded_Progress); ok { return x.Progress } return 0 } func (x *UnannotatedEmbedded) GetNote() string { if x, ok := x.GetMark().(*UnannotatedEmbedded_Note); ok { return x.Note } return "" } type isUnannotatedEmbedded_Mark interface { isUnannotatedEmbedded_Mark() } type UnannotatedEmbedded_Progress struct { Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` } type UnannotatedEmbedded_Note struct { Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` } func (*UnannotatedEmbedded_Progress) isUnannotatedEmbedded_Mark() {} func (*UnannotatedEmbedded_Note) isUnannotatedEmbedded_Mark() {} type UnannotatedNestedMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields NId string `protobuf:"bytes,1,opt,name=n_id,json=nId,proto3" json:"n_id,omitempty"` Val string `protobuf:"bytes,2,opt,name=val,proto3" json:"val,omitempty"` } func (x *UnannotatedNestedMessage) Reset() { *x = UnannotatedNestedMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UnannotatedNestedMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*UnannotatedNestedMessage) ProtoMessage() {} func (x *UnannotatedNestedMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_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 UnannotatedNestedMessage.ProtoReflect.Descriptor instead. func (*UnannotatedNestedMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescGZIP(), []int{1} } func (x *UnannotatedNestedMessage) GetNId() string { if x != nil { return x.NId } return "" } func (x *UnannotatedNestedMessage) GetVal() string { if x != nil { return x.Val } return "" } // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. type UnannotatedSimpleMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` Duration *durationpb.Duration `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"` // Types that are assignable to Code: // // *UnannotatedSimpleMessage_LineNum // *UnannotatedSimpleMessage_Lang Code isUnannotatedSimpleMessage_Code `protobuf_oneof:"code"` Status *UnannotatedEmbedded `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` // Types that are assignable to Ext: // // *UnannotatedSimpleMessage_En // *UnannotatedSimpleMessage_No Ext isUnannotatedSimpleMessage_Ext `protobuf_oneof:"ext"` ResourceId string `protobuf:"bytes,9,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` NId *UnannotatedNestedMessage `protobuf:"bytes,10,opt,name=n_id,json=nId,proto3" json:"n_id,omitempty"` } func (x *UnannotatedSimpleMessage) Reset() { *x = UnannotatedSimpleMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UnannotatedSimpleMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*UnannotatedSimpleMessage) ProtoMessage() {} func (x *UnannotatedSimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_unannotated_echo_service_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 UnannotatedSimpleMessage.ProtoReflect.Descriptor instead. func (*UnannotatedSimpleMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescGZIP(), []int{2} } func (x *UnannotatedSimpleMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *UnannotatedSimpleMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *UnannotatedSimpleMessage) GetDuration() *durationpb.Duration { if x != nil { return x.Duration } return nil } func (m *UnannotatedSimpleMessage) GetCode() isUnannotatedSimpleMessage_Code { if m != nil { return m.Code } return nil } func (x *UnannotatedSimpleMessage) GetLineNum() int64 { if x, ok := x.GetCode().(*UnannotatedSimpleMessage_LineNum); ok { return x.LineNum } return 0 } func (x *UnannotatedSimpleMessage) GetLang() string { if x, ok := x.GetCode().(*UnannotatedSimpleMessage_Lang); ok { return x.Lang } return "" } func (x *UnannotatedSimpleMessage) GetStatus() *UnannotatedEmbedded { if x != nil { return x.Status } return nil } func (m *UnannotatedSimpleMessage) GetExt() isUnannotatedSimpleMessage_Ext { if m != nil { return m.Ext } return nil } func (x *UnannotatedSimpleMessage) GetEn() int64 { if x, ok := x.GetExt().(*UnannotatedSimpleMessage_En); ok { return x.En } return 0 } func (x *UnannotatedSimpleMessage) GetNo() *UnannotatedEmbedded { if x, ok := x.GetExt().(*UnannotatedSimpleMessage_No); ok { return x.No } return nil } func (x *UnannotatedSimpleMessage) GetResourceId() string { if x != nil { return x.ResourceId } return "" } func (x *UnannotatedSimpleMessage) GetNId() *UnannotatedNestedMessage { if x != nil { return x.NId } return nil } type isUnannotatedSimpleMessage_Code interface { isUnannotatedSimpleMessage_Code() } type UnannotatedSimpleMessage_LineNum struct { LineNum int64 `protobuf:"varint,4,opt,name=line_num,json=lineNum,proto3,oneof"` } type UnannotatedSimpleMessage_Lang struct { Lang string `protobuf:"bytes,5,opt,name=lang,proto3,oneof"` } func (*UnannotatedSimpleMessage_LineNum) isUnannotatedSimpleMessage_Code() {} func (*UnannotatedSimpleMessage_Lang) isUnannotatedSimpleMessage_Code() {} type isUnannotatedSimpleMessage_Ext interface { isUnannotatedSimpleMessage_Ext() } type UnannotatedSimpleMessage_En struct { En int64 `protobuf:"varint,7,opt,name=en,proto3,oneof"` } type UnannotatedSimpleMessage_No struct { No *UnannotatedEmbedded `protobuf:"bytes,8,opt,name=no,proto3,oneof"` } func (*UnannotatedSimpleMessage_En) isUnannotatedSimpleMessage_Ext() {} func (*UnannotatedSimpleMessage_No) isUnannotatedSimpleMessage_Ext() {} var File_examples_internal_proto_examplepb_unannotated_echo_service_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDesc = []byte{ 0x0a, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x75, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x51, 0x0a, 0x13, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x3f, 0x0a, 0x18, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6e, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0xf9, 0x03, 0x0a, 0x18, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x5b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x02, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x02, 0x65, 0x6e, 0x12, 0x55, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x48, 0x01, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x5b, 0x0a, 0x04, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x03, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x65, 0x78, 0x74, 0x32, 0xf9, 0x03, 0x0a, 0x16, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9a, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x9e, 0x01, 0x0a, 0x08, 0x45, 0x63, 0x68, 0x6f, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0xa0, 0x01, 0x0a, 0x0a, 0x45, 0x63, 0x68, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x55, 0x6e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x57, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x3b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescData = file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDesc ) func file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescData) }) return file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDescData } var file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_examples_internal_proto_examplepb_unannotated_echo_service_proto_goTypes = []interface{}{ (*UnannotatedEmbedded)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEmbedded (*UnannotatedNestedMessage)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.UnannotatedNestedMessage (*UnannotatedSimpleMessage)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage (*durationpb.Duration)(nil), // 3: google.protobuf.Duration } var file_examples_internal_proto_examplepb_unannotated_echo_service_proto_depIdxs = []int32{ 3, // 0: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage.duration:type_name -> google.protobuf.Duration 0, // 1: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedEmbedded 0, // 2: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage.no:type_name -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedEmbedded 1, // 3: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage.n_id:type_name -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedNestedMessage 2, // 4: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 2, // 5: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoBody:input_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 2, // 6: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoDelete:input_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 2, // 7: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 2, // 8: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoBody:output_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 2, // 9: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoDelete:output_type -> grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage 7, // [7:10] is the sub-list for method output_type 4, // [4:7] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_unannotated_echo_service_proto_init() } func file_examples_internal_proto_examplepb_unannotated_echo_service_proto_init() { if File_examples_internal_proto_examplepb_unannotated_echo_service_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UnannotatedEmbedded); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UnannotatedNestedMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UnannotatedSimpleMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[0].OneofWrappers = []interface{}{ (*UnannotatedEmbedded_Progress)(nil), (*UnannotatedEmbedded_Note)(nil), } file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes[2].OneofWrappers = []interface{}{ (*UnannotatedSimpleMessage_LineNum)(nil), (*UnannotatedSimpleMessage_Lang)(nil), (*UnannotatedSimpleMessage_En)(nil), (*UnannotatedSimpleMessage_No)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_unannotated_echo_service_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_unannotated_echo_service_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_unannotated_echo_service_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_unannotated_echo_service_proto = out.File file_examples_internal_proto_examplepb_unannotated_echo_service_proto_rawDesc = nil file_examples_internal_proto_examplepb_unannotated_echo_service_proto_goTypes = nil file_examples_internal_proto_examplepb_unannotated_echo_service_proto_depIdxs = nil } unannotated_echo_service.pb.gw.go000066400000000000000000000530351465037340600367660ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/unannotated_echo_service.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_UnannotatedEchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoBody(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoDelete(ctx, &protoReq) return msg, metadata, err } // RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". // UnaryRPC :call UnannotatedEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUnannotatedEchoServiceHandlerFromEndpoint instead. func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_EchoBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", runtime.WithHTTPPathPattern("/v1/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterUnannotatedEchoServiceHandlerFromEndpoint is same as RegisterUnannotatedEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterUnannotatedEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterUnannotatedEchoServiceHandler(ctx, mux, conn) } // RegisterUnannotatedEchoServiceHandler registers the http handlers for service UnannotatedEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterUnannotatedEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterUnannotatedEchoServiceHandlerClient(ctx, mux, NewUnannotatedEchoServiceClient(conn)) } // RegisterUnannotatedEchoServiceHandlerClient registers the http handlers for service UnannotatedEchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UnannotatedEchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UnannotatedEchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "UnannotatedEchoServiceClient" to call the correct interceptors. func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UnannotatedEchoServiceClient) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", runtime.WithHTTPPathPattern("/v1/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_EchoBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", runtime.WithHTTPPathPattern("/v1/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_UnannotatedEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) pattern_UnannotatedEchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "")) pattern_UnannotatedEchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) pattern_UnannotatedEchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "")) ) var ( forward_UnannotatedEchoService_Echo_0 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_Echo_1 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_EchoBody_0 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_EchoDelete_0 = runtime.ForwardResponseMessage ) unannotated_echo_service.proto000066400000000000000000000035231465037340600365050ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Unannotated Echo Service // Similar to echo_service.proto but without annotations. See // unannotated_echo_service.yaml for the equivalent of the annotations in // gRPC API configuration format. // // Echo Service API consists of a single service which returns // a message. package grpc.gateway.examples.internal.proto.examplepb; // Do not need annotations.proto, can still use well known types as usual import "google/protobuf/duration.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb;examplepb"; // Embedded represents a message embedded in SimpleMessage. message UnannotatedEmbedded { oneof mark { int64 progress = 1; string note = 2; } } message UnannotatedNestedMessage { string n_id = 1; string val = 2; } // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. message UnannotatedSimpleMessage { // Id represents the message identifier. string id = 1; int64 num = 2; google.protobuf.Duration duration = 3; oneof code { int64 line_num = 4; string lang = 5; } UnannotatedEmbedded status = 6; oneof ext { int64 en = 7; UnannotatedEmbedded no = 8; } string resource_id = 9; UnannotatedNestedMessage n_id = 10; } // Echo service responds to incoming echo requests. service UnannotatedEchoService { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. rpc Echo(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); // EchoBody method receives a simple message and returns it. rpc EchoBody(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); // EchoDelete method receives a simple message and returns it. rpc EchoDelete(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); } unannotated_echo_service.swagger.json000066400000000000000000000404761465037340600377610ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "Unannotated Echo", "description": "Unannotated Echo Service\nSimilar to echo_service.proto but without annotations. See\nunannotated_echo_service.yaml for the equivalent of the annotations in\ngRPC API configuration format.\n\nEcho Service API consists of a single service which returns\na message.", "version": "1.0", "contact": { "name": "gRPC-Gateway project", "url": "https://github.com/grpc-ecosystem/grpc-gateway", "email": "none@example.com" }, "license": { "name": "BSD 3-Clause License", "url": "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE" }, "x-something-something": "yadda" }, "tags": [ { "name": "Echo", "description": "Echo description" }, { "name": "Internal", "description": "Internal description", "x-traitTag": true }, { "name": "UnannotatedEchoService", "description": "UnannotatedEchoService description -- which should not be used in place of the documentation comment!", "externalDocs": { "description": "Find out more about UnannotatedEchoService", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } ], "schemes": [ "http", "https", "wss" ], "consumes": [ "application/json", "application/x-foo-mime" ], "produces": [ "application/json", "application/x-foo-mime" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Summary: Echo rpc", "description": "Description Echo", "operationId": "UnannotatedEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" }, "examples": { "application/json": { "value": "the input value" } } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "integer", "format": "integer" } }, "503": { "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "description": "Int value field", "in": "query", "required": true, "type": "string", "format": "int64", "default": "42" }, { "name": "duration", "in": "query", "required": false, "type": "string" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "UnannotatedEchoService" ], "externalDocs": { "description": "Find out more Echo", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } }, "/v1/example/echo/{id}/{num}": { "get": { "summary": "Summary: Echo rpc", "description": "Description Echo", "operationId": "UnannotatedEchoService_Echo2", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" }, "examples": { "application/json": { "value": "the input value" } } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "integer", "format": "integer" } }, "503": { "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "description": "Int value field", "in": "path", "required": true, "type": "string", "format": "int64", "default": "42" }, { "name": "duration", "in": "query", "required": false, "type": "string" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "UnannotatedEchoService" ], "externalDocs": { "description": "Find out more Echo", "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } }, "/v1/example/echo_body": { "post": { "summary": "EchoBody method receives a simple message and returns it.", "operationId": "UnannotatedEchoService_EchoBody", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "A simple message with many types", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } } ], "tags": [ "UnannotatedEchoService" ] } }, "/v1/example/echo_delete": { "delete": { "summary": "EchoDelete method receives a simple message and returns it.", "operationId": "UnannotatedEchoService_EchoDelete", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } }, "403": { "description": "Returned when the user does not have permission to access the resource.", "schema": {} }, "404": { "description": "Returned when the resource does not exist.", "schema": { "type": "string", "format": "string" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "description": "Int value field", "in": "query", "required": true, "type": "string", "format": "int64", "default": "42" }, { "name": "duration", "in": "query", "required": false, "type": "string" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "resourceId", "in": "query", "required": false, "type": "string" }, { "name": "nId.nId", "in": "query", "required": false, "type": "string" }, { "name": "nId.val", "in": "query", "required": false, "type": "string" } ], "tags": [ "UnannotatedEchoService" ] } } }, "definitions": { "examplepbUnannotatedEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbUnannotatedNestedMessage": { "type": "object", "properties": { "nId": { "type": "string" }, "val": { "type": "string" } } }, "examplepbUnannotatedSimpleMessage": { "type": "object", "example": { "id": "myid" }, "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64", "default": "42", "description": "Int value field" }, "duration": { "type": "string" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbUnannotatedEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbUnannotatedEmbedded" }, "resourceId": { "type": "string" }, "nId": { "$ref": "#/definitions/examplepbUnannotatedNestedMessage" } }, "description": "A simple message with many types", "title": "A bit of everything", "externalDocs": { "description": "Find out more about UnannotatedSimpleMessage", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "id", "num" ] }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } }, "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "X-API-Key", "in": "header", "x-amazon-apigateway-authorizer": { "authorizerResultTtlInSeconds": 60, "type": "token" }, "x-amazon-apigateway-authtype": "oauth2" }, "BasicAuth": { "type": "basic" } }, "security": [ { "ApiKeyAuth": [], "BasicAuth": [] }, { "ApiKeyAuth": [], "OAuth2": [ "read", "write" ] } ], "externalDocs": { "description": "More about gRPC-Gateway", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "x-grpc-gateway-baz-list": [ "one", true ], "x-grpc-gateway-foo": "bar" } unannotated_echo_service.swagger.yaml000066400000000000000000000100631465037340600377370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbopenapiOptions: file: # the file name must be the same as one passed to protoc when generating generating .swagger.json - file: "examples/internal/proto/examplepb/unannotated_echo_service.proto" option: info: title: Unannotated Echo contact: name: gRPC-Gateway project url: https://github.com/grpc-ecosystem/grpc-gateway email: none@example.com license: name: BSD 3-Clause License url: https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE version: "1.0" extensions: x-something-something: yadda tags: - name: Echo description: Echo description - name: Internal description: Internal description extensions: x-traitTag: true schemes: - HTTP - HTTPS - WSS consumes: - application/json - application/x-foo-mime produces: - application/json - application/x-foo-mime responses: "403": description: Returned when the user does not have permission to access the resource. "404": description: Returned when the resource does not exist. schema: jsonSchema: type: - STRING securityDefinitions: security: ApiKeyAuth: type: TYPE_API_KEY name: X-API-Key in: IN_HEADER extensions: x-amazon-apigateway-authorizer: authorizerResultTtlInSeconds: 60 type: token x-amazon-apigateway-authtype: oauth2 BasicAuth: type: TYPE_BASIC security: - securityRequirement: ApiKeyAuth: {} BasicAuth: {} - securityRequirement: ApiKeyAuth: {} OAuth2: scope: - read - write externalDocs: description: More about gRPC-Gateway url: https://github.com/grpc-ecosystem/grpc-gateway extensions: x-grpc-gateway-baz-list: - one - true x-grpc-gateway-foo: bar service: - service: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService option: description: "UnannotatedEchoService description -- which should not be used in place of the documentation comment!" external_docs: url: "https://github.com/grpc-ecosystem/grpc-gateway" description: "Find out more about UnannotatedEchoService" method: - method: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.Echo option: description: "Description Echo" summary: "Summary: Echo rpc" external_docs: url: "https://github.com/grpc-ecosystem/grpc-gateway" description: "Find out more Echo" responses: "200": examples: "application/json": '{"value": "the input value"}' "503": description: Returned when the resource is temporarily unavailable. extensions: x-number: 100 "404": description: Returned when the resource does not exist. schema: jsonSchema: type: [INTEGER] message: - message: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage option: json_schema: title: "A bit of everything" description: "A simple message with many types" required: ["id"] external_docs: url: "https://github.com/grpc-ecosystem/grpc-gateway" description: "Find out more about UnannotatedSimpleMessage" example: '{"id": "myid"}' field: - field: grpc.gateway.examples.internal.proto.examplepb.UnannotatedSimpleMessage.num option: description: "Int value field" default: "42" required: ["num"] unannotated_echo_service.yaml000066400000000000000000000010321465037340600362750ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbtype: google.api.Service config_version: 3 http: rules: - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.Echo post: "/v1/example/echo/{id}" additional_bindings: - get: "/v1/example/echo/{id}/{num}" - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoBody post: "/v1/example/echo_body" body: "*" - selector: grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService.EchoDelete delete: "/v1/example/echo_delete" unannotated_echo_service_grpc.pb.go000066400000000000000000000174731465037340600373730ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/unannotated_echo_service.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // UnannotatedEchoServiceClient is the client API for UnannotatedEchoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type UnannotatedEchoServiceClient interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) } type unannotatedEchoServiceClient struct { cc grpc.ClientConnInterface } func NewUnannotatedEchoServiceClient(cc grpc.ClientConnInterface) UnannotatedEchoServiceClient { return &unannotatedEchoServiceClient{cc} } func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *unannotatedEchoServiceClient) EchoDelete(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } return out, nil } // UnannotatedEchoServiceServer is the server API for UnannotatedEchoService service. // All implementations should embed UnimplementedUnannotatedEchoServiceServer // for forward compatibility type UnannotatedEchoServiceServer interface { // Echo method receives a simple message and returns it. // // The message posted as the id parameter will also be // returned. Echo(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) // EchoDelete method receives a simple message and returns it. EchoDelete(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) } // UnimplementedUnannotatedEchoServiceServer should be embedded to have forward compatible implementations. type UnimplementedUnannotatedEchoServiceServer struct { } func (UnimplementedUnannotatedEchoServiceServer) Echo(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } func (UnimplementedUnannotatedEchoServiceServer) EchoBody(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") } func (UnimplementedUnannotatedEchoServiceServer) EchoDelete(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") } // UnsafeUnannotatedEchoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UnannotatedEchoServiceServer will // result in compilation errors. type UnsafeUnannotatedEchoServiceServer interface { mustEmbedUnimplementedUnannotatedEchoServiceServer() } func RegisterUnannotatedEchoServiceServer(s grpc.ServiceRegistrar, srv UnannotatedEchoServiceServer) { s.RegisterService(&UnannotatedEchoService_ServiceDesc, srv) } func _UnannotatedEchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnannotatedSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(UnannotatedEchoServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).Echo(ctx, req.(*UnannotatedSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _UnannotatedEchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnannotatedSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(UnannotatedEchoServiceServer).EchoBody(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).EchoBody(ctx, req.(*UnannotatedSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _UnannotatedEchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnannotatedSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(UnannotatedEchoServiceServer).EchoDelete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).EchoDelete(ctx, req.(*UnannotatedSimpleMessage)) } return interceptor(ctx, in, info, handler) } // UnannotatedEchoService_ServiceDesc is the grpc.ServiceDesc for UnannotatedEchoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var UnannotatedEchoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService", HandlerType: (*UnannotatedEchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _UnannotatedEchoService_Echo_Handler, }, { MethodName: "EchoBody", Handler: _UnannotatedEchoService_EchoBody_Handler, }, { MethodName: "EchoDelete", Handler: _UnannotatedEchoService_EchoDelete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/unannotated_echo_service.proto", } use_go_template.buf.gen.yaml000066400000000000000000000001351465037340600357410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - plugin: openapiv2 out: . opt: - use_go_templates=true use_go_template.pb.go000066400000000000000000000407111465037340600344650ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/use_go_template.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 LoginRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The entered username Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // The entered password Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` } func (x *LoginRequest) Reset() { *x = LoginRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *LoginRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*LoginRequest) ProtoMessage() {} func (x *LoginRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_use_go_template_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 LoginRequest.ProtoReflect.Descriptor instead. func (*LoginRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_use_go_template_proto_rawDescGZIP(), []int{0} } func (x *LoginRequest) GetUsername() string { if x != nil { return x.Username } return "" } func (x *LoginRequest) GetPassword() string { if x != nil { return x.Password } return "" } type LoginReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Whether you have access or not Access bool `protobuf:"varint,2,opt,name=access,proto3" json:"access,omitempty"` } func (x *LoginReply) Reset() { *x = LoginReply{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *LoginReply) String() string { return protoimpl.X.MessageStringOf(x) } func (*LoginReply) ProtoMessage() {} func (x *LoginReply) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_use_go_template_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 LoginReply.ProtoReflect.Descriptor instead. func (*LoginReply) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_use_go_template_proto_rawDescGZIP(), []int{1} } func (x *LoginReply) GetMessage() string { if x != nil { return x.Message } return "" } func (x *LoginReply) GetAccess() bool { if x != nil { return x.Access } return false } type LogoutRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The time the logout was registered Timeoflogout string `protobuf:"bytes,1,opt,name=timeoflogout,proto3" json:"timeoflogout,omitempty"` // This is the title // // This is the "Description" of field test // you can use as many newlines as you want // // it will still format the same in the table Test int32 `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"` // This is an array // // It displays that using [] infront of the type Stringarray []string `protobuf:"bytes,3,rep,name=stringarray,proto3" json:"stringarray,omitempty"` } func (x *LogoutRequest) Reset() { *x = LogoutRequest{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *LogoutRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*LogoutRequest) ProtoMessage() {} func (x *LogoutRequest) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_use_go_template_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 LogoutRequest.ProtoReflect.Descriptor instead. func (*LogoutRequest) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_use_go_template_proto_rawDescGZIP(), []int{2} } func (x *LogoutRequest) GetTimeoflogout() string { if x != nil { return x.Timeoflogout } return "" } func (x *LogoutRequest) GetTest() int32 { if x != nil { return x.Test } return 0 } func (x *LogoutRequest) GetStringarray() []string { if x != nil { return x.Stringarray } return nil } type LogoutReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Message that tells you whether your // logout was successful or not Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` } func (x *LogoutReply) Reset() { *x = LogoutReply{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *LogoutReply) String() string { return protoimpl.X.MessageStringOf(x) } func (*LogoutReply) ProtoMessage() {} func (x *LogoutReply) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_use_go_template_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 LogoutReply.ProtoReflect.Descriptor instead. func (*LogoutReply) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_use_go_template_proto_rawDescGZIP(), []int{3} } func (x *LogoutReply) GetMessage() string { if x != nil { return x.Message } return "" } var File_examples_internal_proto_examplepb_use_go_template_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_use_go_template_proto_rawDesc = []byte{ 0x0a, 0x37, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x75, 0x73, 0x65, 0x5f, 0x67, 0x6f, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x3e, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x69, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x61, 0x72, 0x72, 0x61, 0x79, 0x22, 0x27, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xd6, 0x02, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9f, 0x01, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x3c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0xa3, 0x01, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_use_go_template_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_use_go_template_proto_rawDescData = file_examples_internal_proto_examplepb_use_go_template_proto_rawDesc ) func file_examples_internal_proto_examplepb_use_go_template_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_use_go_template_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_use_go_template_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_use_go_template_proto_rawDescData) }) return file_examples_internal_proto_examplepb_use_go_template_proto_rawDescData } var file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_examples_internal_proto_examplepb_use_go_template_proto_goTypes = []interface{}{ (*LoginRequest)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.LoginRequest (*LoginReply)(nil), // 1: grpc.gateway.examples.internal.proto.examplepb.LoginReply (*LogoutRequest)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.LogoutRequest (*LogoutReply)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.LogoutReply } var file_examples_internal_proto_examplepb_use_go_template_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.examplepb.LoginService.Login:input_type -> grpc.gateway.examples.internal.proto.examplepb.LoginRequest 2, // 1: grpc.gateway.examples.internal.proto.examplepb.LoginService.Logout:input_type -> grpc.gateway.examples.internal.proto.examplepb.LogoutRequest 1, // 2: grpc.gateway.examples.internal.proto.examplepb.LoginService.Login:output_type -> grpc.gateway.examples.internal.proto.examplepb.LoginReply 3, // 3: grpc.gateway.examples.internal.proto.examplepb.LoginService.Logout:output_type -> grpc.gateway.examples.internal.proto.examplepb.LogoutReply 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_use_go_template_proto_init() } func file_examples_internal_proto_examplepb_use_go_template_proto_init() { if File_examples_internal_proto_examplepb_use_go_template_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LoginRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LoginReply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogoutRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogoutReply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_use_go_template_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_use_go_template_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_use_go_template_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_use_go_template_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_use_go_template_proto = out.File file_examples_internal_proto_examplepb_use_go_template_proto_rawDesc = nil file_examples_internal_proto_examplepb_use_go_template_proto_goTypes = nil file_examples_internal_proto_examplepb_use_go_template_proto_depIdxs = nil } use_go_template.pb.gw.go000066400000000000000000000241051465037340600351000ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/use_go_template.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_LoginService_Login_0(ctx context.Context, marshaler runtime.Marshaler, client LoginServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LoginRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_LoginService_Login_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LoginRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Login(ctx, &protoReq) return msg, metadata, err } func request_LoginService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client LoginServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LogoutRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_LoginService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LogoutRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Logout(ctx, &protoReq) return msg, metadata, err } // RegisterLoginServiceHandlerServer registers the http handlers for service LoginService to "mux". // UnaryRPC :call LoginServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLoginServiceHandlerFromEndpoint instead. func RegisterLoginServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoginServiceServer) error { mux.Handle("POST", pattern_LoginService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Login", runtime.WithHTTPPathPattern("/v1/example/login")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_LoginService_Login_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_LoginService_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_LoginService_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Logout", runtime.WithHTTPPathPattern("/v1/example/logout")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_LoginService_Logout_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_LoginService_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterLoginServiceHandlerFromEndpoint is same as RegisterLoginServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterLoginServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterLoginServiceHandler(ctx, mux, conn) } // RegisterLoginServiceHandler registers the http handlers for service LoginService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterLoginServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterLoginServiceHandlerClient(ctx, mux, NewLoginServiceClient(conn)) } // RegisterLoginServiceHandlerClient registers the http handlers for service LoginService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LoginServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LoginServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "LoginServiceClient" to call the correct interceptors. func RegisterLoginServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LoginServiceClient) error { mux.Handle("POST", pattern_LoginService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Login", runtime.WithHTTPPathPattern("/v1/example/login")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_LoginService_Login_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_LoginService_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_LoginService_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Logout", runtime.WithHTTPPathPattern("/v1/example/logout")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_LoginService_Logout_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_LoginService_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_LoginService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "login"}, "")) pattern_LoginService_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "logout"}, "")) ) var ( forward_LoginService_Login_0 = runtime.ForwardResponseMessage forward_LoginService_Logout_0 = runtime.ForwardResponseMessage ) use_go_template.proto000066400000000000000000000071611465037340600346250ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; service LoginService { // Login // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} rpc Login(LoginRequest) returns (LoginReply) { option (google.api.http) = { post: "/v1/example/login" body: "*" }; } // Logout // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} rpc Logout(LogoutRequest) returns (LogoutReply) { option (google.api.http) = { post: "/v1/example/logout" body: "*" }; } } message LoginRequest { // The entered username string username = 1; // The entered password string password = 2; } message LoginReply { string message = 1; // Whether you have access or not bool access = 2; } message LogoutRequest { // The time the logout was registered string timeoflogout = 1; // This is the title // // This is the "Description" of field test // you can use as many newlines as you want // // // it will still format the same in the table int32 test = 2; // This is an array // // It displays that using [] infront of the type repeated string stringarray = 3; } message LogoutReply { // Message that tells you whether your // logout was successful or not string message = 1; } use_go_template.swagger.json000066400000000000000000000141241465037340600360660ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/use_go_template.proto", "version": "version not set" }, "tags": [ { "name": "LoginService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/login": { "post": { "summary": "Login", "description": "Login is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LoginRequest\" and returns a \"LoginReply\".\n\n## LoginRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | username | TYPE_STRING | The entered username | \n| 2 | password | TYPE_STRING | The entered password | \n\n## LoginReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | | \n| 2 | access | TYPE_BOOL | Whether you have access or not |", "operationId": "LoginService_Login", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbLoginReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbLoginRequest" } } ], "tags": [ "LoginService" ] } }, "/v1/example/logout": { "post": { "summary": "Logout", "description": "Logout is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LogoutRequest\" and returns a \"LogoutReply\".\n\n## LogoutRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | timeoflogout | TYPE_STRING | The time the logout was registered | \n| 2 | test | TYPE_INT32 | This is the title\u003cbr\u003e\u003cbr\u003eThis is the \"Description\" of field test\u003cbr\u003eyou can use as many newlines as you want\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eit will still format the same in the table | \n| 3 | stringarray | []TYPE_STRING | This is an array\u003cbr\u003e\u003cbr\u003eIt displays that using [] infront of the type | \n\n## LogoutReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | Message that tells you whether your\u003cbr\u003elogout was successful or not |", "operationId": "LoginService_Logout", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbLogoutReply" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbLogoutRequest" } } ], "tags": [ "LoginService" ] } } }, "definitions": { "examplepbLoginReply": { "type": "object", "properties": { "message": { "type": "string" }, "access": { "type": "boolean", "title": "Whether you have access or not" } } }, "examplepbLoginRequest": { "type": "object", "properties": { "username": { "type": "string", "title": "The entered username" }, "password": { "type": "string", "title": "The entered password" } } }, "examplepbLogoutReply": { "type": "object", "properties": { "message": { "type": "string", "title": "Message that tells you whether your\nlogout was successful or not" } } }, "examplepbLogoutRequest": { "type": "object", "properties": { "timeoflogout": { "type": "string", "title": "The time the logout was registered" }, "test": { "type": "integer", "format": "int32", "description": "This is the \"Description\" of field test\nyou can use as many newlines as you want\n\n\nit will still format the same in the table", "title": "This is the title" }, "stringarray": { "type": "array", "items": { "type": "string" }, "description": "It displays that using [] infront of the type", "title": "This is an array" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } use_go_template_grpc.pb.go000066400000000000000000000232361465037340600355030ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/use_go_template.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // LoginServiceClient is the client API for LoginService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type LoginServiceClient interface { // Login // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) // Logout // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error) } type loginServiceClient struct { cc grpc.ClientConnInterface } func NewLoginServiceClient(cc grpc.ClientConnInterface) LoginServiceClient { return &loginServiceClient{cc} } func (c *loginServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) { out := new(LoginReply) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Login", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *loginServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error) { out := new(LogoutReply) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Logout", in, out, opts...) if err != nil { return nil, err } return out, nil } // LoginServiceServer is the server API for LoginService service. // All implementations should embed UnimplementedLoginServiceServer // for forward compatibility type LoginServiceServer interface { // Login // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} Login(context.Context, *LoginRequest) (*LoginReply, error) // Logout // // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". // // ## {{.RequestType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} // // ## {{.ResponseType.Name}} // | Field ID | Name | Type | Description | // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} Logout(context.Context, *LogoutRequest) (*LogoutReply, error) } // UnimplementedLoginServiceServer should be embedded to have forward compatible implementations. type UnimplementedLoginServiceServer struct { } func (UnimplementedLoginServiceServer) Login(context.Context, *LoginRequest) (*LoginReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") } func (UnimplementedLoginServiceServer) Logout(context.Context, *LogoutRequest) (*LogoutReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") } // UnsafeLoginServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to LoginServiceServer will // result in compilation errors. type UnsafeLoginServiceServer interface { mustEmbedUnimplementedLoginServiceServer() } func RegisterLoginServiceServer(s grpc.ServiceRegistrar, srv LoginServiceServer) { s.RegisterService(&LoginService_ServiceDesc, srv) } func _LoginService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(LoginRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(LoginServiceServer).Login(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Login", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LoginServiceServer).Login(ctx, req.(*LoginRequest)) } return interceptor(ctx, in, info, handler) } func _LoginService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(LogoutRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(LoginServiceServer).Logout(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.LoginService/Logout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LoginServiceServer).Logout(ctx, req.(*LogoutRequest)) } return interceptor(ctx, in, info, handler) } // LoginService_ServiceDesc is the grpc.ServiceDesc for LoginService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var LoginService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.LoginService", HandlerType: (*LoginServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Login", Handler: _LoginService_Login_Handler, }, { MethodName: "Logout", Handler: _LoginService_Logout_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/use_go_template.proto", } visibility_rule_echo_service.pb.go000066400000000000000000001257721465037340600372600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/visibility_rule_echo_service.proto // Visibility Rule Echo Service // Similar to echo_service.proto but with annotations to change visibility // of services, methods, fields and enum values. // // `google.api.VisibilityRule` annotations are added to customize where they are generated. // Combined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output. // Elements without `google.api.VisibilityRule` annotations will appear as usual in the generated output. // // These restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want. // In this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish. package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" _ "google.golang.org/genproto/googleapis/api/visibility" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // EnumInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". type VisibilityRuleEnumInPreviewMethod int32 const ( VisibilityRuleEnumInPreviewMethod_VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED VisibilityRuleEnumInPreviewMethod = 0 ) // Enum value maps for VisibilityRuleEnumInPreviewMethod. var ( VisibilityRuleEnumInPreviewMethod_name = map[int32]string{ 0: "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED", } VisibilityRuleEnumInPreviewMethod_value = map[string]int32{ "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED": 0, } ) func (x VisibilityRuleEnumInPreviewMethod) Enum() *VisibilityRuleEnumInPreviewMethod { p := new(VisibilityRuleEnumInPreviewMethod) *p = x return p } func (x VisibilityRuleEnumInPreviewMethod) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (VisibilityRuleEnumInPreviewMethod) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes[0].Descriptor() } func (VisibilityRuleEnumInPreviewMethod) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes[0] } func (x VisibilityRuleEnumInPreviewMethod) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use VisibilityRuleEnumInPreviewMethod.Descriptor instead. func (VisibilityRuleEnumInPreviewMethod) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{0} } type VisibilityRuleSimpleMessage_VisibilityEnum int32 const ( VisibilityRuleSimpleMessage_VISIBILITY_ENUM_UNSPECIFIED VisibilityRuleSimpleMessage_VisibilityEnum = 0 VisibilityRuleSimpleMessage_VISIBILITY_ENUM_VISIBLE VisibilityRuleSimpleMessage_VisibilityEnum = 1 VisibilityRuleSimpleMessage_VISIBILITY_ENUM_INTERNAL VisibilityRuleSimpleMessage_VisibilityEnum = 2 VisibilityRuleSimpleMessage_VISIBILITY_ENUM_PREVIEW VisibilityRuleSimpleMessage_VisibilityEnum = 3 ) // Enum value maps for VisibilityRuleSimpleMessage_VisibilityEnum. var ( VisibilityRuleSimpleMessage_VisibilityEnum_name = map[int32]string{ 0: "VISIBILITY_ENUM_UNSPECIFIED", 1: "VISIBILITY_ENUM_VISIBLE", 2: "VISIBILITY_ENUM_INTERNAL", 3: "VISIBILITY_ENUM_PREVIEW", } VisibilityRuleSimpleMessage_VisibilityEnum_value = map[string]int32{ "VISIBILITY_ENUM_UNSPECIFIED": 0, "VISIBILITY_ENUM_VISIBLE": 1, "VISIBILITY_ENUM_INTERNAL": 2, "VISIBILITY_ENUM_PREVIEW": 3, } ) func (x VisibilityRuleSimpleMessage_VisibilityEnum) Enum() *VisibilityRuleSimpleMessage_VisibilityEnum { p := new(VisibilityRuleSimpleMessage_VisibilityEnum) *p = x return p } func (x VisibilityRuleSimpleMessage_VisibilityEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (VisibilityRuleSimpleMessage_VisibilityEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes[1].Descriptor() } func (VisibilityRuleSimpleMessage_VisibilityEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes[1] } func (x VisibilityRuleSimpleMessage_VisibilityEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use VisibilityRuleSimpleMessage_VisibilityEnum.Descriptor instead. func (VisibilityRuleSimpleMessage_VisibilityEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{1, 0} } // Embedded represents a message embedded in SimpleMessage. type VisibilityRuleEmbedded struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Mark: // // *VisibilityRuleEmbedded_Progress // *VisibilityRuleEmbedded_Note // *VisibilityRuleEmbedded_InternalField // *VisibilityRuleEmbedded_PreviewField Mark isVisibilityRuleEmbedded_Mark `protobuf_oneof:"mark"` } func (x *VisibilityRuleEmbedded) Reset() { *x = VisibilityRuleEmbedded{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VisibilityRuleEmbedded) String() string { return protoimpl.X.MessageStringOf(x) } func (*VisibilityRuleEmbedded) ProtoMessage() {} func (x *VisibilityRuleEmbedded) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_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 VisibilityRuleEmbedded.ProtoReflect.Descriptor instead. func (*VisibilityRuleEmbedded) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{0} } func (m *VisibilityRuleEmbedded) GetMark() isVisibilityRuleEmbedded_Mark { if m != nil { return m.Mark } return nil } func (x *VisibilityRuleEmbedded) GetProgress() int64 { if x, ok := x.GetMark().(*VisibilityRuleEmbedded_Progress); ok { return x.Progress } return 0 } func (x *VisibilityRuleEmbedded) GetNote() string { if x, ok := x.GetMark().(*VisibilityRuleEmbedded_Note); ok { return x.Note } return "" } func (x *VisibilityRuleEmbedded) GetInternalField() string { if x, ok := x.GetMark().(*VisibilityRuleEmbedded_InternalField); ok { return x.InternalField } return "" } func (x *VisibilityRuleEmbedded) GetPreviewField() string { if x, ok := x.GetMark().(*VisibilityRuleEmbedded_PreviewField); ok { return x.PreviewField } return "" } type isVisibilityRuleEmbedded_Mark interface { isVisibilityRuleEmbedded_Mark() } type VisibilityRuleEmbedded_Progress struct { Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` } type VisibilityRuleEmbedded_Note struct { Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` } type VisibilityRuleEmbedded_InternalField struct { InternalField string `protobuf:"bytes,3,opt,name=internal_field,json=internalField,proto3,oneof"` } type VisibilityRuleEmbedded_PreviewField struct { PreviewField string `protobuf:"bytes,4,opt,name=preview_field,json=previewField,proto3,oneof"` } func (*VisibilityRuleEmbedded_Progress) isVisibilityRuleEmbedded_Mark() {} func (*VisibilityRuleEmbedded_Note) isVisibilityRuleEmbedded_Mark() {} func (*VisibilityRuleEmbedded_InternalField) isVisibilityRuleEmbedded_Mark() {} func (*VisibilityRuleEmbedded_PreviewField) isVisibilityRuleEmbedded_Mark() {} // SimpleMessage represents a simple message sent to the Echo service. type VisibilityRuleSimpleMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` // Types that are assignable to Code: // // *VisibilityRuleSimpleMessage_LineNum // *VisibilityRuleSimpleMessage_Lang Code isVisibilityRuleSimpleMessage_Code `protobuf_oneof:"code"` Status *VisibilityRuleEmbedded `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` // Types that are assignable to Ext: // // *VisibilityRuleSimpleMessage_En // *VisibilityRuleSimpleMessage_No Ext isVisibilityRuleSimpleMessage_Ext `protobuf_oneof:"ext"` InternalField string `protobuf:"bytes,8,opt,name=internal_field,json=internalField,proto3" json:"internal_field,omitempty"` PreviewField string `protobuf:"bytes,9,opt,name=preview_field,json=previewField,proto3" json:"preview_field,omitempty"` AnEnum VisibilityRuleSimpleMessage_VisibilityEnum `protobuf:"varint,10,opt,name=an_enum,json=anEnum,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage_VisibilityEnum" json:"an_enum,omitempty"` } func (x *VisibilityRuleSimpleMessage) Reset() { *x = VisibilityRuleSimpleMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VisibilityRuleSimpleMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*VisibilityRuleSimpleMessage) ProtoMessage() {} func (x *VisibilityRuleSimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_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 VisibilityRuleSimpleMessage.ProtoReflect.Descriptor instead. func (*VisibilityRuleSimpleMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{1} } func (x *VisibilityRuleSimpleMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *VisibilityRuleSimpleMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (m *VisibilityRuleSimpleMessage) GetCode() isVisibilityRuleSimpleMessage_Code { if m != nil { return m.Code } return nil } func (x *VisibilityRuleSimpleMessage) GetLineNum() int64 { if x, ok := x.GetCode().(*VisibilityRuleSimpleMessage_LineNum); ok { return x.LineNum } return 0 } func (x *VisibilityRuleSimpleMessage) GetLang() string { if x, ok := x.GetCode().(*VisibilityRuleSimpleMessage_Lang); ok { return x.Lang } return "" } func (x *VisibilityRuleSimpleMessage) GetStatus() *VisibilityRuleEmbedded { if x != nil { return x.Status } return nil } func (m *VisibilityRuleSimpleMessage) GetExt() isVisibilityRuleSimpleMessage_Ext { if m != nil { return m.Ext } return nil } func (x *VisibilityRuleSimpleMessage) GetEn() int64 { if x, ok := x.GetExt().(*VisibilityRuleSimpleMessage_En); ok { return x.En } return 0 } func (x *VisibilityRuleSimpleMessage) GetNo() *VisibilityRuleEmbedded { if x, ok := x.GetExt().(*VisibilityRuleSimpleMessage_No); ok { return x.No } return nil } func (x *VisibilityRuleSimpleMessage) GetInternalField() string { if x != nil { return x.InternalField } return "" } func (x *VisibilityRuleSimpleMessage) GetPreviewField() string { if x != nil { return x.PreviewField } return "" } func (x *VisibilityRuleSimpleMessage) GetAnEnum() VisibilityRuleSimpleMessage_VisibilityEnum { if x != nil { return x.AnEnum } return VisibilityRuleSimpleMessage_VISIBILITY_ENUM_UNSPECIFIED } type isVisibilityRuleSimpleMessage_Code interface { isVisibilityRuleSimpleMessage_Code() } type VisibilityRuleSimpleMessage_LineNum struct { LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"` } type VisibilityRuleSimpleMessage_Lang struct { Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"` } func (*VisibilityRuleSimpleMessage_LineNum) isVisibilityRuleSimpleMessage_Code() {} func (*VisibilityRuleSimpleMessage_Lang) isVisibilityRuleSimpleMessage_Code() {} type isVisibilityRuleSimpleMessage_Ext interface { isVisibilityRuleSimpleMessage_Ext() } type VisibilityRuleSimpleMessage_En struct { En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` } type VisibilityRuleSimpleMessage_No struct { No *VisibilityRuleEmbedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` } func (*VisibilityRuleSimpleMessage_En) isVisibilityRuleSimpleMessage_Ext() {} func (*VisibilityRuleSimpleMessage_No) isVisibilityRuleSimpleMessage_Ext() {} // MessageInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". type VisibilityRuleMessageInPreviewMethod struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` SubMessage *VisibilityRuleSubMessageInPreviewMethod `protobuf:"bytes,2,opt,name=sub_message,json=subMessage,proto3" json:"sub_message,omitempty"` Enum VisibilityRuleEnumInPreviewMethod `protobuf:"varint,3,opt,name=enum,proto3,enum=grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEnumInPreviewMethod" json:"enum,omitempty"` } func (x *VisibilityRuleMessageInPreviewMethod) Reset() { *x = VisibilityRuleMessageInPreviewMethod{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VisibilityRuleMessageInPreviewMethod) String() string { return protoimpl.X.MessageStringOf(x) } func (*VisibilityRuleMessageInPreviewMethod) ProtoMessage() {} func (x *VisibilityRuleMessageInPreviewMethod) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_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 VisibilityRuleMessageInPreviewMethod.ProtoReflect.Descriptor instead. func (*VisibilityRuleMessageInPreviewMethod) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{2} } func (x *VisibilityRuleMessageInPreviewMethod) GetId() string { if x != nil { return x.Id } return "" } func (x *VisibilityRuleMessageInPreviewMethod) GetSubMessage() *VisibilityRuleSubMessageInPreviewMethod { if x != nil { return x.SubMessage } return nil } func (x *VisibilityRuleMessageInPreviewMethod) GetEnum() VisibilityRuleEnumInPreviewMethod { if x != nil { return x.Enum } return VisibilityRuleEnumInPreviewMethod_VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED } // SubMessageInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". type VisibilityRuleSubMessageInPreviewMethod struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *VisibilityRuleSubMessageInPreviewMethod) Reset() { *x = VisibilityRuleSubMessageInPreviewMethod{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VisibilityRuleSubMessageInPreviewMethod) String() string { return protoimpl.X.MessageStringOf(x) } func (*VisibilityRuleSubMessageInPreviewMethod) ProtoMessage() {} func (x *VisibilityRuleSubMessageInPreviewMethod) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_visibility_rule_echo_service_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 VisibilityRuleSubMessageInPreviewMethod.ProtoReflect.Descriptor instead. func (*VisibilityRuleSubMessageInPreviewMethod) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP(), []int{3} } func (x *VisibilityRuleSubMessageInPreviewMethod) GetId() string { if x != nil { return x.Id } return "" } var File_examples_internal_proto_examplepb_visibility_rule_echo_service_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDesc = []byte{ 0x0a, 0x44, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x01, 0x0a, 0x16, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3f, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x2c, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0xf2, 0x05, 0x0a, 0x1b, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1b, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x5e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x02, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x02, 0x65, 0x6e, 0x12, 0x58, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x48, 0x01, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x37, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x52, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x2c, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x52, 0x0c, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x73, 0x0a, 0x07, 0x61, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x5a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x61, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x22, 0xb5, 0x01, 0x0a, 0x0e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x1b, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x2e, 0x0a, 0x18, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x1a, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x35, 0x0a, 0x17, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x10, 0x03, 0x1a, 0x18, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x2c, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x65, 0x78, 0x74, 0x22, 0x97, 0x02, 0x0a, 0x24, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x78, 0x0a, 0x0b, 0x73, 0x75, 0x62, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x65, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x51, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x39, 0x0a, 0x27, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x2a, 0x5b, 0x0a, 0x21, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x36, 0x0a, 0x32, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x32, 0x9b, 0x07, 0x0a, 0x19, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xbf, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xdb, 0x01, 0x0a, 0x0c, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x31, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0xe1, 0x01, 0x0a, 0x0b, 0x45, 0x63, 0x68, 0x6f, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x54, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x2f, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x09, 0x12, 0x07, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0xf9, 0x01, 0x0a, 0x16, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x45, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x2c, 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x32, 0x80, 0x02, 0x0a, 0x21, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc8, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x1a, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x42, 0x57, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x3b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescData = file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDesc ) func file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescData) }) return file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDescData } var file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_goTypes = []interface{}{ (VisibilityRuleEnumInPreviewMethod)(0), // 0: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEnumInPreviewMethod (VisibilityRuleSimpleMessage_VisibilityEnum)(0), // 1: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage.VisibilityEnum (*VisibilityRuleEmbedded)(nil), // 2: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEmbedded (*VisibilityRuleSimpleMessage)(nil), // 3: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage (*VisibilityRuleMessageInPreviewMethod)(nil), // 4: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleMessageInPreviewMethod (*VisibilityRuleSubMessageInPreviewMethod)(nil), // 5: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSubMessageInPreviewMethod } var file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_depIdxs = []int32{ 2, // 0: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage.status:type_name -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEmbedded 2, // 1: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage.no:type_name -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEmbedded 1, // 2: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage.an_enum:type_name -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage.VisibilityEnum 5, // 3: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleMessageInPreviewMethod.sub_message:type_name -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSubMessageInPreviewMethod 0, // 4: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleMessageInPreviewMethod.enum:type_name -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEnumInPreviewMethod 3, // 5: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 6: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoInternal:input_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 7: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoPreview:input_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 8: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoInternalAndPreview:input_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 9: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService.Echo:input_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 10: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 11: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoInternal:output_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 4, // 12: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoPreview:output_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleMessageInPreviewMethod 3, // 13: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService.EchoInternalAndPreview:output_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 3, // 14: grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService.Echo:output_type -> grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleSimpleMessage 10, // [10:15] is the sub-list for method output_type 5, // [5:10] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension extendee 0, // [0:5] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_init() } func file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_init() { if File_examples_internal_proto_examplepb_visibility_rule_echo_service_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VisibilityRuleEmbedded); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VisibilityRuleSimpleMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VisibilityRuleMessageInPreviewMethod); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VisibilityRuleSubMessageInPreviewMethod); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[0].OneofWrappers = []interface{}{ (*VisibilityRuleEmbedded_Progress)(nil), (*VisibilityRuleEmbedded_Note)(nil), (*VisibilityRuleEmbedded_InternalField)(nil), (*VisibilityRuleEmbedded_PreviewField)(nil), } file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes[1].OneofWrappers = []interface{}{ (*VisibilityRuleSimpleMessage_LineNum)(nil), (*VisibilityRuleSimpleMessage_Lang)(nil), (*VisibilityRuleSimpleMessage_En)(nil), (*VisibilityRuleSimpleMessage_No)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDesc, NumEnums: 2, NumMessages: 4, NumExtensions: 0, NumServices: 2, }, GoTypes: file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_depIdxs, EnumInfos: file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_enumTypes, MessageInfos: file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_visibility_rule_echo_service_proto = out.File file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_rawDesc = nil file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_goTypes = nil file_examples_internal_proto_examplepb_visibility_rule_echo_service_proto_depIdxs = nil } visibility_rule_echo_service.pb.gw.go000066400000000000000000000720411465037340600376620ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/visibility_rule_echo_service.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_VisibilityRuleEchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_VisibilityRuleEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client VisibilityRuleEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_VisibilityRuleEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server VisibilityRuleEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_VisibilityRuleEchoService_EchoInternal_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_VisibilityRuleEchoService_EchoInternal_0(ctx context.Context, marshaler runtime.Marshaler, client VisibilityRuleEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoInternal_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoInternal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_VisibilityRuleEchoService_EchoInternal_0(ctx context.Context, marshaler runtime.Marshaler, server VisibilityRuleEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoInternal_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoInternal(ctx, &protoReq) return msg, metadata, err } var ( filter_VisibilityRuleEchoService_EchoPreview_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_VisibilityRuleEchoService_EchoPreview_0(ctx context.Context, marshaler runtime.Marshaler, client VisibilityRuleEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoPreview_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoPreview(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_VisibilityRuleEchoService_EchoPreview_0(ctx context.Context, marshaler runtime.Marshaler, server VisibilityRuleEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoPreview_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoPreview(ctx, &protoReq) return msg, metadata, err } var ( filter_VisibilityRuleEchoService_EchoInternalAndPreview_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_VisibilityRuleEchoService_EchoInternalAndPreview_0(ctx context.Context, marshaler runtime.Marshaler, client VisibilityRuleEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoInternalAndPreview_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoInternalAndPreview(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_VisibilityRuleEchoService_EchoInternalAndPreview_0(ctx context.Context, marshaler runtime.Marshaler, server VisibilityRuleEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleEchoService_EchoInternalAndPreview_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoInternalAndPreview(ctx, &protoReq) return msg, metadata, err } var ( filter_VisibilityRuleInternalEchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_VisibilityRuleInternalEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client VisibilityRuleInternalEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleInternalEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_VisibilityRuleInternalEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server VisibilityRuleInternalEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq VisibilityRuleSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_VisibilityRuleInternalEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } // RegisterVisibilityRuleEchoServiceHandlerServer registers the http handlers for service VisibilityRuleEchoService to "mux". // UnaryRPC :call VisibilityRuleEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterVisibilityRuleEchoServiceHandlerFromEndpoint instead. func RegisterVisibilityRuleEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VisibilityRuleEchoServiceServer) error { mux.Handle("POST", pattern_VisibilityRuleEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_VisibilityRuleEchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoInternal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternal", runtime.WithHTTPPathPattern("/v1/example/echo_internal")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_VisibilityRuleEchoService_EchoInternal_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoInternal_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoPreview_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoPreview", runtime.WithHTTPPathPattern("/v1/example/echo_preview")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_VisibilityRuleEchoService_EchoPreview_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoPreview_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoInternalAndPreview_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternalAndPreview", runtime.WithHTTPPathPattern("/v1/example/echo_internal_and_preview")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_VisibilityRuleEchoService_EchoInternalAndPreview_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoInternalAndPreview_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterVisibilityRuleInternalEchoServiceHandlerServer registers the http handlers for service VisibilityRuleInternalEchoService to "mux". // UnaryRPC :call VisibilityRuleInternalEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterVisibilityRuleInternalEchoServiceHandlerFromEndpoint instead. func RegisterVisibilityRuleInternalEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VisibilityRuleInternalEchoServiceServer) error { mux.Handle("POST", pattern_VisibilityRuleInternalEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/internal/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_VisibilityRuleInternalEchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleInternalEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterVisibilityRuleEchoServiceHandlerFromEndpoint is same as RegisterVisibilityRuleEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterVisibilityRuleEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterVisibilityRuleEchoServiceHandler(ctx, mux, conn) } // RegisterVisibilityRuleEchoServiceHandler registers the http handlers for service VisibilityRuleEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterVisibilityRuleEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterVisibilityRuleEchoServiceHandlerClient(ctx, mux, NewVisibilityRuleEchoServiceClient(conn)) } // RegisterVisibilityRuleEchoServiceHandlerClient registers the http handlers for service VisibilityRuleEchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VisibilityRuleEchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VisibilityRuleEchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "VisibilityRuleEchoServiceClient" to call the correct interceptors. func RegisterVisibilityRuleEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VisibilityRuleEchoServiceClient) error { mux.Handle("POST", pattern_VisibilityRuleEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_VisibilityRuleEchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoInternal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternal", runtime.WithHTTPPathPattern("/v1/example/echo_internal")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_VisibilityRuleEchoService_EchoInternal_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoInternal_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoPreview_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoPreview", runtime.WithHTTPPathPattern("/v1/example/echo_preview")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_VisibilityRuleEchoService_EchoPreview_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoPreview_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_VisibilityRuleEchoService_EchoInternalAndPreview_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternalAndPreview", runtime.WithHTTPPathPattern("/v1/example/echo_internal_and_preview")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_VisibilityRuleEchoService_EchoInternalAndPreview_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleEchoService_EchoInternalAndPreview_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_VisibilityRuleEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) pattern_VisibilityRuleEchoService_EchoInternal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_internal"}, "")) pattern_VisibilityRuleEchoService_EchoPreview_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_preview"}, "")) pattern_VisibilityRuleEchoService_EchoInternalAndPreview_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_internal_and_preview"}, "")) ) var ( forward_VisibilityRuleEchoService_Echo_0 = runtime.ForwardResponseMessage forward_VisibilityRuleEchoService_EchoInternal_0 = runtime.ForwardResponseMessage forward_VisibilityRuleEchoService_EchoPreview_0 = runtime.ForwardResponseMessage forward_VisibilityRuleEchoService_EchoInternalAndPreview_0 = runtime.ForwardResponseMessage ) // RegisterVisibilityRuleInternalEchoServiceHandlerFromEndpoint is same as RegisterVisibilityRuleInternalEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterVisibilityRuleInternalEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterVisibilityRuleInternalEchoServiceHandler(ctx, mux, conn) } // RegisterVisibilityRuleInternalEchoServiceHandler registers the http handlers for service VisibilityRuleInternalEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterVisibilityRuleInternalEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterVisibilityRuleInternalEchoServiceHandlerClient(ctx, mux, NewVisibilityRuleInternalEchoServiceClient(conn)) } // RegisterVisibilityRuleInternalEchoServiceHandlerClient registers the http handlers for service VisibilityRuleInternalEchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VisibilityRuleInternalEchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VisibilityRuleInternalEchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "VisibilityRuleInternalEchoServiceClient" to call the correct interceptors. func RegisterVisibilityRuleInternalEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VisibilityRuleInternalEchoServiceClient) error { mux.Handle("POST", pattern_VisibilityRuleInternalEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService/Echo", runtime.WithHTTPPathPattern("/v1/example/internal/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_VisibilityRuleInternalEchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_VisibilityRuleInternalEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_VisibilityRuleInternalEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "internal", "echo", "id"}, "")) ) var ( forward_VisibilityRuleInternalEchoService_Echo_0 = runtime.ForwardResponseMessage ) visibility_rule_echo_service.proto000066400000000000000000000126431465037340600374060ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbsyntax = "proto3"; // Visibility Rule Echo Service // Similar to echo_service.proto but with annotations to change visibility // of services, methods, fields and enum values. // // `google.api.VisibilityRule` annotations are added to customize where they are generated. // Combined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output. // Elements without `google.api.VisibilityRule` annotations will appear as usual in the generated output. // // These restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want. // In this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish. package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; import "google/api/visibility.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb;examplepb"; // Embedded represents a message embedded in SimpleMessage. message VisibilityRuleEmbedded { oneof mark { int64 progress = 1; string note = 2; string internal_field = 3 [(google.api.field_visibility).restriction = "INTERNAL"]; string preview_field = 4 [(google.api.field_visibility).restriction = "INTERNAL,PREVIEW"]; } } // SimpleMessage represents a simple message sent to the Echo service. message VisibilityRuleSimpleMessage { enum VisibilityEnum { VISIBILITY_ENUM_UNSPECIFIED = 0; VISIBILITY_ENUM_VISIBLE = 1; VISIBILITY_ENUM_INTERNAL = 2 [(google.api.value_visibility).restriction = "INTERNAL"]; VISIBILITY_ENUM_PREVIEW = 3 [(google.api.value_visibility).restriction = "INTERNAL,PREVIEW"]; } // Id represents the message identifier. string id = 1; int64 num = 2; oneof code { int64 line_num = 3; string lang = 4; } VisibilityRuleEmbedded status = 5; oneof ext { int64 en = 6; VisibilityRuleEmbedded no = 7; } string internal_field = 8 [(google.api.field_visibility).restriction = "INTERNAL"]; string preview_field = 9 [(google.api.field_visibility).restriction = "INTERNAL,PREVIEW"]; VisibilityEnum an_enum = 10; } // MessageInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". message VisibilityRuleMessageInPreviewMethod { string id = 1; VisibilityRuleSubMessageInPreviewMethod sub_message = 2; VisibilityRuleEnumInPreviewMethod enum = 3; } // SubMessageInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". message VisibilityRuleSubMessageInPreviewMethod { string id = 1; } // EnumInPreviewMethod doesn't define its own visibility restrictions, // but is only included in a method marked as "PREVIEW", so it will only // appear if `visibility_restriction_selectors` include "PREVIEW". enum VisibilityRuleEnumInPreviewMethod { VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED = 0; } // VisibilityRuleEchoService service responds to incoming echo requests. // Different services will be available in the swagger documentation depending // based on `google.api.VisibilityRule`s and the set `visibility_restriction_selectors` // flag when calling protoc-gen-openapiv2. service VisibilityRuleEchoService { // Echo method receives a simple message and returns it. // It should always be visible in the open API output. rpc Echo(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.http) = {post: "/v1/example/echo/{id}"}; } // EchoInternal is an internal API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "INTERNAL". rpc EchoInternal(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.method_visibility).restriction = "INTERNAL"; option (google.api.http) = {get: "/v1/example/echo_internal"}; } // EchoPreview is a preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW". rpc EchoPreview(VisibilityRuleSimpleMessage) returns (VisibilityRuleMessageInPreviewMethod) { option (google.api.method_visibility).restriction = "PREVIEW"; option (google.api.http) = {get: "/v1/example/echo_preview"}; } // EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW" or "INTERNAL". rpc EchoInternalAndPreview(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.method_visibility).restriction = "INTERNAL,PREVIEW"; option (google.api.http) = {get: "/v1/example/echo_internal_and_preview"}; } } // VisibilityRuleInternalEchoService service responds to incoming echo requests. // It should only be visible in the OpenAPI spec if `visibility_restriction_selectors` includes "INTERNAL". service VisibilityRuleInternalEchoService { option (google.api.api_visibility).restriction = "INTERNAL"; // Echo method receives a simple message and returns it. // It should not be visible in the open API output. rpc Echo(VisibilityRuleSimpleMessage) returns (VisibilityRuleSimpleMessage) { option (google.api.http) = {post: "/v1/example/internal/echo/{id}"}; } } visibility_rule_echo_service_grpc.pb.go000066400000000000000000000353561465037340600402710ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/visibility_rule_echo_service.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // VisibilityRuleEchoServiceClient is the client API for VisibilityRuleEchoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type VisibilityRuleEchoServiceClient interface { // Echo method receives a simple message and returns it. // It should always be visible in the open API output. Echo(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) // EchoInternal is an internal API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "INTERNAL". EchoInternal(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) // EchoPreview is a preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW". EchoPreview(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleMessageInPreviewMethod, error) // EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW" or "INTERNAL". EchoInternalAndPreview(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) } type visibilityRuleEchoServiceClient struct { cc grpc.ClientConnInterface } func NewVisibilityRuleEchoServiceClient(cc grpc.ClientConnInterface) VisibilityRuleEchoServiceClient { return &visibilityRuleEchoServiceClient{cc} } func (c *visibilityRuleEchoServiceClient) Echo(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) { out := new(VisibilityRuleSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *visibilityRuleEchoServiceClient) EchoInternal(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) { out := new(VisibilityRuleSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternal", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *visibilityRuleEchoServiceClient) EchoPreview(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleMessageInPreviewMethod, error) { out := new(VisibilityRuleMessageInPreviewMethod) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoPreview", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *visibilityRuleEchoServiceClient) EchoInternalAndPreview(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) { out := new(VisibilityRuleSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternalAndPreview", in, out, opts...) if err != nil { return nil, err } return out, nil } // VisibilityRuleEchoServiceServer is the server API for VisibilityRuleEchoService service. // All implementations should embed UnimplementedVisibilityRuleEchoServiceServer // for forward compatibility type VisibilityRuleEchoServiceServer interface { // Echo method receives a simple message and returns it. // It should always be visible in the open API output. Echo(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) // EchoInternal is an internal API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "INTERNAL". EchoInternal(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) // EchoPreview is a preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW". EchoPreview(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleMessageInPreviewMethod, error) // EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec // if `visibility_restriction_selectors` includes "PREVIEW" or "INTERNAL". EchoInternalAndPreview(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) } // UnimplementedVisibilityRuleEchoServiceServer should be embedded to have forward compatible implementations. type UnimplementedVisibilityRuleEchoServiceServer struct { } func (UnimplementedVisibilityRuleEchoServiceServer) Echo(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } func (UnimplementedVisibilityRuleEchoServiceServer) EchoInternal(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoInternal not implemented") } func (UnimplementedVisibilityRuleEchoServiceServer) EchoPreview(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleMessageInPreviewMethod, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoPreview not implemented") } func (UnimplementedVisibilityRuleEchoServiceServer) EchoInternalAndPreview(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method EchoInternalAndPreview not implemented") } // UnsafeVisibilityRuleEchoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VisibilityRuleEchoServiceServer will // result in compilation errors. type UnsafeVisibilityRuleEchoServiceServer interface { mustEmbedUnimplementedVisibilityRuleEchoServiceServer() } func RegisterVisibilityRuleEchoServiceServer(s grpc.ServiceRegistrar, srv VisibilityRuleEchoServiceServer) { s.RegisterService(&VisibilityRuleEchoService_ServiceDesc, srv) } func _VisibilityRuleEchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VisibilityRuleSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(VisibilityRuleEchoServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VisibilityRuleEchoServiceServer).Echo(ctx, req.(*VisibilityRuleSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _VisibilityRuleEchoService_EchoInternal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VisibilityRuleSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(VisibilityRuleEchoServiceServer).EchoInternal(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VisibilityRuleEchoServiceServer).EchoInternal(ctx, req.(*VisibilityRuleSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _VisibilityRuleEchoService_EchoPreview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VisibilityRuleSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(VisibilityRuleEchoServiceServer).EchoPreview(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoPreview", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VisibilityRuleEchoServiceServer).EchoPreview(ctx, req.(*VisibilityRuleSimpleMessage)) } return interceptor(ctx, in, info, handler) } func _VisibilityRuleEchoService_EchoInternalAndPreview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VisibilityRuleSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(VisibilityRuleEchoServiceServer).EchoInternalAndPreview(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService/EchoInternalAndPreview", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VisibilityRuleEchoServiceServer).EchoInternalAndPreview(ctx, req.(*VisibilityRuleSimpleMessage)) } return interceptor(ctx, in, info, handler) } // VisibilityRuleEchoService_ServiceDesc is the grpc.ServiceDesc for VisibilityRuleEchoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var VisibilityRuleEchoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleEchoService", HandlerType: (*VisibilityRuleEchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _VisibilityRuleEchoService_Echo_Handler, }, { MethodName: "EchoInternal", Handler: _VisibilityRuleEchoService_EchoInternal_Handler, }, { MethodName: "EchoPreview", Handler: _VisibilityRuleEchoService_EchoPreview_Handler, }, { MethodName: "EchoInternalAndPreview", Handler: _VisibilityRuleEchoService_EchoInternalAndPreview_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", } // VisibilityRuleInternalEchoServiceClient is the client API for VisibilityRuleInternalEchoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type VisibilityRuleInternalEchoServiceClient interface { // Echo method receives a simple message and returns it. // It should not be visible in the open API output. Echo(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) } type visibilityRuleInternalEchoServiceClient struct { cc grpc.ClientConnInterface } func NewVisibilityRuleInternalEchoServiceClient(cc grpc.ClientConnInterface) VisibilityRuleInternalEchoServiceClient { return &visibilityRuleInternalEchoServiceClient{cc} } func (c *visibilityRuleInternalEchoServiceClient) Echo(ctx context.Context, in *VisibilityRuleSimpleMessage, opts ...grpc.CallOption) (*VisibilityRuleSimpleMessage, error) { out := new(VisibilityRuleSimpleMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } // VisibilityRuleInternalEchoServiceServer is the server API for VisibilityRuleInternalEchoService service. // All implementations should embed UnimplementedVisibilityRuleInternalEchoServiceServer // for forward compatibility type VisibilityRuleInternalEchoServiceServer interface { // Echo method receives a simple message and returns it. // It should not be visible in the open API output. Echo(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) } // UnimplementedVisibilityRuleInternalEchoServiceServer should be embedded to have forward compatible implementations. type UnimplementedVisibilityRuleInternalEchoServiceServer struct { } func (UnimplementedVisibilityRuleInternalEchoServiceServer) Echo(context.Context, *VisibilityRuleSimpleMessage) (*VisibilityRuleSimpleMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") } // UnsafeVisibilityRuleInternalEchoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VisibilityRuleInternalEchoServiceServer will // result in compilation errors. type UnsafeVisibilityRuleInternalEchoServiceServer interface { mustEmbedUnimplementedVisibilityRuleInternalEchoServiceServer() } func RegisterVisibilityRuleInternalEchoServiceServer(s grpc.ServiceRegistrar, srv VisibilityRuleInternalEchoServiceServer) { s.RegisterService(&VisibilityRuleInternalEchoService_ServiceDesc, srv) } func _VisibilityRuleInternalEchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VisibilityRuleSimpleMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(VisibilityRuleInternalEchoServiceServer).Echo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VisibilityRuleInternalEchoServiceServer).Echo(ctx, req.(*VisibilityRuleSimpleMessage)) } return interceptor(ctx, in, info, handler) } // VisibilityRuleInternalEchoService_ServiceDesc is the grpc.ServiceDesc for VisibilityRuleInternalEchoService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var VisibilityRuleInternalEchoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.VisibilityRuleInternalEchoService", HandlerType: (*VisibilityRuleInternalEchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _VisibilityRuleInternalEchoService_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", } visibility_rule_enums_as_ints_echo_service.buf.gen.yaml000066400000000000000000000001301465037340600434430ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - enums_as_ints=true visibility_rule_enums_as_ints_echo_service.swagger.json000066400000000000000000000127341465037340600436020ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", "description": "Visibility Rule Echo Service\nSimilar to echo_service.proto but with annotations to change visibility\nof services, methods, fields and enum values.\n\n`google.api.VisibilityRule` annotations are added to customize where they are generated.\nCombined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output.\nElements without `google.api.VisibilityRule` annotations will appear as usual in the generated output.\n\nThese restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want.\nIn this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish.", "version": "version not set" }, "tags": [ { "name": "VisibilityRuleEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should always be visible in the open API output.", "operationId": "VisibilityRuleEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "integer", "enum": [ 0, 1 ], "default": 0 } ], "tags": [ "VisibilityRuleEchoService" ] } } }, "definitions": { "VisibilityRuleSimpleMessageVisibilityEnum": { "type": "integer", "format": "int32", "enum": [ 0, 1 ], "default": 0 }, "examplepbVisibilityRuleEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbVisibilityRuleSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "anEnum": { "$ref": "#/definitions/VisibilityRuleSimpleMessageVisibilityEnum" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } visibility_rule_internal_echo_service.buf.gen.yaml000066400000000000000000000001561465037340600424200ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - visibility_restriction_selectors=INTERNAL visibility_rule_internal_echo_service.swagger.json000066400000000000000000000431571465037340600425520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", "description": "Visibility Rule Echo Service\nSimilar to echo_service.proto but with annotations to change visibility\nof services, methods, fields and enum values.\n\n`google.api.VisibilityRule` annotations are added to customize where they are generated.\nCombined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output.\nElements without `google.api.VisibilityRule` annotations will appear as usual in the generated output.\n\nThese restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want.\nIn this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish.", "version": "version not set" }, "tags": [ { "name": "VisibilityRuleEchoService" }, { "name": "VisibilityRuleInternalEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should always be visible in the open API output.", "operationId": "VisibilityRuleEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_internal": { "get": { "summary": "EchoInternal is an internal API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"INTERNAL\".", "operationId": "VisibilityRuleEchoService_EchoInternal", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_internal_and_preview": { "get": { "summary": "EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"PREVIEW\" or \"INTERNAL\".", "operationId": "VisibilityRuleEchoService_EchoInternalAndPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/internal/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should not be visible in the open API output.", "operationId": "VisibilityRuleInternalEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleInternalEchoService" ] } } }, "definitions": { "VisibilityRuleSimpleMessageVisibilityEnum": { "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" }, "examplepbVisibilityRuleEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" }, "internalField": { "type": "string" }, "previewField": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbVisibilityRuleSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "internalField": { "type": "string" }, "previewField": { "type": "string" }, "anEnum": { "$ref": "#/definitions/VisibilityRuleSimpleMessageVisibilityEnum" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } visibility_rule_none_echo_service.buf.gen.yaml000066400000000000000000000000641465037340600415410ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . visibility_rule_none_echo_service.swagger.json000066400000000000000000000131411465037340600416630ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", "description": "Visibility Rule Echo Service\nSimilar to echo_service.proto but with annotations to change visibility\nof services, methods, fields and enum values.\n\n`google.api.VisibilityRule` annotations are added to customize where they are generated.\nCombined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output.\nElements without `google.api.VisibilityRule` annotations will appear as usual in the generated output.\n\nThese restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want.\nIn this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish.", "version": "version not set" }, "tags": [ { "name": "VisibilityRuleEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should always be visible in the open API output.", "operationId": "VisibilityRuleEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } } }, "definitions": { "VisibilityRuleSimpleMessageVisibilityEnum": { "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" }, "examplepbVisibilityRuleEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbVisibilityRuleSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "anEnum": { "$ref": "#/definitions/VisibilityRuleSimpleMessageVisibilityEnum" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } visibility_rule_preview_and_internal_echo_service.buf.gen.yaml000066400000000000000000000002401465037340600447750ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - visibility_restriction_selectors=PREVIEW - visibility_restriction_selectors=INTERNAL visibility_rule_preview_and_internal_echo_service.swagger.json000066400000000000000000000552031465037340600451300ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", "description": "Visibility Rule Echo Service\nSimilar to echo_service.proto but with annotations to change visibility\nof services, methods, fields and enum values.\n\n`google.api.VisibilityRule` annotations are added to customize where they are generated.\nCombined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output.\nElements without `google.api.VisibilityRule` annotations will appear as usual in the generated output.\n\nThese restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want.\nIn this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish.", "version": "version not set" }, "tags": [ { "name": "VisibilityRuleEchoService" }, { "name": "VisibilityRuleInternalEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should always be visible in the open API output.", "operationId": "VisibilityRuleEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_internal": { "get": { "summary": "EchoInternal is an internal API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"INTERNAL\".", "operationId": "VisibilityRuleEchoService_EchoInternal", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_internal_and_preview": { "get": { "summary": "EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"PREVIEW\" or \"INTERNAL\".", "operationId": "VisibilityRuleEchoService_EchoInternalAndPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_preview": { "get": { "summary": "EchoPreview is a preview API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"PREVIEW\".", "operationId": "VisibilityRuleEchoService_EchoPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleMessageInPreviewMethod" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/internal/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should not be visible in the open API output.", "operationId": "VisibilityRuleInternalEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.internalField", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.internalField", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "internalField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleInternalEchoService" ] } } }, "definitions": { "VisibilityRuleSimpleMessageVisibilityEnum": { "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_INTERNAL", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" }, "examplepbVisibilityRuleEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" }, "internalField": { "type": "string" }, "previewField": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbVisibilityRuleEnumInPreviewMethod": { "type": "string", "enum": [ "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED" ], "default": "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED", "description": "EnumInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "examplepbVisibilityRuleMessageInPreviewMethod": { "type": "object", "properties": { "id": { "type": "string" }, "subMessage": { "$ref": "#/definitions/examplepbVisibilityRuleSubMessageInPreviewMethod" }, "enum": { "$ref": "#/definitions/examplepbVisibilityRuleEnumInPreviewMethod" } }, "description": "MessageInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "examplepbVisibilityRuleSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "internalField": { "type": "string" }, "previewField": { "type": "string" }, "anEnum": { "$ref": "#/definitions/VisibilityRuleSimpleMessageVisibilityEnum" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "examplepbVisibilityRuleSubMessageInPreviewMethod": { "type": "object", "properties": { "id": { "type": "string" } }, "description": "SubMessageInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } visibility_rule_preview_echo_service.buf.gen.yaml000066400000000000000000000001561465037340600422650ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepbversion: v1 plugins: - name: openapiv2 out: . opt: - visibility_restriction_selectors=PREVIEW visibility_rule_preview_echo_service.swagger.json000066400000000000000000000336071465037340600424160ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/visibility_rule_echo_service.proto", "description": "Visibility Rule Echo Service\nSimilar to echo_service.proto but with annotations to change visibility\nof services, methods, fields and enum values.\n\n`google.api.VisibilityRule` annotations are added to customize where they are generated.\nCombined with the option `visibility_restriction_selectors` overlapping rules will appear in the OpenAPI output.\nElements without `google.api.VisibilityRule` annotations will appear as usual in the generated output.\n\nThese restrictions and selectors are completely arbitrary and you can define whatever values or hierarchies you want.\nIn this example `INTERNAL`, `PREVIEW` are used, but `INTERNAL`, `ALPHA`, `BETA`, `RELEASED`, or anything else could be used if you wish.", "version": "version not set" }, "tags": [ { "name": "VisibilityRuleEchoService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/echo/{id}": { "post": { "summary": "Echo method receives a simple message and returns it.\nIt should always be visible in the open API output.", "operationId": "VisibilityRuleEchoService_Echo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "path", "required": true, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_internal_and_preview": { "get": { "summary": "EchoInternalAndPreview is a internal and preview API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"PREVIEW\" or \"INTERNAL\".", "operationId": "VisibilityRuleEchoService_EchoInternalAndPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleSimpleMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } }, "/v1/example/echo_preview": { "get": { "summary": "EchoPreview is a preview API that should only be visible in the OpenAPI spec\nif `visibility_restriction_selectors` includes \"PREVIEW\".", "operationId": "VisibilityRuleEchoService_EchoPreview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbVisibilityRuleMessageInPreviewMethod" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "description": "Id represents the message identifier.", "in": "query", "required": false, "type": "string" }, { "name": "num", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lineNum", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "lang", "in": "query", "required": false, "type": "string" }, { "name": "status.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status.note", "in": "query", "required": false, "type": "string" }, { "name": "status.previewField", "in": "query", "required": false, "type": "string" }, { "name": "en", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.progress", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "no.note", "in": "query", "required": false, "type": "string" }, { "name": "no.previewField", "in": "query", "required": false, "type": "string" }, { "name": "previewField", "in": "query", "required": false, "type": "string" }, { "name": "anEnum", "in": "query", "required": false, "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" } ], "tags": [ "VisibilityRuleEchoService" ] } } }, "definitions": { "VisibilityRuleSimpleMessageVisibilityEnum": { "type": "string", "enum": [ "VISIBILITY_ENUM_UNSPECIFIED", "VISIBILITY_ENUM_VISIBLE", "VISIBILITY_ENUM_PREVIEW" ], "default": "VISIBILITY_ENUM_UNSPECIFIED" }, "examplepbVisibilityRuleEmbedded": { "type": "object", "properties": { "progress": { "type": "string", "format": "int64" }, "note": { "type": "string" }, "previewField": { "type": "string" } }, "description": "Embedded represents a message embedded in SimpleMessage." }, "examplepbVisibilityRuleEnumInPreviewMethod": { "type": "string", "enum": [ "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED" ], "default": "VISIBILITY_RULE_ENUM_IN_PREVIEW_METHOD_UNSPECIFIED", "description": "EnumInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "examplepbVisibilityRuleMessageInPreviewMethod": { "type": "object", "properties": { "id": { "type": "string" }, "subMessage": { "$ref": "#/definitions/examplepbVisibilityRuleSubMessageInPreviewMethod" }, "enum": { "$ref": "#/definitions/examplepbVisibilityRuleEnumInPreviewMethod" } }, "description": "MessageInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "examplepbVisibilityRuleSimpleMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "lang": { "type": "string" }, "status": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "en": { "type": "string", "format": "int64" }, "no": { "$ref": "#/definitions/examplepbVisibilityRuleEmbedded" }, "previewField": { "type": "string" }, "anEnum": { "$ref": "#/definitions/VisibilityRuleSimpleMessageVisibilityEnum" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." }, "examplepbVisibilityRuleSubMessageInPreviewMethod": { "type": "object", "properties": { "id": { "type": "string" } }, "description": "SubMessageInPreviewMethod doesn't define its own visibility restrictions,\nbut is only included in a method marked as \"PREVIEW\", so it will only\nappear if `visibility_restriction_selectors` include \"PREVIEW\"." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/wrappers.pb.go000066400000000000000000000571021465037340600332350ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/examplepb/wrappers.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 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 Wrappers struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields StringValue *wrapperspb.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` Int32Value *wrapperspb.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` Int64Value *wrapperspb.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` FloatValue *wrapperspb.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` DoubleValue *wrapperspb.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` BoolValue *wrapperspb.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` Uint32Value *wrapperspb.UInt32Value `protobuf:"bytes,7,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` Uint64Value *wrapperspb.UInt64Value `protobuf:"bytes,8,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` BytesValue *wrapperspb.BytesValue `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` } func (x *Wrappers) Reset() { *x = Wrappers{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_examplepb_wrappers_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Wrappers) String() string { return protoimpl.X.MessageStringOf(x) } func (*Wrappers) ProtoMessage() {} func (x *Wrappers) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_examplepb_wrappers_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 Wrappers.ProtoReflect.Descriptor instead. func (*Wrappers) Descriptor() ([]byte, []int) { return file_examples_internal_proto_examplepb_wrappers_proto_rawDescGZIP(), []int{0} } func (x *Wrappers) GetStringValue() *wrapperspb.StringValue { if x != nil { return x.StringValue } return nil } func (x *Wrappers) GetInt32Value() *wrapperspb.Int32Value { if x != nil { return x.Int32Value } return nil } func (x *Wrappers) GetInt64Value() *wrapperspb.Int64Value { if x != nil { return x.Int64Value } return nil } func (x *Wrappers) GetFloatValue() *wrapperspb.FloatValue { if x != nil { return x.FloatValue } return nil } func (x *Wrappers) GetDoubleValue() *wrapperspb.DoubleValue { if x != nil { return x.DoubleValue } return nil } func (x *Wrappers) GetBoolValue() *wrapperspb.BoolValue { if x != nil { return x.BoolValue } return nil } func (x *Wrappers) GetUint32Value() *wrapperspb.UInt32Value { if x != nil { return x.Uint32Value } return nil } func (x *Wrappers) GetUint64Value() *wrapperspb.UInt64Value { if x != nil { return x.Uint64Value } return nil } func (x *Wrappers) GetBytesValue() *wrapperspb.BytesValue { if x != nil { return x.BytesValue } return nil } var File_examples_internal_proto_examplepb_wrappers_proto protoreflect.FileDescriptor var file_examples_internal_proto_examplepb_wrappers_proto_rawDesc = []byte{ 0x0a, 0x30, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x04, 0x0a, 0x08, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x32, 0xbe, 0x09, 0x0a, 0x0f, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x1a, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x12, 0x6a, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x66, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x66, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x66, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x6a, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x62, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x6a, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x6a, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x66, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_examplepb_wrappers_proto_rawDescOnce sync.Once file_examples_internal_proto_examplepb_wrappers_proto_rawDescData = file_examples_internal_proto_examplepb_wrappers_proto_rawDesc ) func file_examples_internal_proto_examplepb_wrappers_proto_rawDescGZIP() []byte { file_examples_internal_proto_examplepb_wrappers_proto_rawDescOnce.Do(func() { file_examples_internal_proto_examplepb_wrappers_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_examplepb_wrappers_proto_rawDescData) }) return file_examples_internal_proto_examplepb_wrappers_proto_rawDescData } var file_examples_internal_proto_examplepb_wrappers_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_examplepb_wrappers_proto_goTypes = []interface{}{ (*Wrappers)(nil), // 0: grpc.gateway.examples.internal.proto.examplepb.Wrappers (*wrapperspb.StringValue)(nil), // 1: google.protobuf.StringValue (*wrapperspb.Int32Value)(nil), // 2: google.protobuf.Int32Value (*wrapperspb.Int64Value)(nil), // 3: google.protobuf.Int64Value (*wrapperspb.FloatValue)(nil), // 4: google.protobuf.FloatValue (*wrapperspb.DoubleValue)(nil), // 5: google.protobuf.DoubleValue (*wrapperspb.BoolValue)(nil), // 6: google.protobuf.BoolValue (*wrapperspb.UInt32Value)(nil), // 7: google.protobuf.UInt32Value (*wrapperspb.UInt64Value)(nil), // 8: google.protobuf.UInt64Value (*wrapperspb.BytesValue)(nil), // 9: google.protobuf.BytesValue (*emptypb.Empty)(nil), // 10: google.protobuf.Empty } var file_examples_internal_proto_examplepb_wrappers_proto_depIdxs = []int32{ 1, // 0: grpc.gateway.examples.internal.proto.examplepb.Wrappers.string_value:type_name -> google.protobuf.StringValue 2, // 1: grpc.gateway.examples.internal.proto.examplepb.Wrappers.int32_value:type_name -> google.protobuf.Int32Value 3, // 2: grpc.gateway.examples.internal.proto.examplepb.Wrappers.int64_value:type_name -> google.protobuf.Int64Value 4, // 3: grpc.gateway.examples.internal.proto.examplepb.Wrappers.float_value:type_name -> google.protobuf.FloatValue 5, // 4: grpc.gateway.examples.internal.proto.examplepb.Wrappers.double_value:type_name -> google.protobuf.DoubleValue 6, // 5: grpc.gateway.examples.internal.proto.examplepb.Wrappers.bool_value:type_name -> google.protobuf.BoolValue 7, // 6: grpc.gateway.examples.internal.proto.examplepb.Wrappers.uint32_value:type_name -> google.protobuf.UInt32Value 8, // 7: grpc.gateway.examples.internal.proto.examplepb.Wrappers.uint64_value:type_name -> google.protobuf.UInt64Value 9, // 8: grpc.gateway.examples.internal.proto.examplepb.Wrappers.bytes_value:type_name -> google.protobuf.BytesValue 0, // 9: grpc.gateway.examples.internal.proto.examplepb.WrappersService.Create:input_type -> grpc.gateway.examples.internal.proto.examplepb.Wrappers 1, // 10: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateStringValue:input_type -> google.protobuf.StringValue 2, // 11: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateInt32Value:input_type -> google.protobuf.Int32Value 3, // 12: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateInt64Value:input_type -> google.protobuf.Int64Value 4, // 13: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateFloatValue:input_type -> google.protobuf.FloatValue 5, // 14: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateDoubleValue:input_type -> google.protobuf.DoubleValue 6, // 15: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateBoolValue:input_type -> google.protobuf.BoolValue 7, // 16: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateUInt32Value:input_type -> google.protobuf.UInt32Value 8, // 17: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateUInt64Value:input_type -> google.protobuf.UInt64Value 9, // 18: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateBytesValue:input_type -> google.protobuf.BytesValue 10, // 19: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateEmpty:input_type -> google.protobuf.Empty 0, // 20: grpc.gateway.examples.internal.proto.examplepb.WrappersService.Create:output_type -> grpc.gateway.examples.internal.proto.examplepb.Wrappers 1, // 21: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateStringValue:output_type -> google.protobuf.StringValue 2, // 22: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateInt32Value:output_type -> google.protobuf.Int32Value 3, // 23: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateInt64Value:output_type -> google.protobuf.Int64Value 4, // 24: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateFloatValue:output_type -> google.protobuf.FloatValue 5, // 25: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateDoubleValue:output_type -> google.protobuf.DoubleValue 6, // 26: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateBoolValue:output_type -> google.protobuf.BoolValue 7, // 27: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateUInt32Value:output_type -> google.protobuf.UInt32Value 8, // 28: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateUInt64Value:output_type -> google.protobuf.UInt64Value 9, // 29: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateBytesValue:output_type -> google.protobuf.BytesValue 10, // 30: grpc.gateway.examples.internal.proto.examplepb.WrappersService.CreateEmpty:output_type -> google.protobuf.Empty 20, // [20:31] is the sub-list for method output_type 9, // [9:20] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name 9, // [9:9] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name } func init() { file_examples_internal_proto_examplepb_wrappers_proto_init() } func file_examples_internal_proto_examplepb_wrappers_proto_init() { if File_examples_internal_proto_examplepb_wrappers_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_examplepb_wrappers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Wrappers); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_examplepb_wrappers_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 1, }, GoTypes: file_examples_internal_proto_examplepb_wrappers_proto_goTypes, DependencyIndexes: file_examples_internal_proto_examplepb_wrappers_proto_depIdxs, MessageInfos: file_examples_internal_proto_examplepb_wrappers_proto_msgTypes, }.Build() File_examples_internal_proto_examplepb_wrappers_proto = out.File file_examples_internal_proto_examplepb_wrappers_proto_rawDesc = nil file_examples_internal_proto_examplepb_wrappers_proto_goTypes = nil file_examples_internal_proto_examplepb_wrappers_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/wrappers.pb.gw.go000066400000000000000000001276321465037340600336570ustar00rootroot00000000000000// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/wrappers.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/wrapperspb" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Wrappers var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Wrappers var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Create(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.StringValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateStringValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.StringValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateStringValue(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.Int32Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateInt32Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.Int32Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateInt32Value(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.Int64Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateInt64Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.Int64Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateInt64Value(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.FloatValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateFloatValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.FloatValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateFloatValue(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.DoubleValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateDoubleValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.DoubleValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateDoubleValue(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.BoolValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateBoolValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.BoolValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateBoolValue(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.UInt32Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateUInt32Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.UInt32Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateUInt32Value(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.UInt64Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateUInt64Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.UInt64Value var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateUInt64Value(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.BytesValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateBytesValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrapperspb.BytesValue var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateBytesValue(ctx, &protoReq) return msg, metadata, err } func request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateEmpty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateEmpty(ctx, &protoReq) return msg, metadata, err } // RegisterWrappersServiceHandlerServer registers the http handlers for service WrappersService to "mux". // UnaryRPC :call WrappersServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWrappersServiceHandlerFromEndpoint instead. func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer) error { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/Create", runtime.WithHTTPPathPattern("/v1/example/wrappers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateStringValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateStringValue", runtime.WithHTTPPathPattern("/v1/testString")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateStringValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateStringValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt32Value", runtime.WithHTTPPathPattern("/v1/testInt32")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateInt32Value_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateInt32Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt64Value", runtime.WithHTTPPathPattern("/v1/testInt64")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateInt64Value_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateInt64Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateFloatValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateFloatValue", runtime.WithHTTPPathPattern("/v1/testFloat")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateFloatValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateFloatValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateDoubleValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateDoubleValue", runtime.WithHTTPPathPattern("/v1/testDouble")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateDoubleValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateDoubleValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateBoolValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBoolValue", runtime.WithHTTPPathPattern("/v1/testBool")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateBoolValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateBoolValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateUInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt32Value", runtime.WithHTTPPathPattern("/v1/testUint32")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateUInt32Value_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateUInt32Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateUInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt64Value", runtime.WithHTTPPathPattern("/v1/testUint64")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateUInt64Value_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateUInt64Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateBytesValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBytesValue", runtime.WithHTTPPathPattern("/v1/testBytes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateBytesValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateBytesValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateEmpty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateEmpty", runtime.WithHTTPPathPattern("/v1/testEmpty")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_WrappersService_CreateEmpty_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateEmpty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterWrappersServiceHandlerFromEndpoint is same as RegisterWrappersServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterWrappersServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterWrappersServiceHandler(ctx, mux, conn) } // RegisterWrappersServiceHandler registers the http handlers for service WrappersService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterWrappersServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterWrappersServiceHandlerClient(ctx, mux, NewWrappersServiceClient(conn)) } // RegisterWrappersServiceHandlerClient registers the http handlers for service WrappersService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WrappersServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WrappersServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "WrappersServiceClient" to call the correct interceptors. func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WrappersServiceClient) error { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/Create", runtime.WithHTTPPathPattern("/v1/example/wrappers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateStringValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateStringValue", runtime.WithHTTPPathPattern("/v1/testString")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateStringValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateStringValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt32Value", runtime.WithHTTPPathPattern("/v1/testInt32")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateInt32Value_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateInt32Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt64Value", runtime.WithHTTPPathPattern("/v1/testInt64")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateInt64Value_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateInt64Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateFloatValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateFloatValue", runtime.WithHTTPPathPattern("/v1/testFloat")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateFloatValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateFloatValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateDoubleValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateDoubleValue", runtime.WithHTTPPathPattern("/v1/testDouble")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateDoubleValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateDoubleValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateBoolValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBoolValue", runtime.WithHTTPPathPattern("/v1/testBool")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateBoolValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateBoolValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateUInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt32Value", runtime.WithHTTPPathPattern("/v1/testUint32")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateUInt32Value_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateUInt32Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateUInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt64Value", runtime.WithHTTPPathPattern("/v1/testUint64")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateUInt64Value_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateUInt64Value_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateBytesValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBytesValue", runtime.WithHTTPPathPattern("/v1/testBytes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateBytesValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateBytesValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_WrappersService_CreateEmpty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateEmpty", runtime.WithHTTPPathPattern("/v1/testEmpty")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_WrappersService_CreateEmpty_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_WrappersService_CreateEmpty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_WrappersService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "wrappers"}, "")) pattern_WrappersService_CreateStringValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testString"}, "")) pattern_WrappersService_CreateInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt32"}, "")) pattern_WrappersService_CreateInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt64"}, "")) pattern_WrappersService_CreateFloatValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testFloat"}, "")) pattern_WrappersService_CreateDoubleValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testDouble"}, "")) pattern_WrappersService_CreateBoolValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBool"}, "")) pattern_WrappersService_CreateUInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint32"}, "")) pattern_WrappersService_CreateUInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint64"}, "")) pattern_WrappersService_CreateBytesValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBytes"}, "")) pattern_WrappersService_CreateEmpty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testEmpty"}, "")) ) var ( forward_WrappersService_Create_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateStringValue_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateInt32Value_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateInt64Value_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateFloatValue_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateDoubleValue_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateBoolValue_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateUInt32Value_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateUInt64Value_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateBytesValue_0 = runtime.ForwardResponseMessage forward_WrappersService_CreateEmpty_0 = runtime.ForwardResponseMessage ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb/wrappers.proto000066400000000000000000000051731465037340600333740ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; message Wrappers { google.protobuf.StringValue string_value = 1; google.protobuf.Int32Value int32_value = 2; google.protobuf.Int64Value int64_value = 3; google.protobuf.FloatValue float_value = 4; google.protobuf.DoubleValue double_value = 5; google.protobuf.BoolValue bool_value = 6; google.protobuf.UInt32Value uint32_value = 7; google.protobuf.UInt64Value uint64_value = 8; google.protobuf.BytesValue bytes_value = 9; } service WrappersService { rpc Create(Wrappers) returns (Wrappers) { option (google.api.http) = { post: "/v1/example/wrappers" body: "*" }; } rpc CreateStringValue(google.protobuf.StringValue) returns (google.protobuf.StringValue) { option (google.api.http) = { post: "/v1/testString" body: "*" }; } rpc CreateInt32Value(google.protobuf.Int32Value) returns (google.protobuf.Int32Value) { option (google.api.http) = { post: "/v1/testInt32" body: "*" }; } rpc CreateInt64Value(google.protobuf.Int64Value) returns (google.protobuf.Int64Value) { option (google.api.http) = { post: "/v1/testInt64" body: "*" }; } rpc CreateFloatValue(google.protobuf.FloatValue) returns (google.protobuf.FloatValue) { option (google.api.http) = { post: "/v1/testFloat" body: "*" }; } rpc CreateDoubleValue(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue) { option (google.api.http) = { post: "/v1/testDouble" body: "*" }; } rpc CreateBoolValue(google.protobuf.BoolValue) returns (google.protobuf.BoolValue) { option (google.api.http) = { post: "/v1/testBool" body: "*" }; } rpc CreateUInt32Value(google.protobuf.UInt32Value) returns (google.protobuf.UInt32Value) { option (google.api.http) = { post: "/v1/testUint32" body: "*" }; } rpc CreateUInt64Value(google.protobuf.UInt64Value) returns (google.protobuf.UInt64Value) { option (google.api.http) = { post: "/v1/testUint64" body: "*" }; } rpc CreateBytesValue(google.protobuf.BytesValue) returns (google.protobuf.BytesValue) { option (google.api.http) = { post: "/v1/testBytes" body: "*" }; } rpc CreateEmpty(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/testEmpty" body: "*" }; } } wrappers.swagger.json000066400000000000000000000354761465037340600345720ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/wrappers.proto", "version": "version not set" }, "tags": [ { "name": "WrappersService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/wrappers": { "post": { "operationId": "WrappersService_Create", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbWrappers" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbWrappers" } } ], "tags": [ "WrappersService" ] } }, "/v1/testBool": { "post": { "operationId": "WrappersService_CreateBoolValue", "responses": { "200": { "description": "A successful response.", "schema": { "type": "boolean" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "boolean" } } ], "tags": [ "WrappersService" ] } }, "/v1/testBytes": { "post": { "operationId": "WrappersService_CreateBytesValue", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string", "format": "byte" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "string", "format": "byte" } } ], "tags": [ "WrappersService" ] } }, "/v1/testDouble": { "post": { "operationId": "WrappersService_CreateDoubleValue", "responses": { "200": { "description": "A successful response.", "schema": { "type": "number", "format": "double" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "number", "format": "double" } } ], "tags": [ "WrappersService" ] } }, "/v1/testEmpty": { "post": { "operationId": "WrappersService_CreateEmpty", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": {} } } ], "tags": [ "WrappersService" ] } }, "/v1/testFloat": { "post": { "operationId": "WrappersService_CreateFloatValue", "responses": { "200": { "description": "A successful response.", "schema": { "type": "number", "format": "float" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "number", "format": "float" } } ], "tags": [ "WrappersService" ] } }, "/v1/testInt32": { "post": { "operationId": "WrappersService_CreateInt32Value", "responses": { "200": { "description": "A successful response.", "schema": { "type": "integer", "format": "int32" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "tags": [ "WrappersService" ] } }, "/v1/testInt64": { "post": { "operationId": "WrappersService_CreateInt64Value", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string", "format": "int64" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "string", "format": "int64" } } ], "tags": [ "WrappersService" ] } }, "/v1/testString": { "post": { "operationId": "WrappersService_CreateStringValue", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "string" } } ], "tags": [ "WrappersService" ] } }, "/v1/testUint32": { "post": { "operationId": "WrappersService_CreateUInt32Value", "responses": { "200": { "description": "A successful response.", "schema": { "type": "integer", "format": "int64" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "tags": [ "WrappersService" ] } }, "/v1/testUint64": { "post": { "operationId": "WrappersService_CreateUInt64Value", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string", "format": "uint64" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "type": "string", "format": "uint64" } } ], "tags": [ "WrappersService" ] } } }, "definitions": { "examplepbWrappers": { "type": "object", "properties": { "stringValue": { "type": "string" }, "int32Value": { "type": "integer", "format": "int32" }, "int64Value": { "type": "string", "format": "int64" }, "floatValue": { "type": "number", "format": "float" }, "doubleValue": { "type": "number", "format": "double" }, "boolValue": { "type": "boolean" }, "uint32Value": { "type": "integer", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "bytesValue": { "type": "string", "format": "byte" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." } } } wrappers_grpc.pb.go000066400000000000000000000474411465037340600341760ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: examples/internal/proto/examplepb/wrappers.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" emptypb "google.golang.org/protobuf/types/known/emptypb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // WrappersServiceClient is the client API for WrappersService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type WrappersServiceClient interface { Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) CreateStringValue(ctx context.Context, in *wrapperspb.StringValue, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) CreateInt32Value(ctx context.Context, in *wrapperspb.Int32Value, opts ...grpc.CallOption) (*wrapperspb.Int32Value, error) CreateInt64Value(ctx context.Context, in *wrapperspb.Int64Value, opts ...grpc.CallOption) (*wrapperspb.Int64Value, error) CreateFloatValue(ctx context.Context, in *wrapperspb.FloatValue, opts ...grpc.CallOption) (*wrapperspb.FloatValue, error) CreateDoubleValue(ctx context.Context, in *wrapperspb.DoubleValue, opts ...grpc.CallOption) (*wrapperspb.DoubleValue, error) CreateBoolValue(ctx context.Context, in *wrapperspb.BoolValue, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error) CreateUInt32Value(ctx context.Context, in *wrapperspb.UInt32Value, opts ...grpc.CallOption) (*wrapperspb.UInt32Value, error) CreateUInt64Value(ctx context.Context, in *wrapperspb.UInt64Value, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error) CreateBytesValue(ctx context.Context, in *wrapperspb.BytesValue, opts ...grpc.CallOption) (*wrapperspb.BytesValue, error) CreateEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) } type wrappersServiceClient struct { cc grpc.ClientConnInterface } func NewWrappersServiceClient(cc grpc.ClientConnInterface) WrappersServiceClient { return &wrappersServiceClient{cc} } func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) { out := new(Wrappers) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/Create", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateStringValue(ctx context.Context, in *wrapperspb.StringValue, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) { out := new(wrapperspb.StringValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateStringValue", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateInt32Value(ctx context.Context, in *wrapperspb.Int32Value, opts ...grpc.CallOption) (*wrapperspb.Int32Value, error) { out := new(wrapperspb.Int32Value) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt32Value", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateInt64Value(ctx context.Context, in *wrapperspb.Int64Value, opts ...grpc.CallOption) (*wrapperspb.Int64Value, error) { out := new(wrapperspb.Int64Value) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt64Value", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateFloatValue(ctx context.Context, in *wrapperspb.FloatValue, opts ...grpc.CallOption) (*wrapperspb.FloatValue, error) { out := new(wrapperspb.FloatValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateFloatValue", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateDoubleValue(ctx context.Context, in *wrapperspb.DoubleValue, opts ...grpc.CallOption) (*wrapperspb.DoubleValue, error) { out := new(wrapperspb.DoubleValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateDoubleValue", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateBoolValue(ctx context.Context, in *wrapperspb.BoolValue, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error) { out := new(wrapperspb.BoolValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBoolValue", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateUInt32Value(ctx context.Context, in *wrapperspb.UInt32Value, opts ...grpc.CallOption) (*wrapperspb.UInt32Value, error) { out := new(wrapperspb.UInt32Value) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt32Value", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateUInt64Value(ctx context.Context, in *wrapperspb.UInt64Value, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error) { out := new(wrapperspb.UInt64Value) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt64Value", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateBytesValue(ctx context.Context, in *wrapperspb.BytesValue, opts ...grpc.CallOption) (*wrapperspb.BytesValue, error) { out := new(wrapperspb.BytesValue) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBytesValue", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *wrappersServiceClient) CreateEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateEmpty", in, out, opts...) if err != nil { return nil, err } return out, nil } // WrappersServiceServer is the server API for WrappersService service. // All implementations should embed UnimplementedWrappersServiceServer // for forward compatibility type WrappersServiceServer interface { Create(context.Context, *Wrappers) (*Wrappers, error) CreateStringValue(context.Context, *wrapperspb.StringValue) (*wrapperspb.StringValue, error) CreateInt32Value(context.Context, *wrapperspb.Int32Value) (*wrapperspb.Int32Value, error) CreateInt64Value(context.Context, *wrapperspb.Int64Value) (*wrapperspb.Int64Value, error) CreateFloatValue(context.Context, *wrapperspb.FloatValue) (*wrapperspb.FloatValue, error) CreateDoubleValue(context.Context, *wrapperspb.DoubleValue) (*wrapperspb.DoubleValue, error) CreateBoolValue(context.Context, *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) CreateUInt32Value(context.Context, *wrapperspb.UInt32Value) (*wrapperspb.UInt32Value, error) CreateUInt64Value(context.Context, *wrapperspb.UInt64Value) (*wrapperspb.UInt64Value, error) CreateBytesValue(context.Context, *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) CreateEmpty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) } // UnimplementedWrappersServiceServer should be embedded to have forward compatible implementations. type UnimplementedWrappersServiceServer struct { } func (UnimplementedWrappersServiceServer) Create(context.Context, *Wrappers) (*Wrappers, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } func (UnimplementedWrappersServiceServer) CreateStringValue(context.Context, *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateStringValue not implemented") } func (UnimplementedWrappersServiceServer) CreateInt32Value(context.Context, *wrapperspb.Int32Value) (*wrapperspb.Int32Value, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateInt32Value not implemented") } func (UnimplementedWrappersServiceServer) CreateInt64Value(context.Context, *wrapperspb.Int64Value) (*wrapperspb.Int64Value, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateInt64Value not implemented") } func (UnimplementedWrappersServiceServer) CreateFloatValue(context.Context, *wrapperspb.FloatValue) (*wrapperspb.FloatValue, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateFloatValue not implemented") } func (UnimplementedWrappersServiceServer) CreateDoubleValue(context.Context, *wrapperspb.DoubleValue) (*wrapperspb.DoubleValue, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDoubleValue not implemented") } func (UnimplementedWrappersServiceServer) CreateBoolValue(context.Context, *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateBoolValue not implemented") } func (UnimplementedWrappersServiceServer) CreateUInt32Value(context.Context, *wrapperspb.UInt32Value) (*wrapperspb.UInt32Value, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUInt32Value not implemented") } func (UnimplementedWrappersServiceServer) CreateUInt64Value(context.Context, *wrapperspb.UInt64Value) (*wrapperspb.UInt64Value, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUInt64Value not implemented") } func (UnimplementedWrappersServiceServer) CreateBytesValue(context.Context, *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateBytesValue not implemented") } func (UnimplementedWrappersServiceServer) CreateEmpty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateEmpty not implemented") } // UnsafeWrappersServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WrappersServiceServer will // result in compilation errors. type UnsafeWrappersServiceServer interface { mustEmbedUnimplementedWrappersServiceServer() } func RegisterWrappersServiceServer(s grpc.ServiceRegistrar, srv WrappersServiceServer) { s.RegisterService(&WrappersService_ServiceDesc, srv) } func _WrappersService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Wrappers) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).Create(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).Create(ctx, req.(*Wrappers)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateStringValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.StringValue) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateStringValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateStringValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateStringValue(ctx, req.(*wrapperspb.StringValue)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateInt32Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.Int32Value) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateInt32Value(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt32Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateInt32Value(ctx, req.(*wrapperspb.Int32Value)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateInt64Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.Int64Value) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateInt64Value(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateInt64Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateInt64Value(ctx, req.(*wrapperspb.Int64Value)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateFloatValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.FloatValue) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateFloatValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateFloatValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateFloatValue(ctx, req.(*wrapperspb.FloatValue)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateDoubleValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.DoubleValue) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateDoubleValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateDoubleValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateDoubleValue(ctx, req.(*wrapperspb.DoubleValue)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateBoolValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.BoolValue) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateBoolValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBoolValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateBoolValue(ctx, req.(*wrapperspb.BoolValue)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateUInt32Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.UInt32Value) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateUInt32Value(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt32Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateUInt32Value(ctx, req.(*wrapperspb.UInt32Value)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateUInt64Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.UInt64Value) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateUInt64Value(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateUInt64Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateUInt64Value(ctx, req.(*wrapperspb.UInt64Value)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateBytesValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(wrapperspb.BytesValue) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateBytesValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateBytesValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateBytesValue(ctx, req.(*wrapperspb.BytesValue)) } return interceptor(ctx, in, info, handler) } func _WrappersService_CreateEmpty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(WrappersServiceServer).CreateEmpty(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.WrappersService/CreateEmpty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateEmpty(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } // WrappersService_ServiceDesc is the grpc.ServiceDesc for WrappersService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var WrappersService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.proto.examplepb.WrappersService", HandlerType: (*WrappersServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _WrappersService_Create_Handler, }, { MethodName: "CreateStringValue", Handler: _WrappersService_CreateStringValue_Handler, }, { MethodName: "CreateInt32Value", Handler: _WrappersService_CreateInt32Value_Handler, }, { MethodName: "CreateInt64Value", Handler: _WrappersService_CreateInt64Value_Handler, }, { MethodName: "CreateFloatValue", Handler: _WrappersService_CreateFloatValue_Handler, }, { MethodName: "CreateDoubleValue", Handler: _WrappersService_CreateDoubleValue_Handler, }, { MethodName: "CreateBoolValue", Handler: _WrappersService_CreateBoolValue_Handler, }, { MethodName: "CreateUInt32Value", Handler: _WrappersService_CreateUInt32Value_Handler, }, { MethodName: "CreateUInt64Value", Handler: _WrappersService_CreateUInt64Value_Handler, }, { MethodName: "CreateBytesValue", Handler: _WrappersService_CreateBytesValue_Handler, }, { MethodName: "CreateEmpty", Handler: _WrappersService_CreateEmpty_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/internal/proto/examplepb/wrappers.proto", } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/oneofenum/000077500000000000000000000000001465037340600304545ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/oneofenum/BUILD.bazel000066400000000000000000000014531465037340600323350ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) proto_library( name = "oneofenum_proto", srcs = ["oneof_enum.proto"], ) go_proto_library( name = "oneofenum_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum", proto = ":oneofenum_proto", ) go_library( name = "oneofenum", embed = [":oneofenum_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum", ) alias( name = "go_default_library", actual = ":oneofenum", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/oneofenum/oneof_enum.pb.go000066400000000000000000000223121465037340600335350ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/oneofenum/oneof_enum.proto package oneofenum import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 ExampleEnum int32 const ( ExampleEnum_EXAMPLE_ENUM_UNSPECIFIED ExampleEnum = 0 ExampleEnum_EXAMPLE_ENUM_FIRST ExampleEnum = 1 ) // Enum value maps for ExampleEnum. var ( ExampleEnum_name = map[int32]string{ 0: "EXAMPLE_ENUM_UNSPECIFIED", 1: "EXAMPLE_ENUM_FIRST", } ExampleEnum_value = map[string]int32{ "EXAMPLE_ENUM_UNSPECIFIED": 0, "EXAMPLE_ENUM_FIRST": 1, } ) func (x ExampleEnum) Enum() *ExampleEnum { p := new(ExampleEnum) *p = x return p } func (x ExampleEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (ExampleEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_oneofenum_oneof_enum_proto_enumTypes[0].Descriptor() } func (ExampleEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_oneofenum_oneof_enum_proto_enumTypes[0] } func (x ExampleEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use ExampleEnum.Descriptor instead. func (ExampleEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescGZIP(), []int{0} } type OneofEnumMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to One: // // *OneofEnumMessage_ExampleEnum One isOneofEnumMessage_One `protobuf_oneof:"one"` } func (x *OneofEnumMessage) Reset() { *x = OneofEnumMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_oneofenum_oneof_enum_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OneofEnumMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*OneofEnumMessage) ProtoMessage() {} func (x *OneofEnumMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_oneofenum_oneof_enum_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 OneofEnumMessage.ProtoReflect.Descriptor instead. func (*OneofEnumMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescGZIP(), []int{0} } func (m *OneofEnumMessage) GetOne() isOneofEnumMessage_One { if m != nil { return m.One } return nil } func (x *OneofEnumMessage) GetExampleEnum() ExampleEnum { if x, ok := x.GetOne().(*OneofEnumMessage_ExampleEnum); ok { return x.ExampleEnum } return ExampleEnum_EXAMPLE_ENUM_UNSPECIFIED } type isOneofEnumMessage_One interface { isOneofEnumMessage_One() } type OneofEnumMessage_ExampleEnum struct { ExampleEnum ExampleEnum `protobuf:"varint,1,opt,name=example_enum,json=exampleEnum,proto3,enum=grpc.gateway.examples.internal.proto.oneofenum.ExampleEnum,oneof"` } func (*OneofEnumMessage_ExampleEnum) isOneofEnumMessage_One() {} var File_examples_internal_proto_oneofenum_oneof_enum_proto protoreflect.FileDescriptor var file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDesc = []byte{ 0x0a, 0x32, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x7b, 0x0a, 0x10, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x45, 0x6e, 0x75, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x60, 0x0a, 0x0c, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x0b, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x05, 0x0a, 0x03, 0x6f, 0x6e, 0x65, 0x2a, 0x43, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x58, 0x41, 0x4d, 0x50, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x58, 0x41, 0x4d, 0x50, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x46, 0x49, 0x52, 0x53, 0x54, 0x10, 0x01, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x65, 0x6e, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescOnce sync.Once file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescData = file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDesc ) func file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescGZIP() []byte { file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescOnce.Do(func() { file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescData) }) return file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDescData } var file_examples_internal_proto_oneofenum_oneof_enum_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_examples_internal_proto_oneofenum_oneof_enum_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_oneofenum_oneof_enum_proto_goTypes = []interface{}{ (ExampleEnum)(0), // 0: grpc.gateway.examples.internal.proto.oneofenum.ExampleEnum (*OneofEnumMessage)(nil), // 1: grpc.gateway.examples.internal.proto.oneofenum.OneofEnumMessage } var file_examples_internal_proto_oneofenum_oneof_enum_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.proto.oneofenum.OneofEnumMessage.example_enum:type_name -> grpc.gateway.examples.internal.proto.oneofenum.ExampleEnum 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name } func init() { file_examples_internal_proto_oneofenum_oneof_enum_proto_init() } func file_examples_internal_proto_oneofenum_oneof_enum_proto_init() { if File_examples_internal_proto_oneofenum_oneof_enum_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_oneofenum_oneof_enum_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OneofEnumMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_examples_internal_proto_oneofenum_oneof_enum_proto_msgTypes[0].OneofWrappers = []interface{}{ (*OneofEnumMessage_ExampleEnum)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDesc, NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_examples_internal_proto_oneofenum_oneof_enum_proto_goTypes, DependencyIndexes: file_examples_internal_proto_oneofenum_oneof_enum_proto_depIdxs, EnumInfos: file_examples_internal_proto_oneofenum_oneof_enum_proto_enumTypes, MessageInfos: file_examples_internal_proto_oneofenum_oneof_enum_proto_msgTypes, }.Build() File_examples_internal_proto_oneofenum_oneof_enum_proto = out.File file_examples_internal_proto_oneofenum_oneof_enum_proto_rawDesc = nil file_examples_internal_proto_oneofenum_oneof_enum_proto_goTypes = nil file_examples_internal_proto_oneofenum_oneof_enum_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/oneofenum/oneof_enum.proto000066400000000000000000000005221465037340600336720ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.proto.oneofenum; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum"; enum ExampleEnum { EXAMPLE_ENUM_UNSPECIFIED = 0; EXAMPLE_ENUM_FIRST = 1; } message OneofEnumMessage { oneof one { ExampleEnum example_enum = 1; } } oneof_enum.swagger.json000066400000000000000000000015001465037340600350540ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/oneofenum{ "swagger": "2.0", "info": { "title": "examples/internal/proto/oneofenum/oneof_enum.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/pathenum/000077500000000000000000000000001465037340600303025ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/pathenum/BUILD.bazel000066400000000000000000000014421465037340600321610ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) proto_library( name = "pathenum_proto", srcs = ["path_enum.proto"], ) go_proto_library( name = "pathenum_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum", proto = ":pathenum_proto", ) go_library( name = "pathenum", embed = [":pathenum_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum", ) alias( name = "go_default_library", actual = ":pathenum", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/pathenum/path_enum.pb.go000066400000000000000000000372561465037340600332260ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/pathenum/path_enum.proto package pathenum import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 PathEnum int32 const ( PathEnum_ABC PathEnum = 0 PathEnum_DEF PathEnum = 1 ) // Enum value maps for PathEnum. var ( PathEnum_name = map[int32]string{ 0: "ABC", 1: "DEF", } PathEnum_value = map[string]int32{ "ABC": 0, "DEF": 1, } ) func (x PathEnum) Enum() *PathEnum { p := new(PathEnum) *p = x return p } func (x PathEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (PathEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[0].Descriptor() } func (PathEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[0] } func (x PathEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use PathEnum.Descriptor instead. func (PathEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{0} } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE type SnakeCaseForImport int32 const ( // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCaseForImport_value_x SnakeCaseForImport = 0 // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE SnakeCaseForImport_value_y SnakeCaseForImport = 1 ) // Enum value maps for SnakeCaseForImport. var ( SnakeCaseForImport_name = map[int32]string{ 0: "value_x", 1: "value_y", } SnakeCaseForImport_value = map[string]int32{ "value_x": 0, "value_y": 1, } ) func (x SnakeCaseForImport) Enum() *SnakeCaseForImport { p := new(SnakeCaseForImport) *p = x return p } func (x SnakeCaseForImport) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SnakeCaseForImport) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[1].Descriptor() } func (SnakeCaseForImport) Type() protoreflect.EnumType { return &file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[1] } func (x SnakeCaseForImport) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SnakeCaseForImport.Descriptor instead. func (SnakeCaseForImport) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{1} } type MessagePathEnum_NestedPathEnum int32 const ( MessagePathEnum_GHI MessagePathEnum_NestedPathEnum = 0 MessagePathEnum_JKL MessagePathEnum_NestedPathEnum = 1 ) // Enum value maps for MessagePathEnum_NestedPathEnum. var ( MessagePathEnum_NestedPathEnum_name = map[int32]string{ 0: "GHI", 1: "JKL", } MessagePathEnum_NestedPathEnum_value = map[string]int32{ "GHI": 0, "JKL": 1, } ) func (x MessagePathEnum_NestedPathEnum) Enum() *MessagePathEnum_NestedPathEnum { p := new(MessagePathEnum_NestedPathEnum) *p = x return p } func (x MessagePathEnum_NestedPathEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (MessagePathEnum_NestedPathEnum) Descriptor() protoreflect.EnumDescriptor { return file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[2].Descriptor() } func (MessagePathEnum_NestedPathEnum) Type() protoreflect.EnumType { return &file_examples_internal_proto_pathenum_path_enum_proto_enumTypes[2] } func (x MessagePathEnum_NestedPathEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use MessagePathEnum_NestedPathEnum.Descriptor instead. func (MessagePathEnum_NestedPathEnum) EnumDescriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{0, 0} } type MessagePathEnum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *MessagePathEnum) Reset() { *x = MessagePathEnum{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MessagePathEnum) String() string { return protoimpl.X.MessageStringOf(x) } func (*MessagePathEnum) ProtoMessage() {} func (x *MessagePathEnum) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_pathenum_path_enum_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 MessagePathEnum.ProtoReflect.Descriptor instead. func (*MessagePathEnum) Descriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{0} } type MessageWithPathEnum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Value PathEnum `protobuf:"varint,1,opt,name=value,proto3,enum=grpc.gateway.examples.internal.pathenum.PathEnum" json:"value,omitempty"` } func (x *MessageWithPathEnum) Reset() { *x = MessageWithPathEnum{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MessageWithPathEnum) String() string { return protoimpl.X.MessageStringOf(x) } func (*MessageWithPathEnum) ProtoMessage() {} func (x *MessageWithPathEnum) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_pathenum_path_enum_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 MessageWithPathEnum.ProtoReflect.Descriptor instead. func (*MessageWithPathEnum) Descriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{1} } func (x *MessageWithPathEnum) GetValue() PathEnum { if x != nil { return x.Value } return PathEnum_ABC } type MessageWithNestedPathEnum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Value MessagePathEnum_NestedPathEnum `protobuf:"varint,1,opt,name=value,proto3,enum=grpc.gateway.examples.internal.pathenum.MessagePathEnum_NestedPathEnum" json:"value,omitempty"` } func (x *MessageWithNestedPathEnum) Reset() { *x = MessageWithNestedPathEnum{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MessageWithNestedPathEnum) String() string { return protoimpl.X.MessageStringOf(x) } func (*MessageWithNestedPathEnum) ProtoMessage() {} func (x *MessageWithNestedPathEnum) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_pathenum_path_enum_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 MessageWithNestedPathEnum.ProtoReflect.Descriptor instead. func (*MessageWithNestedPathEnum) Descriptor() ([]byte, []int) { return file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP(), []int{2} } func (x *MessageWithNestedPathEnum) GetValue() MessagePathEnum_NestedPathEnum { if x != nil { return x.Value } return MessagePathEnum_GHI } var File_examples_internal_proto_pathenum_path_enum_proto protoreflect.FileDescriptor var file_examples_internal_proto_pathenum_path_enum_proto_rawDesc = []byte{ 0x0a, 0x30, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x35, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x22, 0x22, 0x0a, 0x0e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x48, 0x49, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4a, 0x4b, 0x4c, 0x10, 0x01, 0x22, 0x5e, 0x0a, 0x13, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x47, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7a, 0x0a, 0x19, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x5d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x1c, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x42, 0x43, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x45, 0x46, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x15, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x78, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x79, 0x10, 0x01, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x65, 0x6e, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_pathenum_path_enum_proto_rawDescOnce sync.Once file_examples_internal_proto_pathenum_path_enum_proto_rawDescData = file_examples_internal_proto_pathenum_path_enum_proto_rawDesc ) func file_examples_internal_proto_pathenum_path_enum_proto_rawDescGZIP() []byte { file_examples_internal_proto_pathenum_path_enum_proto_rawDescOnce.Do(func() { file_examples_internal_proto_pathenum_path_enum_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_pathenum_path_enum_proto_rawDescData) }) return file_examples_internal_proto_pathenum_path_enum_proto_rawDescData } var file_examples_internal_proto_pathenum_path_enum_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_examples_internal_proto_pathenum_path_enum_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_examples_internal_proto_pathenum_path_enum_proto_goTypes = []interface{}{ (PathEnum)(0), // 0: grpc.gateway.examples.internal.pathenum.PathEnum (SnakeCaseForImport)(0), // 1: grpc.gateway.examples.internal.pathenum.snake_case_for_import (MessagePathEnum_NestedPathEnum)(0), // 2: grpc.gateway.examples.internal.pathenum.MessagePathEnum.NestedPathEnum (*MessagePathEnum)(nil), // 3: grpc.gateway.examples.internal.pathenum.MessagePathEnum (*MessageWithPathEnum)(nil), // 4: grpc.gateway.examples.internal.pathenum.MessageWithPathEnum (*MessageWithNestedPathEnum)(nil), // 5: grpc.gateway.examples.internal.pathenum.MessageWithNestedPathEnum } var file_examples_internal_proto_pathenum_path_enum_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.examples.internal.pathenum.MessageWithPathEnum.value:type_name -> grpc.gateway.examples.internal.pathenum.PathEnum 2, // 1: grpc.gateway.examples.internal.pathenum.MessageWithNestedPathEnum.value:type_name -> grpc.gateway.examples.internal.pathenum.MessagePathEnum.NestedPathEnum 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name } func init() { file_examples_internal_proto_pathenum_path_enum_proto_init() } func file_examples_internal_proto_pathenum_path_enum_proto_init() { if File_examples_internal_proto_pathenum_path_enum_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MessagePathEnum); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MessageWithPathEnum); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_examples_internal_proto_pathenum_path_enum_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MessageWithNestedPathEnum); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_pathenum_path_enum_proto_rawDesc, NumEnums: 3, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, GoTypes: file_examples_internal_proto_pathenum_path_enum_proto_goTypes, DependencyIndexes: file_examples_internal_proto_pathenum_path_enum_proto_depIdxs, EnumInfos: file_examples_internal_proto_pathenum_path_enum_proto_enumTypes, MessageInfos: file_examples_internal_proto_pathenum_path_enum_proto_msgTypes, }.Build() File_examples_internal_proto_pathenum_path_enum_proto = out.File file_examples_internal_proto_pathenum_path_enum_proto_rawDesc = nil file_examples_internal_proto_pathenum_path_enum_proto_goTypes = nil file_examples_internal_proto_pathenum_path_enum_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/pathenum/path_enum.proto000066400000000000000000000013711465037340600333510ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.pathenum; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum"; enum PathEnum { ABC = 0; DEF = 1; } message MessagePathEnum { enum NestedPathEnum { GHI = 0; JKL = 1; } } message MessageWithPathEnum { PathEnum value = 1; } message MessageWithNestedPathEnum { MessagePathEnum.NestedPathEnum value = 1; } // Ignoring lint warnings as this enum type exist to validate proper functionality // for projects that don't follow these lint rules. // buf:lint:ignore ENUM_PASCAL_CASE enum snake_case_for_import { // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_x = 0; // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE value_y = 1; } path_enum.swagger.json000066400000000000000000000014761465037340600345440ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/pathenum{ "swagger": "2.0", "info": { "title": "examples/internal/proto/pathenum/path_enum.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/standalone/000077500000000000000000000000001465037340600306115ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/standalone/BUILD.bazel000066400000000000000000000014341465037340600324710ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "standalone", srcs = ["unannotated_echo_service.pb.gw.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/standalone", visibility = ["//examples:__subpackages__"], deps = [ "//examples/internal/proto/examplepb", "//runtime", "//utilities", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//proto", ], ) alias( name = "go_default_library", actual = ":standalone", visibility = ["//examples:__subpackages__"], ) unannotated_echo_service.pb.gw.go000066400000000000000000001221421465037340600371350ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/standalone// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/internal/proto/examplepb/unannotated_echo_service.proto /* Package examplepb is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ package examplepb import ( "context" "io" "net/http" extExamplepb "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join var ( filter_UnannotatedEchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1, "lang": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}} ) func request_UnannotatedEchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } val, ok = pathParams["lang"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang") } if protoReq.Code == nil { protoReq.Code = &extExamplepb.UnannotatedSimpleMessage_Lang{} } else if _, ok := protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_Lang); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *extExamplepb.UnannotatedSimpleMessage_Lang, but: %t\n", protoReq.Code) } protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_Lang).Lang, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") } protoReq.Num, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } val, ok = pathParams["lang"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang") } if protoReq.Code == nil { protoReq.Code = &extExamplepb.UnannotatedSimpleMessage_Lang{} } else if _, ok := protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_Lang); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *extExamplepb.UnannotatedSimpleMessage_Lang, but: %t\n", protoReq.Code) } protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_Lang).Lang, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_Echo_3 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "line_num": 1, "status": 2, "note": 3}, Base: []int{1, 1, 2, 1, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 4, 2, 3, 5}} ) func request_UnannotatedEchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["line_num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num") } if protoReq.Code == nil { protoReq.Code = &extExamplepb.UnannotatedSimpleMessage_LineNum{} } else if _, ok := protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_LineNum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *extExamplepb.UnannotatedSimpleMessage_LineNum, but: %t\n", protoReq.Code) } protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_LineNum).LineNum, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err) } val, ok = pathParams["status.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note") } err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } val, ok = pathParams["line_num"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num") } if protoReq.Code == nil { protoReq.Code = &extExamplepb.UnannotatedSimpleMessage_LineNum{} } else if _, ok := protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_LineNum); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *extExamplepb.UnannotatedSimpleMessage_LineNum, but: %t\n", protoReq.Code) } protoReq.Code.(*extExamplepb.UnannotatedSimpleMessage_LineNum).LineNum, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err) } val, ok = pathParams["status.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note") } err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_Echo_4 = &utilities.DoubleArray{Encoding: map[string]int{"no": 0, "note": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) func request_UnannotatedEchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["no.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note") } err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["no.note"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note") } err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Echo(ctx, &protoReq) return msg, metadata, err } func request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoBody(ctx, &protoReq) return msg, metadata, err } var ( filter_UnannotatedEchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client extExamplepb.UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server extExamplepb.UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq extExamplepb.UnannotatedSimpleMessage var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.EchoDelete(ctx, &protoReq) return msg, metadata, err } // RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". // UnaryRPC :call UnannotatedEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUnannotatedEchoServiceHandlerFromEndpoint instead. func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server extExamplepb.UnannotatedEchoServiceServer) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_1(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}/{num}/{lang}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_2(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo1/{id}/{line_num}/{status.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_3(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo2/{no.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_Echo_4(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", runtime.WithHTTPPathPattern("/v2/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_EchoBody_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", runtime.WithHTTPPathPattern("/v2/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_UnannotatedEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } // RegisterUnannotatedEchoServiceHandlerFromEndpoint is same as RegisterUnannotatedEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterUnannotatedEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return RegisterUnannotatedEchoServiceHandler(ctx, mux, conn) } // RegisterUnannotatedEchoServiceHandler registers the http handlers for service UnannotatedEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterUnannotatedEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterUnannotatedEchoServiceHandlerClient(ctx, mux, extExamplepb.NewUnannotatedEchoServiceClient(conn)) } // RegisterUnannotatedEchoServiceHandlerClient registers the http handlers for service UnannotatedEchoService // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "extExamplepb.UnannotatedEchoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "extExamplepb.UnannotatedEchoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "extExamplepb.UnannotatedEchoServiceClient" to call the correct interceptors. func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client extExamplepb.UnannotatedEchoServiceClient) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}/{num}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_1(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo/{id}/{num}/{lang}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_2(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_2(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo1/{id}/{line_num}/{status.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_3(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_3(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_UnannotatedEchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/Echo", runtime.WithHTTPPathPattern("/v2/example/echo2/{no.note}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_Echo_4(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_Echo_4(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoBody", runtime.WithHTTPPathPattern("/v2/example/echo_body")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_EchoBody_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoBody_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grpc.gateway.examples.internal.proto.examplepb.UnannotatedEchoService/EchoDelete", runtime.WithHTTPPathPattern("/v2/example/echo_delete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_UnannotatedEchoService_EchoDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } forward_UnannotatedEchoService_EchoDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } var ( pattern_UnannotatedEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "echo", "id"}, "")) pattern_UnannotatedEchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v2", "example", "echo", "id", "num"}, "")) pattern_UnannotatedEchoService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v2", "example", "echo", "id", "num", "lang"}, "")) pattern_UnannotatedEchoService_Echo_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v2", "example", "echo1", "id", "line_num", "status.note"}, "")) pattern_UnannotatedEchoService_Echo_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "echo2", "no.note"}, "")) pattern_UnannotatedEchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo_body"}, "")) pattern_UnannotatedEchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo_delete"}, "")) ) var ( forward_UnannotatedEchoService_Echo_0 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_Echo_1 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_Echo_2 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_Echo_3 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_Echo_4 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_EchoBody_0 = runtime.ForwardResponseMessage forward_UnannotatedEchoService_EchoDelete_0 = runtime.ForwardResponseMessage ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub/000077500000000000000000000000001465037340600272525ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub/BUILD.bazel000066400000000000000000000013701465037340600311310ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) proto_library( name = "sub_proto", srcs = ["message.proto"], ) go_proto_library( name = "sub_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub", proto = ":sub_proto", ) go_library( name = "sub", embed = [":sub_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub", ) alias( name = "go_default_library", actual = ":sub", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub/message.pb.go000066400000000000000000000130161465037340600316260ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/sub/message.proto package sub import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 StringMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` } func (x *StringMessage) Reset() { *x = StringMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_sub_message_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *StringMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*StringMessage) ProtoMessage() {} func (x *StringMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_sub_message_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 StringMessage.ProtoReflect.Descriptor instead. func (*StringMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_sub_message_proto_rawDescGZIP(), []int{0} } func (x *StringMessage) GetValue() string { if x != nil && x.Value != nil { return *x.Value } return "" } var File_examples_internal_proto_sub_message_proto protoreflect.FileDescriptor var file_examples_internal_proto_sub_message_proto_rawDesc = []byte{ 0x0a, 0x29, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x22, 0x25, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, } var ( file_examples_internal_proto_sub_message_proto_rawDescOnce sync.Once file_examples_internal_proto_sub_message_proto_rawDescData = file_examples_internal_proto_sub_message_proto_rawDesc ) func file_examples_internal_proto_sub_message_proto_rawDescGZIP() []byte { file_examples_internal_proto_sub_message_proto_rawDescOnce.Do(func() { file_examples_internal_proto_sub_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_sub_message_proto_rawDescData) }) return file_examples_internal_proto_sub_message_proto_rawDescData } var file_examples_internal_proto_sub_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_sub_message_proto_goTypes = []interface{}{ (*StringMessage)(nil), // 0: grpc.gateway.examples.internal.proto.sub.StringMessage } var file_examples_internal_proto_sub_message_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_sub_message_proto_init() } func file_examples_internal_proto_sub_message_proto_init() { if File_examples_internal_proto_sub_message_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_sub_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StringMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_sub_message_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_examples_internal_proto_sub_message_proto_goTypes, DependencyIndexes: file_examples_internal_proto_sub_message_proto_depIdxs, MessageInfos: file_examples_internal_proto_sub_message_proto_msgTypes, }.Build() File_examples_internal_proto_sub_message_proto = out.File file_examples_internal_proto_sub_message_proto_rawDesc = nil file_examples_internal_proto_sub_message_proto_goTypes = nil file_examples_internal_proto_sub_message_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub/message.proto000066400000000000000000000003341465037340600317630ustar00rootroot00000000000000syntax = "proto2"; package grpc.gateway.examples.internal.proto.sub; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub"; message StringMessage { required string value = 1; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub/message.swagger.json000066400000000000000000000014671465037340600332370ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "examples/internal/proto/sub/message.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub2/000077500000000000000000000000001465037340600273345ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub2/BUILD.bazel000066400000000000000000000014001465037340600312050ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) proto_library( name = "sub2_proto", srcs = ["message.proto"], ) go_proto_library( name = "sub2_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2", proto = ":sub2_proto", ) go_library( name = "sub2", embed = [":sub2_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2", ) alias( name = "go_default_library", actual = ":sub2", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub2/message.pb.go000066400000000000000000000130111465037340600317030ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: examples/internal/proto/sub2/message.proto package sub2 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 IdMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` } func (x *IdMessage) Reset() { *x = IdMessage{} if protoimpl.UnsafeEnabled { mi := &file_examples_internal_proto_sub2_message_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *IdMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*IdMessage) ProtoMessage() {} func (x *IdMessage) ProtoReflect() protoreflect.Message { mi := &file_examples_internal_proto_sub2_message_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 IdMessage.ProtoReflect.Descriptor instead. func (*IdMessage) Descriptor() ([]byte, []int) { return file_examples_internal_proto_sub2_message_proto_rawDescGZIP(), []int{0} } func (x *IdMessage) GetUuid() string { if x != nil { return x.Uuid } return "" } var File_examples_internal_proto_sub2_message_proto protoreflect.FileDescriptor var file_examples_internal_proto_sub2_message_proto_rawDesc = []byte{ 0x0a, 0x2a, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x32, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x75, 0x62, 0x32, 0x22, 0x1f, 0x0a, 0x09, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_examples_internal_proto_sub2_message_proto_rawDescOnce sync.Once file_examples_internal_proto_sub2_message_proto_rawDescData = file_examples_internal_proto_sub2_message_proto_rawDesc ) func file_examples_internal_proto_sub2_message_proto_rawDescGZIP() []byte { file_examples_internal_proto_sub2_message_proto_rawDescOnce.Do(func() { file_examples_internal_proto_sub2_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_internal_proto_sub2_message_proto_rawDescData) }) return file_examples_internal_proto_sub2_message_proto_rawDescData } var file_examples_internal_proto_sub2_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_examples_internal_proto_sub2_message_proto_goTypes = []interface{}{ (*IdMessage)(nil), // 0: grpc.gateway.examples.internal.proto.sub2.IdMessage } var file_examples_internal_proto_sub2_message_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_examples_internal_proto_sub2_message_proto_init() } func file_examples_internal_proto_sub2_message_proto_init() { if File_examples_internal_proto_sub2_message_proto != nil { return } if !protoimpl.UnsafeEnabled { file_examples_internal_proto_sub2_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IdMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_examples_internal_proto_sub2_message_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_examples_internal_proto_sub2_message_proto_goTypes, DependencyIndexes: file_examples_internal_proto_sub2_message_proto_depIdxs, MessageInfos: file_examples_internal_proto_sub2_message_proto_msgTypes, }.Build() File_examples_internal_proto_sub2_message_proto = out.File file_examples_internal_proto_sub2_message_proto_rawDesc = nil file_examples_internal_proto_sub2_message_proto_goTypes = nil file_examples_internal_proto_sub2_message_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub2/message.proto000066400000000000000000000003201465037340600320400ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.examples.internal.proto.sub2; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2"; message IdMessage { string uuid = 1; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/proto/sub2/message.swagger.json000066400000000000000000000014701465037340600333130ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "examples/internal/proto/sub2/message.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/000077500000000000000000000000001465037340600266245ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/BUILD.bazel000066400000000000000000000033061465037340600305040ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") package(default_visibility = ["//visibility:public"]) go_library( name = "server", srcs = [ "a_bit_of_everything.go", "echo.go", "fieldmask_helper.go", "flow_combination.go", "main.go", "non_standard_names.go", "responsebody.go", "unannotatedecho.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server", deps = [ "//examples/internal/proto/examplepb", "//examples/internal/proto/oneofenum", "//examples/internal/proto/pathenum", "//examples/internal/proto/standalone", "//examples/internal/proto/sub", "//examples/internal/proto/sub2", "//runtime", "@com_github_rogpeppe_fastuuid//:fastuuid", "@org_golang_google_genproto_googleapis_api//httpbody", "@org_golang_google_genproto_googleapis_rpc//errdetails", "@org_golang_google_genproto_googleapis_rpc//status", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//types/known/durationpb", "@org_golang_google_protobuf//types/known/emptypb", "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/wrapperspb", ], ) alias( name = "go_default_library", actual = ":server", visibility = ["//examples:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/a_bit_of_everything.go000066400000000000000000000267031465037340600331710ustar00rootroot00000000000000package server import ( "context" "fmt" "io" "sync" "time" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/oneofenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2" "github.com/rogpeppe/fastuuid" "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/genproto/googleapis/rpc/errdetails" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/wrapperspb" ) // Implements of ABitOfEverythingServiceServer var uuidgen = fastuuid.MustNewGenerator() type _ABitOfEverythingServer struct { v map[string]*examples.ABitOfEverything m sync.Mutex } type ABitOfEverythingServer interface { examples.ABitOfEverythingServiceServer examples.StreamServiceServer } func newABitOfEverythingServer() ABitOfEverythingServer { return &_ABitOfEverythingServer{ v: make(map[string]*examples.ABitOfEverything), } } func (s *_ABitOfEverythingServer) Create(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) var uuid string for { uuid = fmt.Sprintf("%x", uuidgen.Next()) if _, ok := s.v[uuid]; !ok { break } } s.v[uuid] = msg s.v[uuid].Uuid = uuid grpclog.Infof("%v", s.v[uuid]) return s.v[uuid], nil } func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return s.Create(ctx, msg) } func (s *_ABitOfEverythingServer) CreateBook(ctx context.Context, req *examples.CreateBookRequest) (*examples.Book, error) { return &examples.Book{}, nil } func (s *_ABitOfEverythingServer) UpdateBook(ctx context.Context, req *examples.UpdateBookRequest) (*examples.Book, error) { return &examples.Book{}, nil } func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error { ctx := stream.Context() if header, ok := metadata.FromIncomingContext(ctx); ok { if v, ok := header["error"]; ok { return status.Errorf(codes.InvalidArgument, "error metadata: %v", v) } } count := 0 for { msg, err := stream.Recv() if err == io.EOF { break } if err != nil { return err } count++ grpclog.Info(msg) if _, err = s.Create(ctx, msg); err != nil { return err } } err := stream.SendHeader(metadata.New(map[string]string{ "count": fmt.Sprintf("%d", count), })) if err != nil { return nil } stream.SetTrailer(metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return stream.SendAndClose(new(emptypb.Empty)) } func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessage) (*examples.ABitOfEverything, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) err := grpc.SendHeader(ctx, metadata.New(map[string]string{ "uuid": msg.Uuid, })) if err != nil { return nil, err } if a, ok := s.v[msg.Uuid]; ok { return a, nil } grpc.SetTrailer(ctx, metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return nil, status.Errorf(codes.NotFound, "not found") } func (s *_ABitOfEverythingServer) List(opt *examples.Options, stream examples.StreamService_ListServer) error { s.m.Lock() defer s.m.Unlock() err := stream.SendHeader(metadata.New(map[string]string{ "count": fmt.Sprintf("%d", len(s.v)), })) if err != nil { return nil } for _, msg := range s.v { if err := stream.Send(msg); err != nil { return err } } if opt.Error { stream.SetTrailer(metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return status.Error(codes.InvalidArgument, "error") } return nil } func (s *_ABitOfEverythingServer) Download(opt *examples.Options, stream examples.StreamService_DownloadServer) error { msgs := []*httpbody.HttpBody{{ ContentType: "text/html", Data: []byte("Hello 1"), }, { ContentType: "text/html", Data: []byte("Hello 2"), }} for _, msg := range msgs { if err := stream.Send(msg); err != nil { return err } time.Sleep(5 * time.Millisecond) } if opt.Error { stream.SetTrailer(metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return status.Error(codes.InvalidArgument, "error") } return nil } func (s *_ABitOfEverythingServer) Custom(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { return nil, status.Errorf(codes.NotFound, "not found") } return msg, nil } func (s *_ABitOfEverythingServer) DoubleColon(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { return nil, status.Errorf(codes.NotFound, "not found") } return msg, nil } func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABitOfEverything) (*emptypb.Empty, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { return nil, status.Errorf(codes.NotFound, "not found") } return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) UpdateV2(ctx context.Context, msg *examples.UpdateV2Request) (*emptypb.Empty, error) { grpclog.Info(msg) // If there is no update mask do a regular update if msg.UpdateMask == nil || len(msg.UpdateMask.GetPaths()) == 0 { return s.Update(ctx, msg.Abe) } s.m.Lock() defer s.m.Unlock() if a, ok := s.v[msg.Abe.Uuid]; ok { applyFieldMask(a, msg.Abe, msg.UpdateMask) } else { return nil, status.Errorf(codes.NotFound, "not found") } return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*emptypb.Empty, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) if _, ok := s.v[msg.Uuid]; ok { delete(s.v, msg.Uuid) } else { return nil, status.Errorf(codes.NotFound, "not found") } return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) GetQuery(ctx context.Context, msg *examples.ABitOfEverything) (*emptypb.Empty, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { return nil, status.Errorf(codes.NotFound, "not found") } return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) GetRepeatedQuery(ctx context.Context, msg *examples.ABitOfEverythingRepeated) (*examples.ABitOfEverythingRepeated, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) return msg, nil } func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessage) (*sub.StringMessage, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) return msg, nil } func (s *_ABitOfEverythingServer) BulkEcho(stream examples.StreamService_BulkEchoServer) error { var msgs []*sub.StringMessage for { msg, err := stream.Recv() if err == io.EOF { break } if err != nil { return err } msgs = append(msgs, msg) } hmd := metadata.New(map[string]string{ "foo": "foo1", "bar": "bar1", }) if err := stream.SendHeader(hmd); err != nil { return err } for _, msg := range msgs { grpclog.Info(msg) if err := stream.Send(msg); err != nil { return err } } stream.SetTrailer(metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return nil } func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { s.m.Lock() defer s.m.Unlock() grpclog.Info(msg) return msg, nil } func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *durationpb.Duration) (*emptypb.Empty, error) { return nil, nil } func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *emptypb.Empty) (*emptypb.Empty, error) { <-ctx.Done() return nil, status.FromContextError(ctx.Err()).Err() } func (s *_ABitOfEverythingServer) ErrorWithDetails(ctx context.Context, msg *emptypb.Empty) (*emptypb.Empty, error) { stat, err := status.New(codes.Unknown, "with details"). WithDetails(&errdetails.DebugInfo{ StackEntries: []string{"foo:1"}, Detail: "error debug details", }) if err != nil { return nil, status.Errorf(codes.Internal, "unexpected error adding details: %s", err) } return nil, stat.Err() } func (s *_ABitOfEverythingServer) GetMessageWithBody(ctx context.Context, msg *examples.MessageWithBody) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } func (s *_ABitOfEverythingServer) PostWithEmptyBody(ctx context.Context, msg *examples.Body) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } func (s *_ABitOfEverythingServer) CheckGetQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } func (s *_ABitOfEverythingServer) CheckNestedEnumGetQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } func (s *_ABitOfEverythingServer) CheckPostQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } func (s *_ABitOfEverythingServer) OverwriteRequestContentType(ctx context.Context, msg *examples.Body) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } func (s *_ABitOfEverythingServer) OverwriteResponseContentType(ctx context.Context, msg *emptypb.Empty) (*wrapperspb.StringValue, error) { return &wrapperspb.StringValue{}, nil } func (s *_ABitOfEverythingServer) CheckExternalPathEnum(ctx context.Context, msg *pathenum.MessageWithPathEnum) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } func (s *_ABitOfEverythingServer) CheckExternalNestedPathEnum(ctx context.Context, msg *pathenum.MessageWithNestedPathEnum) (*emptypb.Empty, error) { return &emptypb.Empty{}, nil } func (s *_ABitOfEverythingServer) CheckStatus(ctx context.Context, empty *emptypb.Empty) (*examples.CheckStatusResponse, error) { return &examples.CheckStatusResponse{Status: &statuspb.Status{}}, nil } func (s *_ABitOfEverythingServer) Exists(ctx context.Context, msg *examples.ABitOfEverything) (*emptypb.Empty, error) { if _, ok := s.v[msg.Uuid]; ok { return new(emptypb.Empty), nil } return nil, status.Errorf(codes.NotFound, "not found") } func (s *_ABitOfEverythingServer) CustomOptionsRequest(ctx context.Context, msg *examples.ABitOfEverything) (*emptypb.Empty, error) { err := grpc.SendHeader(ctx, metadata.New(map[string]string{ "Allow": "OPTIONS, GET, HEAD, POST, PUT, TRACE", })) if err != nil { return nil, err } return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) TraceRequest(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } func (s *_ABitOfEverythingServer) PostOneofEnum(ctx context.Context, msg *oneofenum.OneofEnumMessage) (*emptypb.Empty, error) { return new(emptypb.Empty), nil } func (s *_ABitOfEverythingServer) PostRequiredMessageType(ctx context.Context, req *examples.RequiredMessageTypeRequest) (*emptypb.Empty, error) { return new(emptypb.Empty), nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/echo.go000066400000000000000000000026571465037340600301030ustar00rootroot00000000000000package server import ( "context" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) // Implements of EchoServiceServer type echoServer struct{} func newEchoServer() examples.EchoServiceServer { return new(echoServer) } func (s *echoServer) Echo(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { grpclog.Info(msg) return msg, nil } func (s *echoServer) EchoBody(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { grpclog.Info(msg) grpc.SendHeader(ctx, metadata.New(map[string]string{ "foo": "foo1", "bar": "bar1", })) grpc.SetTrailer(ctx, metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return msg, nil } func (s *echoServer) EchoDelete(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { grpclog.Info(msg) return msg, nil } func (s *echoServer) EchoPatch(ctx context.Context, msg *examples.DynamicMessageUpdate) (*examples.DynamicMessageUpdate, error) { grpclog.Info(msg) return msg, nil } func (s *echoServer) EchoUnauthorized(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { grpclog.Info(msg) return nil, status.Error(codes.Unauthenticated, "unauthorized err") } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/fieldmask_helper.go000066400000000000000000000021611465037340600324510ustar00rootroot00000000000000package server import ( "strings" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" ) func applyFieldMask(patchee, patcher proto.Message, mask *field_mask.FieldMask) { if mask == nil { return } if patchee.ProtoReflect().Descriptor().FullName() != patcher.ProtoReflect().Descriptor().FullName() { panic("patchee and patcher must be same type") } for _, path := range mask.GetPaths() { patcherField, patcherParent := getField(patcher.ProtoReflect(), path) patcheeField, patcheeParent := getField(patchee.ProtoReflect(), path) patcheeParent.Set(patcheeField, patcherParent.Get(patcherField)) } } func getField(msg protoreflect.Message, path string) (field protoreflect.FieldDescriptor, parent protoreflect.Message) { fields := msg.Descriptor().Fields() parent = msg names := strings.Split(path, ".") for i, name := range names { field = fields.ByName(protoreflect.Name(name)) if i < len(names)-1 { parent = parent.Get(field).Message() fields = field.Message().Fields() } } return field, parent } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/flow_combination.go000066400000000000000000000042541465037340600325110ustar00rootroot00000000000000package server import ( "context" "io" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" ) type flowCombinationServer struct{} func newFlowCombinationServer() examples.FlowCombinationServer { return &flowCombinationServer{} } func (s flowCombinationServer) RpcEmptyRpc(ctx context.Context, req *examples.EmptyProto) (*examples.EmptyProto, error) { return req, nil } func (s flowCombinationServer) RpcEmptyStream(req *examples.EmptyProto, stream examples.FlowCombination_RpcEmptyStreamServer) error { return stream.Send(req) } func (s flowCombinationServer) StreamEmptyRpc(stream examples.FlowCombination_StreamEmptyRpcServer) error { for { _, err := stream.Recv() if err == io.EOF { break } if err != nil { return err } } return stream.SendAndClose(new(examples.EmptyProto)) } func (s flowCombinationServer) StreamEmptyStream(stream examples.FlowCombination_StreamEmptyStreamServer) error { for { _, err := stream.Recv() if err == io.EOF { break } if err != nil { return err } } return stream.Send(new(examples.EmptyProto)) } func (s flowCombinationServer) RpcBodyRpc(ctx context.Context, req *examples.NonEmptyProto) (*examples.EmptyProto, error) { return new(examples.EmptyProto), nil } func (s flowCombinationServer) RpcPathSingleNestedRpc(ctx context.Context, req *examples.SingleNestedProto) (*examples.EmptyProto, error) { return new(examples.EmptyProto), nil } func (s flowCombinationServer) RpcPathNestedRpc(ctx context.Context, req *examples.NestedProto) (*examples.EmptyProto, error) { return new(examples.EmptyProto), nil } func (s flowCombinationServer) RpcBodyStream(req *examples.NonEmptyProto, stream examples.FlowCombination_RpcBodyStreamServer) error { return stream.Send(new(examples.EmptyProto)) } func (s flowCombinationServer) RpcPathSingleNestedStream(req *examples.SingleNestedProto, stream examples.FlowCombination_RpcPathSingleNestedStreamServer) error { return stream.Send(new(examples.EmptyProto)) } func (s flowCombinationServer) RpcPathNestedStream(req *examples.NestedProto, stream examples.FlowCombination_RpcPathNestedStreamServer) error { return stream.Send(new(examples.EmptyProto)) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/main.go000066400000000000000000000047301465037340600301030ustar00rootroot00000000000000package server import ( "context" "net" "net/http" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" standalone "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/standalone" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" ) // Run starts the example gRPC service. // "network" and "address" are passed to net.Listen. func Run(ctx context.Context, network, address string) error { l, err := net.Listen(network, address) if err != nil { return err } defer func() { if err := l.Close(); err != nil { grpclog.Errorf("Failed to close %s %s: %v", network, address, err) } }() s := grpc.NewServer() examples.RegisterEchoServiceServer(s, newEchoServer()) examples.RegisterFlowCombinationServer(s, newFlowCombinationServer()) examples.RegisterNonStandardServiceServer(s, newNonStandardServer()) examples.RegisterUnannotatedEchoServiceServer(s, newUnannotatedEchoServer()) abe := newABitOfEverythingServer() examples.RegisterABitOfEverythingServiceServer(s, abe) examples.RegisterStreamServiceServer(s, abe) examples.RegisterResponseBodyServiceServer(s, newResponseBodyServer()) go func() { defer s.GracefulStop() <-ctx.Done() }() return s.Serve(l) } // RunInProcessGateway starts the invoke in process http gateway. func RunInProcessGateway(ctx context.Context, addr string, opts ...runtime.ServeMuxOption) error { mux := runtime.NewServeMux(opts...) examples.RegisterEchoServiceHandlerServer(ctx, mux, newEchoServer()) examples.RegisterFlowCombinationHandlerServer(ctx, mux, newFlowCombinationServer()) examples.RegisterNonStandardServiceHandlerServer(ctx, mux, newNonStandardServer()) standalone.RegisterUnannotatedEchoServiceHandlerServer(ctx, mux, newUnannotatedEchoServer()) abe := newABitOfEverythingServer() examples.RegisterABitOfEverythingServiceHandlerServer(ctx, mux, abe) examples.RegisterStreamServiceHandlerServer(ctx, mux, abe) examples.RegisterResponseBodyServiceHandlerServer(ctx, mux, newResponseBodyServer()) s := &http.Server{ Addr: addr, Handler: mux, } go func() { <-ctx.Done() grpclog.Infof("Shutting down the http gateway server") if err := s.Shutdown(context.Background()); err != nil { grpclog.Errorf("Failed to shutdown http gateway server: %v", err) } }() if err := s.ListenAndServe(); err != http.ErrServerClosed { grpclog.Errorf("Failed to listen and serve: %v", err) return err } return nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/non_standard_names.go000066400000000000000000000025061465037340600330130ustar00rootroot00000000000000package server import ( "context" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "google.golang.org/grpc/grpclog" ) // Implements NonStandardServiceServer type nonStandardServer struct{} func newNonStandardServer() examples.NonStandardServiceServer { return new(nonStandardServer) } func (s *nonStandardServer) Update(ctx context.Context, msg *examples.NonStandardUpdateRequest) (*examples.NonStandardMessage, error) { grpclog.Info(msg) newMsg := &examples.NonStandardMessage{ Thing: &examples.NonStandardMessage_Thing{SubThing: &examples.NonStandardMessage_Thing_SubThing{}}, // The fieldmask_helper doesn't generate nested structs if they are nil } applyFieldMask(newMsg, msg.Body, msg.UpdateMask) grpclog.Info(newMsg) return newMsg, nil } func (s *nonStandardServer) UpdateWithJSONNames(ctx context.Context, msg *examples.NonStandardWithJSONNamesUpdateRequest) (*examples.NonStandardMessageWithJSONNames, error) { grpclog.Info(msg) newMsg := &examples.NonStandardMessageWithJSONNames{ Thing: &examples.NonStandardMessageWithJSONNames_Thing{SubThing: &examples.NonStandardMessageWithJSONNames_Thing_SubThing{}}, // The fieldmask_helper doesn't generate nested structs if they are nil } applyFieldMask(newMsg, msg.Body, msg.UpdateMask) grpclog.Info(newMsg) return newMsg, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/responsebody.go000066400000000000000000000032271465037340600316730ustar00rootroot00000000000000package server import ( "context" "fmt" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" ) // Implements of ResponseBodyServiceServer type responseBodyServer struct{} func newResponseBodyServer() examples.ResponseBodyServiceServer { return new(responseBodyServer) } func (s *responseBodyServer) GetResponseBody(ctx context.Context, req *examples.ResponseBodyIn) (*examples.ResponseBodyOut, error) { return &examples.ResponseBodyOut{ Response: &examples.ResponseBodyOut_Response{ Data: req.Data, }, }, nil } func (s *responseBodyServer) ListResponseBodies(ctx context.Context, req *examples.ResponseBodyIn) (*examples.RepeatedResponseBodyOut, error) { return &examples.RepeatedResponseBodyOut{ Response: []*examples.RepeatedResponseBodyOut_Response{ { Data: req.Data, }, }, }, nil } func (s *responseBodyServer) ListResponseStrings(ctx context.Context, req *examples.ResponseBodyIn) (*examples.RepeatedResponseStrings, error) { if req.Data == "empty" { return &examples.RepeatedResponseStrings{ Values: []string{}, }, nil } return &examples.RepeatedResponseStrings{ Values: []string{"hello", req.Data}, }, nil } func (s *responseBodyServer) GetResponseBodyStream(req *examples.ResponseBodyIn, stream examples.ResponseBodyService_GetResponseBodyStreamServer) error { if err := stream.Send(&examples.ResponseBodyOut{ Response: &examples.ResponseBodyOut_Response{ Data: fmt.Sprintf("first %s", req.Data), }, }); err != nil { return err } return stream.Send(&examples.ResponseBodyOut{ Response: &examples.ResponseBodyOut_Response{ Data: fmt.Sprintf("second %s", req.Data), }, }) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/examples/internal/server/unannotatedecho.go000066400000000000000000000022111465037340600323260ustar00rootroot00000000000000package server import ( "context" examples "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" ) // Implements of UnannotatedEchoServiceServer type unannotatedEchoServer struct{} func newUnannotatedEchoServer() examples.UnannotatedEchoServiceServer { return new(unannotatedEchoServer) } func (s *unannotatedEchoServer) Echo(ctx context.Context, msg *examples.UnannotatedSimpleMessage) (*examples.UnannotatedSimpleMessage, error) { grpclog.Info(msg) return msg, nil } func (s *unannotatedEchoServer) EchoBody(ctx context.Context, msg *examples.UnannotatedSimpleMessage) (*examples.UnannotatedSimpleMessage, error) { grpclog.Info(msg) grpc.SendHeader(ctx, metadata.New(map[string]string{ "foo": "foo1", "bar": "bar1", })) grpc.SetTrailer(ctx, metadata.New(map[string]string{ "foo": "foo2", "bar": "bar2", })) return msg, nil } func (s *unannotatedEchoServer) EchoDelete(ctx context.Context, msg *examples.UnannotatedSimpleMessage) (*examples.UnannotatedSimpleMessage, error) { grpclog.Info(msg) return msg, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/go.mod000066400000000000000000000012461465037340600227750ustar00rootroot00000000000000module github.com/grpc-ecosystem/grpc-gateway/v2 go 1.20 require ( github.com/antihax/optional v1.0.0 github.com/google/go-cmp v0.6.0 github.com/rogpeppe/fastuuid v1.2.0 golang.org/x/oauth2 v0.20.0 golang.org/x/text v0.15.0 google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.34.1 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/kr/pretty v0.3.1 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/sys v0.18.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/go.sum000066400000000000000000000064741465037340600230320ustar00rootroot00000000000000github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/000077500000000000000000000000001465037340600235005ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/000077500000000000000000000000001465037340600247445ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/BUILD.bazel000066400000000000000000000006751465037340600266320ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "casing", srcs = ["camel.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing", visibility = ["//:__subpackages__"], ) alias( name = "go_default_library", actual = ":casing", visibility = ["//:__subpackages__"], ) go_test( name = "casing_test", srcs = ["camel_test.go"], embed = [":casing"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/LICENSE.md000066400000000000000000000027161465037340600263560ustar00rootroot00000000000000Copyright 2010, 2019 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/README.md000066400000000000000000000005231465037340600262230ustar00rootroot00000000000000# Case conversion This package contains two functions: - `Camel` copied from the `github.com/golang/protobuf/protoc-gen-go/generator` package. - `JSONCamelCase` copied from the `github.com/protocolbuffers/protobuf-go/internal/strs` package. Both these modules are licensed by The Go Authors, as reflected in this package's [LICENSE.md]. golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/camel.go000066400000000000000000000052421465037340600263570ustar00rootroot00000000000000package casing import ( "path/filepath" "strings" ) // Camel returns the CamelCased name. // // This was moved from the now deprecated github.com/golang/protobuf/protoc-gen-go/generator package // // If there is an interior underscore followed by a lower case letter, // drop the underscore and convert the letter to upper case. // There is a remote possibility of this rewrite causing a name collision, // but it's so remote we're prepared to pretend it's nonexistent - since the // C++ generator lowercases names, it's extremely unlikely to have two fields // with different capitalizations. // In short, _my_field_name_2 becomes XMyFieldName_2. func Camel(s string) string { if s == "" { return "" } t := make([]byte, 0, 32) i := 0 if s[0] == '_' { // Need a capital letter; drop the '_'. t = append(t, 'X') i++ } // Invariant: if the next letter is lower case, it must be converted // to upper case. // That is, we process a word at a time, where words are marked by _ or // upper case letter. Digits are treated as words. for ; i < len(s); i++ { c := s[i] if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) { continue // Skip the underscore in s. } if isASCIIDigit(c) { t = append(t, c) continue } // Assume we have a letter now - if not, it's a bogus identifier. // The next word is a sequence of characters that must start upper case. if isASCIILower(c) { c ^= ' ' // Make it a capital letter. } t = append(t, c) // Guaranteed not lower case. // Accept lower case sequence that follows. for i+1 < len(s) && isASCIILower(s[i+1]) { i++ t = append(t, s[i]) } } return string(t) } // CamelIdentifier returns the CamelCased identifier without affecting the package name/path if any. func CamelIdentifier(s string) string { const dot = "." if !strings.Contains(s, dot) { return Camel(s) } identifier := filepath.Ext(s) path := strings.TrimSuffix(s, identifier) identifier = strings.TrimPrefix(identifier, dot) return path + dot + Camel(identifier) } // JSONCamelCase converts a snake_case identifier to a camelCase identifier, // according to the protobuf JSON specification. func JSONCamelCase(s string) string { var b []byte var wasUnderscore bool for i := 0; i < len(s); i++ { // proto identifiers are always ASCII c := s[i] if c != '_' { if wasUnderscore && isASCIILower(c) { c -= 'a' - 'A' // convert to uppercase } b = append(b, c) } wasUnderscore = c == '_' } return string(b) } // And now lots of helper functions. // Is c an ASCII lower-case letter? func isASCIILower(c byte) bool { return 'a' <= c && c <= 'z' } // Is c an ASCII digit? func isASCIIDigit(c byte) bool { return '0' <= c && c <= '9' } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/casing/camel_test.go000066400000000000000000000015761465037340600274240ustar00rootroot00000000000000package casing import "testing" func TestCamelIdentifier(t *testing.T) { casingTests := []struct { name string input string want string }{ { "regular snake case identifier", "snake_case", "SnakeCase", }, { "snake case identifier with digit", "snake_case_0_enum", "SnakeCase_0Enum", }, { "regular snake case identifier with package", "pathenum.snake_case", "pathenum.SnakeCase", }, { "snake case identifier with digit and package", "pathenum.snake_case_0_enum", "pathenum.SnakeCase_0Enum", }, { "snake case identifier with digit and multiple dots", "path.pathenum.snake_case_0_enum", "path.pathenum.SnakeCase_0Enum", }, } for _, ct := range casingTests { t.Run(ct.name, func(t *testing.T) { got := CamelIdentifier(ct.input) if ct.want != got { t.Errorf("want: %s, got: %s", ct.want, got) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/000077500000000000000000000000001465037340600263215ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/BUILD.bazel000066400000000000000000000017011465037340600301760ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) go_library( name = "codegenerator", srcs = [ "doc.go", "parse_req.go", "supported_features.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator", deps = [ "@org_golang_google_protobuf//compiler/protogen", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/pluginpb", ], ) go_test( name = "codegenerator_test", srcs = ["parse_req_test.go"], deps = [ ":codegenerator", "@com_github_google_go_cmp//cmp", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//testing/protocmp", "@org_golang_google_protobuf//types/pluginpb", ], ) alias( name = "go_default_library", actual = ":codegenerator", visibility = ["//:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/doc.go000066400000000000000000000001531465037340600274140ustar00rootroot00000000000000/* Package codegenerator contains reusable functions used by the code generators. */ package codegenerator golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/parse_req.go000066400000000000000000000011231465037340600306260ustar00rootroot00000000000000package codegenerator import ( "fmt" "io" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" ) // ParseRequest parses a code generator request from a proto Message. func ParseRequest(r io.Reader) (*pluginpb.CodeGeneratorRequest, error) { input, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("failed to read code generator request: %w", err) } req := new(pluginpb.CodeGeneratorRequest) if err := proto.Unmarshal(input, req); err != nil { return nil, fmt.Errorf("failed to unmarshal code generator request: %w", err) } return req, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/parse_req_test.go000066400000000000000000000025611465037340600316740ustar00rootroot00000000000000package codegenerator_test import ( "bytes" "errors" "io" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/pluginpb" ) var parseReqTests = []struct { name string in io.Reader out *pluginpb.CodeGeneratorRequest expectErr bool }{ { "Empty input should produce empty output", mustGetReader(&pluginpb.CodeGeneratorRequest{}), &pluginpb.CodeGeneratorRequest{}, false, }, { "Invalid reader should produce error", &invalidReader{}, nil, true, }, { "Invalid proto message should produce error", strings.NewReader("{}"), nil, true, }, } func TestParseRequest(t *testing.T) { for _, tt := range parseReqTests { t.Run(tt.name, func(t *testing.T) { out, err := codegenerator.ParseRequest(tt.in) if tt.expectErr && err == nil { t.Error("did not error as expected") } if diff := cmp.Diff(out, tt.out, protocmp.Transform()); diff != "" { t.Errorf(diff) } }) } } func mustGetReader(pb proto.Message) io.Reader { b, err := proto.Marshal(pb) if err != nil { panic(err) } return bytes.NewBuffer(b) } type invalidReader struct { } func (*invalidReader) Read(p []byte) (int, error) { return 0, errors.New("invalid reader") } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/codegenerator/supported_features.go000066400000000000000000000014241465037340600325740ustar00rootroot00000000000000package codegenerator import ( "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/types/pluginpb" ) func supportedCodeGeneratorFeatures() uint64 { // Enable support for optional keyword in proto3. return uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) } // SetSupportedFeaturesOnPluginGen sets supported proto3 features // on protogen.Plugin. func SetSupportedFeaturesOnPluginGen(gen *protogen.Plugin) { gen.SupportedFeatures = supportedCodeGeneratorFeatures() } // SetSupportedFeaturesOnCodeGeneratorResponse sets supported proto3 features // on pluginpb.CodeGeneratorResponse. func SetSupportedFeaturesOnCodeGeneratorResponse(resp *pluginpb.CodeGeneratorResponse) { sf := supportedCodeGeneratorFeatures() resp.SupportedFeatures = &sf } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/000077500000000000000000000000001465037340600256565ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/BUILD.bazel000066400000000000000000000036441465037340600275430ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) go_library( name = "descriptor", srcs = [ "grpc_api_configuration.go", "openapi_configuration.go", "registry.go", "services.go", "types.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor", deps = [ "//internal/casing", "//internal/codegenerator", "//internal/descriptor/apiconfig", "//internal/descriptor/openapiconfig", "//internal/httprule", "//protoc-gen-openapiv2/options", "@in_gopkg_yaml_v3//:yaml_v3", "@org_golang_google_genproto_googleapis_api//annotations", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//compiler/protogen", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/descriptorpb", "@org_golang_google_protobuf//types/pluginpb", "@org_golang_x_text//cases", "@org_golang_x_text//language", ], ) go_test( name = "descriptor_test", size = "small", srcs = [ "grpc_api_configuration_test.go", "openapi_configuration_test.go", "registry_test.go", "services_test.go", "types_test.go", ], embed = [":descriptor"], deps = [ "//internal/descriptor/openapiconfig", "//internal/httprule", "//protoc-gen-openapiv2/options", "@org_golang_google_protobuf//compiler/protogen", "@org_golang_google_protobuf//encoding/prototext", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/descriptorpb", "@org_golang_google_protobuf//types/pluginpb", ], ) alias( name = "go_default_library", actual = ":descriptor", visibility = ["//:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/apiconfig/000077500000000000000000000000001465037340600276155ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/apiconfig/BUILD.bazel000066400000000000000000000016441465037340600315000ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) proto_library( name = "apiconfig_proto", srcs = [ "apiconfig.proto", ], deps = ["@googleapis//google/api:http_proto"], ) go_proto_library( name = "apiconfig_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig", proto = ":apiconfig_proto", deps = ["@org_golang_google_genproto_googleapis_api//annotations"], ) go_library( name = "apiconfig", embed = [":apiconfig_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig", ) alias( name = "go_default_library", actual = ":apiconfig", visibility = ["//:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/apiconfig/apiconfig.pb.go000066400000000000000000000155421465037340600325120ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: internal/descriptor/apiconfig/apiconfig.proto package apiconfig import ( annotations "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // GrpcAPIService represents a stripped down version of google.api.Service . // Compare to https://github.com/googleapis/googleapis/blob/master/google/api/service.proto // The original imports 23 other protobuf files we are not interested in. If a significant // subset (>50%) of these start being reproduced in this file we should swap to using the // full generated version instead. // // For the purposes of the gateway generator we only consider a small subset of all // available features google supports in their service descriptions. Thanks to backwards // compatibility guarantees by protobuf it is safe for us to remove the other fields. type GrpcAPIService struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Http Rule. Http *annotations.Http `protobuf:"bytes,1,opt,name=http,proto3" json:"http,omitempty"` } func (x *GrpcAPIService) Reset() { *x = GrpcAPIService{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_apiconfig_apiconfig_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *GrpcAPIService) String() string { return protoimpl.X.MessageStringOf(x) } func (*GrpcAPIService) ProtoMessage() {} func (x *GrpcAPIService) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_apiconfig_apiconfig_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 GrpcAPIService.ProtoReflect.Descriptor instead. func (*GrpcAPIService) Descriptor() ([]byte, []int) { return file_internal_descriptor_apiconfig_apiconfig_proto_rawDescGZIP(), []int{0} } func (x *GrpcAPIService) GetHttp() *annotations.Http { if x != nil { return x.Http } return nil } var File_internal_descriptor_apiconfig_apiconfig_proto protoreflect.FileDescriptor var file_internal_descriptor_apiconfig_apiconfig_proto_rawDesc = []byte{ 0x0a, 0x2d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2a, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x15, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x0e, 0x47, 0x72, 0x70, 0x63, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_internal_descriptor_apiconfig_apiconfig_proto_rawDescOnce sync.Once file_internal_descriptor_apiconfig_apiconfig_proto_rawDescData = file_internal_descriptor_apiconfig_apiconfig_proto_rawDesc ) func file_internal_descriptor_apiconfig_apiconfig_proto_rawDescGZIP() []byte { file_internal_descriptor_apiconfig_apiconfig_proto_rawDescOnce.Do(func() { file_internal_descriptor_apiconfig_apiconfig_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_descriptor_apiconfig_apiconfig_proto_rawDescData) }) return file_internal_descriptor_apiconfig_apiconfig_proto_rawDescData } var file_internal_descriptor_apiconfig_apiconfig_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_internal_descriptor_apiconfig_apiconfig_proto_goTypes = []interface{}{ (*GrpcAPIService)(nil), // 0: grpc.gateway.internal.descriptor.apiconfig.GrpcAPIService (*annotations.Http)(nil), // 1: google.api.Http } var file_internal_descriptor_apiconfig_apiconfig_proto_depIdxs = []int32{ 1, // 0: grpc.gateway.internal.descriptor.apiconfig.GrpcAPIService.http:type_name -> google.api.Http 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name } func init() { file_internal_descriptor_apiconfig_apiconfig_proto_init() } func file_internal_descriptor_apiconfig_apiconfig_proto_init() { if File_internal_descriptor_apiconfig_apiconfig_proto != nil { return } if !protoimpl.UnsafeEnabled { file_internal_descriptor_apiconfig_apiconfig_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcAPIService); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_descriptor_apiconfig_apiconfig_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_internal_descriptor_apiconfig_apiconfig_proto_goTypes, DependencyIndexes: file_internal_descriptor_apiconfig_apiconfig_proto_depIdxs, MessageInfos: file_internal_descriptor_apiconfig_apiconfig_proto_msgTypes, }.Build() File_internal_descriptor_apiconfig_apiconfig_proto = out.File file_internal_descriptor_apiconfig_apiconfig_proto_rawDesc = nil file_internal_descriptor_apiconfig_apiconfig_proto_goTypes = nil file_internal_descriptor_apiconfig_apiconfig_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/apiconfig/apiconfig.proto000066400000000000000000000016301465037340600326410ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.internal.descriptor.apiconfig; import "google/api/http.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig"; // GrpcAPIService represents a stripped down version of google.api.Service . // Compare to https://github.com/googleapis/googleapis/blob/master/google/api/service.proto // The original imports 23 other protobuf files we are not interested in. If a significant // subset (>50%) of these start being reproduced in this file we should swap to using the // full generated version instead. // // For the purposes of the gateway generator we only consider a small subset of all // available features google supports in their service descriptions. Thanks to backwards // compatibility guarantees by protobuf it is safe for us to remove the other fields. message GrpcAPIService { // Http Rule. google.api.Http http = 1; } apiconfig.swagger.json000066400000000000000000000014731465037340600340330ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/apiconfig{ "swagger": "2.0", "info": { "title": "internal/descriptor/apiconfig/apiconfig.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/grpc_api_configuration.go000066400000000000000000000050311465037340600327170ustar00rootroot00000000000000package descriptor import ( "encoding/json" "fmt" "os" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig" "google.golang.org/protobuf/encoding/protojson" "gopkg.in/yaml.v3" ) func loadGrpcAPIServiceFromYAML(yamlFileContents []byte, yamlSourceLogName string) (*apiconfig.GrpcAPIService, error) { var yamlContents interface{} if err := yaml.Unmarshal(yamlFileContents, &yamlContents); err != nil { return nil, fmt.Errorf("failed to parse gRPC API Configuration from YAML in %q: %w", yamlSourceLogName, err) } jsonContents, err := json.Marshal(yamlContents) if err != nil { return nil, err } // As our GrpcAPIService is incomplete, accept unknown fields. unmarshaler := protojson.UnmarshalOptions{ DiscardUnknown: true, } serviceConfiguration := apiconfig.GrpcAPIService{} if err := unmarshaler.Unmarshal(jsonContents, &serviceConfiguration); err != nil { return nil, fmt.Errorf("failed to parse gRPC API Configuration from YAML in %q: %w", yamlSourceLogName, err) } return &serviceConfiguration, nil } func registerHTTPRulesFromGrpcAPIService(registry *Registry, service *apiconfig.GrpcAPIService, sourceLogName string) error { if service.Http == nil { // Nothing to do return nil } for _, rule := range service.Http.GetRules() { selector := "." + strings.Trim(rule.GetSelector(), " ") if strings.ContainsAny(selector, "*, ") { return fmt.Errorf("selector %q in %v must specify a single service method without wildcards", rule.GetSelector(), sourceLogName) } registry.AddExternalHTTPRule(selector, rule) } return nil } // LoadGrpcAPIServiceFromYAML loads a gRPC API Configuration from the given YAML file // and registers the HttpRule descriptions contained in it as externalHTTPRules in // the given registry. This must be done before loading the proto file. // // You can learn more about gRPC API Service descriptions from google's documentation // at https://cloud.google.com/endpoints/docs/grpc/grpc-service-config // // Note that for the purposes of the gateway generator we only consider a subset of all // available features google supports in their service descriptions. func (r *Registry) LoadGrpcAPIServiceFromYAML(yamlFile string) error { yamlFileContents, err := os.ReadFile(yamlFile) if err != nil { return fmt.Errorf("failed to read gRPC API Configuration description from %q: %w", yamlFile, err) } service, err := loadGrpcAPIServiceFromYAML(yamlFileContents, yamlFile) if err != nil { return err } return registerHTTPRulesFromGrpcAPIService(r, service, yamlFile) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/grpc_api_configuration_test.go000066400000000000000000000125001465037340600337550ustar00rootroot00000000000000package descriptor import ( "strings" "testing" ) func TestLoadGrpcAPIServiceFromYAMLInvalidType(t *testing.T) { // Ideally this would fail but for now this test documents that it doesn't service, err := loadGrpcAPIServiceFromYAML([]byte(`type: not.the.right.type`), "invalidtype") if err != nil { t.Fatal(err) } if service == nil { t.Fatal("No service returned") } } func TestLoadGrpcAPIServiceFromYAMLSingleRule(t *testing.T) { service, err := loadGrpcAPIServiceFromYAML([]byte(` type: google.api.Service config_version: 3 http: rules: - selector: grpctest.YourService.Echo post: /v1/myecho body: "*" `), "example") if err != nil { t.Fatal(err) } if service.Http == nil { t.Fatal("HTTP is empty") } if len(service.Http.GetRules()) != 1 { t.Fatalf("Have %v rules instead of one. Got: %v", len(service.Http.GetRules()), service.Http.GetRules()) } rule := service.Http.GetRules()[0] if rule.GetSelector() != "grpctest.YourService.Echo" { t.Errorf("Rule has unexpected selector '%v'", rule.GetSelector()) } if rule.GetPost() != "/v1/myecho" { t.Errorf("Rule has unexpected post '%v'", rule.GetPost()) } if rule.GetBody() != "*" { t.Errorf("Rule has unexpected body '%v'", rule.GetBody()) } } func TestLoadGrpcAPIServiceFromYAMLRejectInvalidYAML(t *testing.T) { service, err := loadGrpcAPIServiceFromYAML([]byte(` type: google.api.Service config_version: 3 http: rules: - selector: grpctest.YourService.Echo - post: thislinebreakstheselectorblockabovewiththeleadingdash body: "*" `), "invalidyaml") if err == nil { t.Fatal(err) } if !strings.Contains(err.Error(), "line 6") { t.Errorf("Expected yaml error to be detected in line 6. Got other error: %v", err) } if service != nil { t.Fatal("Service returned") } } func TestLoadGrpcAPIServiceFromYAMLMultipleWithAdditionalBindings(t *testing.T) { service, err := loadGrpcAPIServiceFromYAML([]byte(` type: google.api.Service config_version: 3 http: rules: - selector: first.selector post: /my/post/path body: "*" additional_bindings: - post: /additional/post/path - put: /additional/put/{value}/path - delete: "{value}" - patch: "/additional/patch/{value}" - selector: some.other.service delete: foo `), "example") if err != nil { t.Fatalf("Failed to load service description from YAML: %v", err) } if service == nil { t.Fatal("No service returned") } if service.Http == nil { t.Fatal("HTTP is empty") } if len(service.Http.GetRules()) != 2 { t.Fatalf("%v service(s) returned when two were expected. Got: %v", len(service.Http.GetRules()), service.Http) } first := service.Http.GetRules()[0] if first.GetSelector() != "first.selector" { t.Errorf("first.selector has unexpected selector '%v'", first.GetSelector()) } if first.GetBody() != "*" { t.Errorf("first.selector has unexpected body '%v'", first.GetBody()) } if first.GetPost() != "/my/post/path" { t.Errorf("first.selector has unexpected post '%v'", first.GetPost()) } if len(first.GetAdditionalBindings()) != 4 { t.Fatalf("first.selector has unexpected number of bindings %v instead of four. Got: %v", len(first.GetAdditionalBindings()), first.GetAdditionalBindings()) } if first.GetAdditionalBindings()[0].GetPost() != "/additional/post/path" { t.Errorf("first.selector additional binding 0 has unexpected post '%v'", first.GetAdditionalBindings()[0].GetPost()) } if first.GetAdditionalBindings()[1].GetPut() != "/additional/put/{value}/path" { t.Errorf("first.selector additional binding 1 has unexpected put '%v'", first.GetAdditionalBindings()[0].GetPost()) } if first.GetAdditionalBindings()[2].GetDelete() != "{value}" { t.Errorf("first.selector additional binding 2 has unexpected delete '%v'", first.GetAdditionalBindings()[0].GetPost()) } if first.GetAdditionalBindings()[3].GetPatch() != "/additional/patch/{value}" { t.Errorf("first.selector additional binding 3 has unexpected patch '%v'", first.GetAdditionalBindings()[0].GetPost()) } second := service.Http.GetRules()[1] if second.GetSelector() != "some.other.service" { t.Errorf("some.other.service has unexpected selector '%v'", second.GetSelector()) } if second.GetDelete() != "foo" { t.Errorf("some.other.service has unexpected delete '%v'", second.GetDelete()) } if len(second.GetAdditionalBindings()) != 0 { t.Errorf("some.other.service has %v additional bindings when it should not have any. Got: %v", len(second.GetAdditionalBindings()), second.GetAdditionalBindings()) } } func TestLoadGrpcAPIServiceFromYAMLUnknownKeys(t *testing.T) { service, err := loadGrpcAPIServiceFromYAML([]byte(` type: google.api.Service config_version: 3 very: key much: 1 http: rules: - selector: some.other.service delete: foo invalidkey: yes `), "example") if err != nil { t.Fatalf("Failed to load service description from YAML: %v", err) } if service == nil { t.Fatal("No service returned") } if service.Http == nil { t.Fatal("HTTP is empty") } if len(service.Http.GetRules()) != 1 { t.Fatalf("%v service(s) returned when two were expected. Got: %v", len(service.Http.GetRules()), service.Http) } first := service.Http.GetRules()[0] if first.GetSelector() != "some.other.service" { t.Errorf("first.selector has unexpected selector '%v'", first.GetSelector()) } if first.GetDelete() != "foo" { t.Errorf("first.selector has unexpected delete '%v'", first.GetPost()) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapi_configuration.go000066400000000000000000000040031465037340600325640ustar00rootroot00000000000000package descriptor import ( "encoding/json" "fmt" "os" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" "google.golang.org/protobuf/encoding/protojson" "gopkg.in/yaml.v3" ) func loadOpenAPIConfigFromYAML(yamlFileContents []byte, yamlSourceLogName string) (*openapiconfig.OpenAPIConfig, error) { var yamlContents interface{} if err := yaml.Unmarshal(yamlFileContents, &yamlContents); err != nil { return nil, fmt.Errorf("failed to parse gRPC API Configuration from YAML in %q: %w", yamlSourceLogName, err) } jsonContents, err := json.Marshal(yamlContents) if err != nil { return nil, err } // Reject unknown fields because OpenAPIConfig is only used here unmarshaler := protojson.UnmarshalOptions{ DiscardUnknown: false, } openapiConfiguration := openapiconfig.OpenAPIConfig{} if err := unmarshaler.Unmarshal(jsonContents, &openapiConfiguration); err != nil { return nil, fmt.Errorf("failed to parse OpenAPI Configuration from YAML in %q: %w", yamlSourceLogName, err) } return &openapiConfiguration, nil } func registerOpenAPIOptions(registry *Registry, openAPIConfig *openapiconfig.OpenAPIConfig, yamlSourceLogName string) error { if openAPIConfig.OpenapiOptions == nil { // Nothing to do return nil } if err := registry.RegisterOpenAPIOptions(openAPIConfig.OpenapiOptions); err != nil { return fmt.Errorf("failed to register option in %s: %w", yamlSourceLogName, err) } return nil } // LoadOpenAPIConfigFromYAML loads an OpenAPI Configuration from the given YAML file // and registers the OpenAPI options the given registry. // This must be done after loading the proto file. func (r *Registry) LoadOpenAPIConfigFromYAML(yamlFile string) error { yamlFileContents, err := os.ReadFile(yamlFile) if err != nil { return fmt.Errorf("failed to read OpenAPI Configuration description from %q: %w", yamlFile, err) } config, err := loadOpenAPIConfigFromYAML(yamlFileContents, yamlFile) if err != nil { return err } return registerOpenAPIOptions(r, config, yamlFile) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapi_configuration_test.go000066400000000000000000000062421465037340600336320ustar00rootroot00000000000000package descriptor import ( "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" ) func TestLoadOpenAPIConfigFromYAMLRejectInvalidYAML(t *testing.T) { config, err := loadOpenAPIConfigFromYAML([]byte(` openapiOptions: file: - file: test.proto - option: schemes: - HTTP - HTTPS - WSS securityDefinitions: security: ApiKeyAuth: type: TYPE_API_KEY in: IN_HEADER name: "X-API-Key" `), "invalidyaml") if err == nil { t.Fatal(err) } if !strings.Contains(err.Error(), "line 3") { t.Errorf("Expected yaml error to be detected in line 3. Got other error: %v", err) } if config != nil { t.Fatal("Config returned") } } func TestLoadOpenAPIConfigFromYAML(t *testing.T) { config, err := loadOpenAPIConfigFromYAML([]byte(` openapiOptions: file: - file: test.proto option: schemes: - HTTP - HTTPS - WSS securityDefinitions: security: ApiKeyAuth: type: TYPE_API_KEY in: IN_HEADER name: "X-API-Key" `), "openapi_options") if err != nil { t.Fatal(err) } if config.OpenapiOptions == nil { t.Fatal("OpenAPIOptions is empty") } opts := config.OpenapiOptions if numFileOpts := len(opts.File); numFileOpts != 1 { t.Fatalf("expected 1 file option but got %d", numFileOpts) } fileOpt := opts.File[0] if fileOpt.File != "test.proto" { t.Fatalf("file option has unexpected binding %s", fileOpt.File) } swaggerOpt := fileOpt.Option if swaggerOpt == nil { t.Fatal("expected option to be set") } if numSchemes := len(swaggerOpt.Schemes); numSchemes != 3 { t.Fatalf("expected 3 schemes but got %d", numSchemes) } if swaggerOpt.Schemes[0] != options.Scheme_HTTP { t.Fatalf("expected first scheme to be HTTP but got %s", swaggerOpt.Schemes[0]) } if swaggerOpt.Schemes[1] != options.Scheme_HTTPS { t.Fatalf("expected second scheme to be HTTPS but got %s", swaggerOpt.Schemes[1]) } if swaggerOpt.Schemes[2] != options.Scheme_WSS { t.Fatalf("expected third scheme to be WSS but got %s", swaggerOpt.Schemes[2]) } if swaggerOpt.SecurityDefinitions == nil { t.Fatal("expected securityDefinitions to be set") } if numSecOpts := len(swaggerOpt.SecurityDefinitions.Security); numSecOpts != 1 { t.Fatalf("expected 1 security option but got %d", numSecOpts) } secOpt, ok := swaggerOpt.SecurityDefinitions.Security["ApiKeyAuth"] if !ok { t.Fatal("no SecurityScheme for key \"ApiKeyAuth\"") } if secOpt.Type != options.SecurityScheme_TYPE_API_KEY { t.Fatalf("expected scheme type to be TYPE_API_KEY but got %s", secOpt.Type) } if secOpt.In != options.SecurityScheme_IN_HEADER { t.Fatalf("expected scheme in to be IN_HEADER but got %s", secOpt.In) } if secOpt.Name != "X-API-Key" { t.Fatalf("expected name to be X-API-Key but got %s", secOpt.Name) } } func TestLoadOpenAPIConfigFromYAMLUnknownKeys(t *testing.T) { _, err := loadOpenAPIConfigFromYAML([]byte(` closedapiOptions: get: it? openapiOptions: file: - file: test.proto option: schemes: - HTTP `), "openapi_options") if err == nil { t.Errorf("Expected invalid key error") } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapiconfig/000077500000000000000000000000001465037340600304775ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapiconfig/BUILD.bazel000066400000000000000000000017561465037340600323660ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( name = "openapiconfig_proto", srcs = ["openapiconfig.proto"], visibility = ["//:__subpackages__"], deps = ["//protoc-gen-openapiv2/options:options_proto"], ) go_proto_library( name = "openapiconfig_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig", proto = ":openapiconfig_proto", visibility = ["//:__subpackages__"], deps = ["//protoc-gen-openapiv2/options"], ) go_library( name = "openapiconfig", embed = [":openapiconfig_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig", visibility = ["//:__subpackages__"], ) alias( name = "go_default_library", actual = ":openapiconfig", visibility = ["//:__subpackages__"], ) openapiconfig.pb.go000066400000000000000000000677421465037340600342100ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapiconfig// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: internal/descriptor/openapiconfig/openapiconfig.proto package openapiconfig import ( options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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) ) // OpenAPIFileOption represents OpenAPI options on a file type OpenAPIFileOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` Option *options.Swagger `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` } func (x *OpenAPIFileOption) Reset() { *x = OpenAPIFileOption{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIFileOption) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIFileOption) ProtoMessage() {} func (x *OpenAPIFileOption) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIFileOption.ProtoReflect.Descriptor instead. func (*OpenAPIFileOption) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{0} } func (x *OpenAPIFileOption) GetFile() string { if x != nil { return x.File } return "" } func (x *OpenAPIFileOption) GetOption() *options.Swagger { if x != nil { return x.Option } return nil } // OpenAPIMethodOption represents OpenAPI options on a method type OpenAPIMethodOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Option *options.Operation `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` } func (x *OpenAPIMethodOption) Reset() { *x = OpenAPIMethodOption{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIMethodOption) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIMethodOption) ProtoMessage() {} func (x *OpenAPIMethodOption) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIMethodOption.ProtoReflect.Descriptor instead. func (*OpenAPIMethodOption) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{1} } func (x *OpenAPIMethodOption) GetMethod() string { if x != nil { return x.Method } return "" } func (x *OpenAPIMethodOption) GetOption() *options.Operation { if x != nil { return x.Option } return nil } // OpenAPIMessageOption represents OpenAPI options on a message type OpenAPIMessageOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` Option *options.Schema `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` } func (x *OpenAPIMessageOption) Reset() { *x = OpenAPIMessageOption{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIMessageOption) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIMessageOption) ProtoMessage() {} func (x *OpenAPIMessageOption) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIMessageOption.ProtoReflect.Descriptor instead. func (*OpenAPIMessageOption) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{2} } func (x *OpenAPIMessageOption) GetMessage() string { if x != nil { return x.Message } return "" } func (x *OpenAPIMessageOption) GetOption() *options.Schema { if x != nil { return x.Option } return nil } // OpenAPIServiceOption represents OpenAPI options on a service type OpenAPIServiceOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // ex: Service Option *options.Tag `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` } func (x *OpenAPIServiceOption) Reset() { *x = OpenAPIServiceOption{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIServiceOption) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIServiceOption) ProtoMessage() {} func (x *OpenAPIServiceOption) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIServiceOption.ProtoReflect.Descriptor instead. func (*OpenAPIServiceOption) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{3} } func (x *OpenAPIServiceOption) GetService() string { if x != nil { return x.Service } return "" } func (x *OpenAPIServiceOption) GetOption() *options.Tag { if x != nil { return x.Option } return nil } // OpenAPIFieldOption represents OpenAPI options on a field type OpenAPIFieldOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` Option *options.JSONSchema `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` } func (x *OpenAPIFieldOption) Reset() { *x = OpenAPIFieldOption{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIFieldOption) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIFieldOption) ProtoMessage() {} func (x *OpenAPIFieldOption) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIFieldOption.ProtoReflect.Descriptor instead. func (*OpenAPIFieldOption) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{4} } func (x *OpenAPIFieldOption) GetField() string { if x != nil { return x.Field } return "" } func (x *OpenAPIFieldOption) GetOption() *options.JSONSchema { if x != nil { return x.Option } return nil } // OpenAPIOptions represents OpenAPI protobuf options type OpenAPIOptions struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields File []*OpenAPIFileOption `protobuf:"bytes,1,rep,name=file,proto3" json:"file,omitempty"` Method []*OpenAPIMethodOption `protobuf:"bytes,2,rep,name=method,proto3" json:"method,omitempty"` Message []*OpenAPIMessageOption `protobuf:"bytes,3,rep,name=message,proto3" json:"message,omitempty"` Service []*OpenAPIServiceOption `protobuf:"bytes,4,rep,name=service,proto3" json:"service,omitempty"` Field []*OpenAPIFieldOption `protobuf:"bytes,5,rep,name=field,proto3" json:"field,omitempty"` } func (x *OpenAPIOptions) Reset() { *x = OpenAPIOptions{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIOptions) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIOptions) ProtoMessage() {} func (x *OpenAPIOptions) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIOptions.ProtoReflect.Descriptor instead. func (*OpenAPIOptions) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{5} } func (x *OpenAPIOptions) GetFile() []*OpenAPIFileOption { if x != nil { return x.File } return nil } func (x *OpenAPIOptions) GetMethod() []*OpenAPIMethodOption { if x != nil { return x.Method } return nil } func (x *OpenAPIOptions) GetMessage() []*OpenAPIMessageOption { if x != nil { return x.Message } return nil } func (x *OpenAPIOptions) GetService() []*OpenAPIServiceOption { if x != nil { return x.Service } return nil } func (x *OpenAPIOptions) GetField() []*OpenAPIFieldOption { if x != nil { return x.Field } return nil } // OpenAPIConfig represents a set of OpenAPI options type OpenAPIConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields OpenapiOptions *OpenAPIOptions `protobuf:"bytes,1,opt,name=openapi_options,json=openapiOptions,proto3" json:"openapi_options,omitempty"` } func (x *OpenAPIConfig) Reset() { *x = OpenAPIConfig{} if protoimpl.UnsafeEnabled { mi := &file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *OpenAPIConfig) String() string { return protoimpl.X.MessageStringOf(x) } func (*OpenAPIConfig) ProtoMessage() {} func (x *OpenAPIConfig) ProtoReflect() protoreflect.Message { mi := &file_internal_descriptor_openapiconfig_openapiconfig_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 OpenAPIConfig.ProtoReflect.Descriptor instead. func (*OpenAPIConfig) Descriptor() ([]byte, []int) { return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP(), []int{6} } func (x *OpenAPIConfig) GetOpenapiOptions() *OpenAPIOptions { if x != nil { return x.OpenapiOptions } return nil } var File_internal_descriptor_openapiconfig_openapiconfig_proto protoreflect.FileDescriptor var file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDesc = []byte{ 0x0a, 0x35, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x73, 0x0a, 0x11, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7b, 0x0a, 0x13, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x4c, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7b, 0x0a, 0x14, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x4d, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x03, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x5b, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x5e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x5e, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x78, 0x0a, 0x0d, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x67, 0x0a, 0x0f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescOnce sync.Once file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescData = file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDesc ) func file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescGZIP() []byte { file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescOnce.Do(func() { file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescData) }) return file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDescData } var file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_internal_descriptor_openapiconfig_openapiconfig_proto_goTypes = []interface{}{ (*OpenAPIFileOption)(nil), // 0: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFileOption (*OpenAPIMethodOption)(nil), // 1: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMethodOption (*OpenAPIMessageOption)(nil), // 2: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMessageOption (*OpenAPIServiceOption)(nil), // 3: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIServiceOption (*OpenAPIFieldOption)(nil), // 4: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFieldOption (*OpenAPIOptions)(nil), // 5: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions (*OpenAPIConfig)(nil), // 6: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIConfig (*options.Swagger)(nil), // 7: grpc.gateway.protoc_gen_openapiv2.options.Swagger (*options.Operation)(nil), // 8: grpc.gateway.protoc_gen_openapiv2.options.Operation (*options.Schema)(nil), // 9: grpc.gateway.protoc_gen_openapiv2.options.Schema (*options.Tag)(nil), // 10: grpc.gateway.protoc_gen_openapiv2.options.Tag (*options.JSONSchema)(nil), // 11: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema } var file_internal_descriptor_openapiconfig_openapiconfig_proto_depIdxs = []int32{ 7, // 0: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFileOption.option:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Swagger 8, // 1: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMethodOption.option:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Operation 9, // 2: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMessageOption.option:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Schema 10, // 3: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIServiceOption.option:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Tag 11, // 4: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFieldOption.option:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema 0, // 5: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions.file:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFileOption 1, // 6: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions.method:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMethodOption 2, // 7: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions.message:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIMessageOption 3, // 8: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions.service:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIServiceOption 4, // 9: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions.field:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIFieldOption 5, // 10: grpc.gateway.internal.descriptor.openapiconfig.OpenAPIConfig.openapi_options:type_name -> grpc.gateway.internal.descriptor.openapiconfig.OpenAPIOptions 11, // [11:11] is the sub-list for method output_type 11, // [11:11] is the sub-list for method input_type 11, // [11:11] is the sub-list for extension type_name 11, // [11:11] is the sub-list for extension extendee 0, // [0:11] is the sub-list for field type_name } func init() { file_internal_descriptor_openapiconfig_openapiconfig_proto_init() } func file_internal_descriptor_openapiconfig_openapiconfig_proto_init() { if File_internal_descriptor_openapiconfig_openapiconfig_proto != nil { return } if !protoimpl.UnsafeEnabled { file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIFileOption); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIMethodOption); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIMessageOption); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIServiceOption); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIFieldOption); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIOptions); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OpenAPIConfig); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDesc, NumEnums: 0, NumMessages: 7, NumExtensions: 0, NumServices: 0, }, GoTypes: file_internal_descriptor_openapiconfig_openapiconfig_proto_goTypes, DependencyIndexes: file_internal_descriptor_openapiconfig_openapiconfig_proto_depIdxs, MessageInfos: file_internal_descriptor_openapiconfig_openapiconfig_proto_msgTypes, }.Build() File_internal_descriptor_openapiconfig_openapiconfig_proto = out.File file_internal_descriptor_openapiconfig_openapiconfig_proto_rawDesc = nil file_internal_descriptor_openapiconfig_openapiconfig_proto_goTypes = nil file_internal_descriptor_openapiconfig_openapiconfig_proto_depIdxs = nil } openapiconfig.proto000066400000000000000000000030241465037340600343250ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapiconfigsyntax = "proto3"; package grpc.gateway.internal.descriptor.openapiconfig; import "protoc-gen-openapiv2/options/openapiv2.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig"; // OpenAPIFileOption represents OpenAPI options on a file message OpenAPIFileOption { string file = 1; grpc.gateway.protoc_gen_openapiv2.options.Swagger option = 2; } // OpenAPIMethodOption represents OpenAPI options on a method message OpenAPIMethodOption { string method = 1; grpc.gateway.protoc_gen_openapiv2.options.Operation option = 2; } // OpenAPIMessageOption represents OpenAPI options on a message message OpenAPIMessageOption { string message = 1; grpc.gateway.protoc_gen_openapiv2.options.Schema option = 2; } // OpenAPIServiceOption represents OpenAPI options on a service message OpenAPIServiceOption { string service = 1; // ex: Service grpc.gateway.protoc_gen_openapiv2.options.Tag option = 2; } // OpenAPIFieldOption represents OpenAPI options on a field message OpenAPIFieldOption { string field = 1; grpc.gateway.protoc_gen_openapiv2.options.JSONSchema option = 2; } // OpenAPIOptions represents OpenAPI protobuf options message OpenAPIOptions { repeated OpenAPIFileOption file = 1; repeated OpenAPIMethodOption method = 2; repeated OpenAPIMessageOption message = 3; repeated OpenAPIServiceOption service = 4; repeated OpenAPIFieldOption field = 5; } // OpenAPIConfig represents a set of OpenAPI options message OpenAPIConfig { OpenAPIOptions openapi_options = 1; } openapiconfig.swagger.json000066400000000000000000000015031465037340600355710ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/openapiconfig{ "swagger": "2.0", "info": { "title": "internal/descriptor/openapiconfig/openapiconfig.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/registry.go000066400000000000000000000672671465037340600300770ustar00rootroot00000000000000package descriptor import ( "fmt" "sort" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" "golang.org/x/text/cases" "golang.org/x/text/language" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) // Registry is a registry of information extracted from pluginpb.CodeGeneratorRequest. type Registry struct { // msgs is a mapping from fully-qualified message name to descriptor msgs map[string]*Message // enums is a mapping from fully-qualified enum name to descriptor enums map[string]*Enum // files is a mapping from file path to descriptor files map[string]*File // meths is a mapping from fully-qualified method name to descriptor meths map[string]*Method // prefix is a prefix to be inserted to golang package paths generated from proto package names. prefix string // pkgMap is a user-specified mapping from file path to proto package. pkgMap map[string]string // pkgAliases is a mapping from package aliases to package paths in go which are already taken. pkgAliases map[string]string // allowDeleteBody permits http delete methods to have a body allowDeleteBody bool // externalHttpRules is a mapping from fully qualified service method names to additional HttpRules applicable besides the ones found in annotations. externalHTTPRules map[string][]*annotations.HttpRule // allowMerge generation one OpenAPI file out of multiple protos allowMerge bool // mergeFileName target OpenAPI file name after merge mergeFileName string // includePackageInTags controls whether the package name defined in the `package` directive // in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. includePackageInTags bool // repeatedPathParamSeparator specifies how path parameter repeated fields are separated repeatedPathParamSeparator repeatedFieldSeparator // useJSONNamesForFields if true json tag name is used for generating fields in OpenAPI definitions, // otherwise the original proto name is used. It's helpful for synchronizing the OpenAPI definition // with gRPC-Gateway response, if it uses json tags for marshaling. useJSONNamesForFields bool // openAPINamingStrategy is the naming strategy to use for assigning OpenAPI field and parameter names. This can be one of the following: // - `legacy`: use the legacy naming strategy from protoc-gen-swagger, that generates unique but not necessarily // maximally concise names. Components are concatenated directly, e.g., `MyOuterMessageMyNestedMessage`. // - `simple`: use a simple heuristic for generating unique and concise names. Components are concatenated using // dots as a separator, e.g., `MyOuterMesage.MyNestedMessage` (if `MyNestedMessage` alone is unique, // `MyNestedMessage` will be used as the OpenAPI name). // - `fqn`: always use the fully-qualified name of the proto message (leading dot removed) as the OpenAPI // name. openAPINamingStrategy string // visibilityRestrictionSelectors is a map of selectors for `google.api.VisibilityRule`s that will be included in the OpenAPI output. visibilityRestrictionSelectors map[string]bool // useGoTemplate determines whether you want to use GO templates // in your protofile comments useGoTemplate bool // goTemplateArgs specifies a list of key value pair inputs to be displayed in Go templates goTemplateArgs map[string]string // ignoreComments determines whether all protofile comments should be excluded from output ignoreComments bool // removeInternalComments determines whether to remove substrings in comments that begin with // `(--` and end with `--)` as specified in https://google.aip.dev/192#internal-comments. removeInternalComments bool // enumsAsInts render enum as integer, as opposed to string enumsAsInts bool // omitEnumDefaultValue omits default value of enum omitEnumDefaultValue bool // disableDefaultErrors disables the generation of the default error types. // This is useful for users who have defined custom error handling. disableDefaultErrors bool // simpleOperationIDs removes the service prefix from the generated // operationIDs. This risks generating duplicate operationIDs. simpleOperationIDs bool standalone bool // warnOnUnboundMethods causes the registry to emit warning logs if an RPC method // has no HttpRule annotation. warnOnUnboundMethods bool // proto3OptionalNullable specifies whether Proto3 Optional fields should be marked as x-nullable. proto3OptionalNullable bool // fileOptions is a mapping of file name to additional OpenAPI file options fileOptions map[string]*options.Swagger // methodOptions is a mapping of fully-qualified method name to additional OpenAPI method options methodOptions map[string]*options.Operation // messageOptions is a mapping of fully-qualified message name to additional OpenAPI message options messageOptions map[string]*options.Schema //serviceOptions is a mapping of fully-qualified service name to additional OpenAPI service options serviceOptions map[string]*options.Tag // fieldOptions is a mapping of the fully-qualified name of the parent message concat // field name and a period to additional OpenAPI field options fieldOptions map[string]*options.JSONSchema // generateUnboundMethods causes the registry to generate proxy methods even for // RPC methods that have no HttpRule annotation. generateUnboundMethods bool // omitPackageDoc, if false, causes a package comment to be included in the generated code. omitPackageDoc bool // recursiveDepth sets the maximum depth of a field parameter recursiveDepth int // annotationMap is used to check for duplicate HTTP annotations annotationMap map[annotationIdentifier]struct{} // disableServiceTags disables the generation of service tags. // This is useful if you do not want to expose the names of your backend grpc services. disableServiceTags bool // disableDefaultResponses disables the generation of default responses. // Useful if you have to support custom response codes that are not 200. disableDefaultResponses bool // useAllOfForRefs, if set, will use allOf as container for $ref to preserve same-level // properties useAllOfForRefs bool // allowPatchFeature determines whether to use PATCH feature involving update masks (using google.protobuf.FieldMask). allowPatchFeature bool // preserveRPCOrder, if true, will ensure the order of paths emitted in openapi swagger files mirror // the order of RPC methods found in proto files. If false, emitted paths will be ordered alphabetically. preserveRPCOrder bool } type repeatedFieldSeparator struct { name string sep rune } type annotationIdentifier struct { method string pathTemplate string service *Service } // NewRegistry returns a new Registry. func NewRegistry() *Registry { return &Registry{ msgs: make(map[string]*Message), enums: make(map[string]*Enum), meths: make(map[string]*Method), files: make(map[string]*File), pkgMap: make(map[string]string), pkgAliases: make(map[string]string), externalHTTPRules: make(map[string][]*annotations.HttpRule), openAPINamingStrategy: "legacy", visibilityRestrictionSelectors: make(map[string]bool), repeatedPathParamSeparator: repeatedFieldSeparator{ name: "csv", sep: ',', }, fileOptions: make(map[string]*options.Swagger), methodOptions: make(map[string]*options.Operation), messageOptions: make(map[string]*options.Schema), serviceOptions: make(map[string]*options.Tag), fieldOptions: make(map[string]*options.JSONSchema), annotationMap: make(map[annotationIdentifier]struct{}), recursiveDepth: 1000, } } // Load loads definitions of services, methods, messages, enumerations and fields from "req". func (r *Registry) Load(req *pluginpb.CodeGeneratorRequest) error { gen, err := protogen.Options{}.New(req) if err != nil { return err } // Note: keep in mind that this might be not enough because // protogen.Plugin is used only to load files here. // The support for features must be set on the pluginpb.CodeGeneratorResponse. codegenerator.SetSupportedFeaturesOnPluginGen(gen) return r.load(gen) } func (r *Registry) LoadFromPlugin(gen *protogen.Plugin) error { return r.load(gen) } func (r *Registry) load(gen *protogen.Plugin) error { filePaths := make([]string, 0, len(gen.FilesByPath)) for filePath := range gen.FilesByPath { filePaths = append(filePaths, filePath) } sort.Strings(filePaths) for _, filePath := range filePaths { r.loadFile(filePath, gen.FilesByPath[filePath]) } for _, filePath := range filePaths { if !gen.FilesByPath[filePath].Generate { continue } file := r.files[filePath] if err := r.loadServices(file); err != nil { return err } } return nil } // loadFile loads messages, enumerations and fields from "file". // It does not loads services and methods in "file". You need to call // loadServices after loadFiles is called for all files to load services and methods. func (r *Registry) loadFile(filePath string, file *protogen.File) { pkg := GoPackage{ Path: string(file.GoImportPath), Name: string(file.GoPackageName), } if r.standalone { pkg.Alias = "ext" + cases.Title(language.AmericanEnglish).String(pkg.Name) } if err := r.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { for i := 0; ; i++ { alias := fmt.Sprintf("%s_%d", pkg.Name, i) if err := r.ReserveGoPackageAlias(alias, pkg.Path); err == nil { pkg.Alias = alias break } } } f := &File{ FileDescriptorProto: file.Proto, GoPkg: pkg, GeneratedFilenamePrefix: file.GeneratedFilenamePrefix, } r.files[filePath] = f r.registerMsg(f, nil, file.Proto.MessageType) r.registerEnum(f, nil, file.Proto.EnumType) } func (r *Registry) registerMsg(file *File, outerPath []string, msgs []*descriptorpb.DescriptorProto) { for i, md := range msgs { m := &Message{ File: file, Outers: outerPath, DescriptorProto: md, Index: i, ForcePrefixedName: r.standalone, } for _, fd := range md.GetField() { m.Fields = append(m.Fields, &Field{ Message: m, FieldDescriptorProto: fd, ForcePrefixedName: r.standalone, }) } file.Messages = append(file.Messages, m) r.msgs[m.FQMN()] = m if grpclog.V(1) { grpclog.Infof("Register name: %s", m.FQMN()) } var outers []string outers = append(outers, outerPath...) outers = append(outers, m.GetName()) r.registerMsg(file, outers, m.GetNestedType()) r.registerEnum(file, outers, m.GetEnumType()) } } func (r *Registry) registerEnum(file *File, outerPath []string, enums []*descriptorpb.EnumDescriptorProto) { for i, ed := range enums { e := &Enum{ File: file, Outers: outerPath, EnumDescriptorProto: ed, Index: i, ForcePrefixedName: r.standalone, } file.Enums = append(file.Enums, e) r.enums[e.FQEN()] = e if grpclog.V(1) { grpclog.Infof("Register enum name: %s", e.FQEN()) } } } // LookupMsg looks up a message type by "name". // It tries to resolve "name" from "location" if "name" is a relative message name. func (r *Registry) LookupMsg(location, name string) (*Message, error) { if grpclog.V(1) { grpclog.Infof("Lookup %s from %s", name, location) } if strings.HasPrefix(name, ".") { m, ok := r.msgs[name] if !ok { return nil, fmt.Errorf("no message found: %s", name) } return m, nil } if !strings.HasPrefix(location, ".") { location = fmt.Sprintf(".%s", location) } components := strings.Split(location, ".") for len(components) > 0 { fqmn := strings.Join(append(components, name), ".") if m, ok := r.msgs[fqmn]; ok { return m, nil } components = components[:len(components)-1] } return nil, fmt.Errorf("no message found: %s", name) } // LookupEnum looks up a enum type by "name". // It tries to resolve "name" from "location" if "name" is a relative enum name. func (r *Registry) LookupEnum(location, name string) (*Enum, error) { if grpclog.V(1) { grpclog.Infof("Lookup enum %s from %s", name, location) } if strings.HasPrefix(name, ".") { e, ok := r.enums[name] if !ok { return nil, fmt.Errorf("no enum found: %s", name) } return e, nil } if !strings.HasPrefix(location, ".") { location = fmt.Sprintf(".%s", location) } components := strings.Split(location, ".") for len(components) > 0 { fqen := strings.Join(append(components, name), ".") if e, ok := r.enums[fqen]; ok { return e, nil } components = components[:len(components)-1] } return nil, fmt.Errorf("no enum found: %s", name) } // LookupFile looks up a file by name. func (r *Registry) LookupFile(name string) (*File, error) { f, ok := r.files[name] if !ok { return nil, fmt.Errorf("no such file given: %s", name) } return f, nil } // LookupExternalHTTPRules looks up external http rules by fully qualified service method name func (r *Registry) LookupExternalHTTPRules(qualifiedMethodName string) []*annotations.HttpRule { return r.externalHTTPRules[qualifiedMethodName] } // AddExternalHTTPRule adds an external http rule for the given fully qualified service method name func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotations.HttpRule) { r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule) } // UnboundExternalHTTPRules returns the list of External HTTPRules // which does not have a matching method in the registry func (r *Registry) UnboundExternalHTTPRules() []string { allServiceMethods := make(map[string]struct{}) for _, f := range r.files { for _, s := range f.GetService() { svc := &Service{File: f, ServiceDescriptorProto: s} for _, m := range s.GetMethod() { method := &Method{Service: svc, MethodDescriptorProto: m} allServiceMethods[method.FQMN()] = struct{}{} } } } var missingMethods []string for httpRuleMethod := range r.externalHTTPRules { if _, ok := allServiceMethods[httpRuleMethod]; !ok { missingMethods = append(missingMethods, httpRuleMethod) } } return missingMethods } // AddPkgMap adds a mapping from a .proto file to proto package name. func (r *Registry) AddPkgMap(file, protoPkg string) { r.pkgMap[file] = protoPkg } // SetPrefix registers the prefix to be added to go package paths generated from proto package names. func (r *Registry) SetPrefix(prefix string) { r.prefix = prefix } // SetStandalone registers standalone flag to control package prefix func (r *Registry) SetStandalone(standalone bool) { r.standalone = standalone } // SetRecursiveDepth records the max recursion count func (r *Registry) SetRecursiveDepth(count int) { r.recursiveDepth = count } // GetRecursiveDepth returns the max recursion count func (r *Registry) GetRecursiveDepth() int { return r.recursiveDepth } // ReserveGoPackageAlias reserves the unique alias of go package. // If succeeded, the alias will be never used for other packages in generated go files. // If failed, the alias is already taken by another package, so you need to use another // alias for the package in your go files. func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error { if taken, ok := r.pkgAliases[alias]; ok { if taken == pkgpath { return nil } return fmt.Errorf("package name %s is already taken. Use another alias", alias) } r.pkgAliases[alias] = pkgpath return nil } // GetAllFQMNs returns a list of all FQMNs func (r *Registry) GetAllFQMNs() []string { keys := make([]string, 0, len(r.msgs)) for k := range r.msgs { keys = append(keys, k) } return keys } // GetAllFQENs returns a list of all FQENs func (r *Registry) GetAllFQENs() []string { keys := make([]string, 0, len(r.enums)) for k := range r.enums { keys = append(keys, k) } return keys } func (r *Registry) GetAllFQMethNs() []string { keys := make([]string, 0, len(r.meths)) for k := range r.meths { keys = append(keys, k) } return keys } // SetAllowDeleteBody controls whether http delete methods may have a // body or fail loading if encountered. func (r *Registry) SetAllowDeleteBody(allow bool) { r.allowDeleteBody = allow } // SetAllowMerge controls whether generation one OpenAPI file out of multiple protos func (r *Registry) SetAllowMerge(allow bool) { r.allowMerge = allow } // IsAllowMerge whether generation one OpenAPI file out of multiple protos func (r *Registry) IsAllowMerge() bool { return r.allowMerge } // SetMergeFileName controls the target OpenAPI file name out of multiple protos func (r *Registry) SetMergeFileName(mergeFileName string) { r.mergeFileName = mergeFileName } // SetIncludePackageInTags controls whether the package name defined in the `package` directive // in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. func (r *Registry) SetIncludePackageInTags(allow bool) { r.includePackageInTags = allow } // IsIncludePackageInTags checks whether the package name defined in the `package` directive // in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. func (r *Registry) IsIncludePackageInTags() bool { return r.includePackageInTags } // GetRepeatedPathParamSeparator returns a rune spcifying how // path parameter repeated fields are separated. func (r *Registry) GetRepeatedPathParamSeparator() rune { return r.repeatedPathParamSeparator.sep } // GetRepeatedPathParamSeparatorName returns the name path parameter repeated // fields repeatedFieldSeparator. I.e. 'csv', 'pipe', 'ssv' or 'tsv' func (r *Registry) GetRepeatedPathParamSeparatorName() string { return r.repeatedPathParamSeparator.name } // SetRepeatedPathParamSeparator sets how path parameter repeated fields are // separated. Allowed names are 'csv', 'pipe', 'ssv' and 'tsv'. func (r *Registry) SetRepeatedPathParamSeparator(name string) error { var sep rune switch name { case "csv": sep = ',' case "pipes": sep = '|' case "ssv": sep = ' ' case "tsv": sep = '\t' default: return fmt.Errorf("unknown repeated path parameter separator: %s", name) } r.repeatedPathParamSeparator = repeatedFieldSeparator{ name: name, sep: sep, } return nil } // SetUseJSONNamesForFields sets useJSONNamesForFields func (r *Registry) SetUseJSONNamesForFields(use bool) { r.useJSONNamesForFields = use } // GetUseJSONNamesForFields returns useJSONNamesForFields func (r *Registry) GetUseJSONNamesForFields() bool { return r.useJSONNamesForFields } // SetUseFQNForOpenAPIName sets useFQNForOpenAPIName // Deprecated: use SetOpenAPINamingStrategy instead. func (r *Registry) SetUseFQNForOpenAPIName(use bool) { r.openAPINamingStrategy = "fqn" } // GetUseFQNForOpenAPIName returns useFQNForOpenAPIName // Deprecated: Use GetOpenAPINamingStrategy(). func (r *Registry) GetUseFQNForOpenAPIName() bool { return r.openAPINamingStrategy == "fqn" } // GetMergeFileName return the target merge OpenAPI file name func (r *Registry) GetMergeFileName() string { return r.mergeFileName } // SetOpenAPINamingStrategy sets the naming strategy to be used. func (r *Registry) SetOpenAPINamingStrategy(strategy string) { r.openAPINamingStrategy = strategy } // GetOpenAPINamingStrategy retrieves the naming strategy that is in use. func (r *Registry) GetOpenAPINamingStrategy() string { return r.openAPINamingStrategy } // SetUseGoTemplate sets useGoTemplate func (r *Registry) SetUseGoTemplate(use bool) { r.useGoTemplate = use } // GetUseGoTemplate returns useGoTemplate func (r *Registry) GetUseGoTemplate() bool { return r.useGoTemplate } func (r *Registry) SetGoTemplateArgs(kvs []string) { r.goTemplateArgs = make(map[string]string) for _, kv := range kvs { if key, value, found := strings.Cut(kv, "="); found { r.goTemplateArgs[key] = value } } } func (r *Registry) GetGoTemplateArgs() map[string]string { return r.goTemplateArgs } // SetIgnoreComments sets ignoreComments func (r *Registry) SetIgnoreComments(ignore bool) { r.ignoreComments = ignore } // GetIgnoreComments returns ignoreComments func (r *Registry) GetIgnoreComments() bool { return r.ignoreComments } // SetRemoveInternalComments sets removeInternalComments func (r *Registry) SetRemoveInternalComments(remove bool) { r.removeInternalComments = remove } // GetRemoveInternalComments returns removeInternalComments func (r *Registry) GetRemoveInternalComments() bool { return r.removeInternalComments } // SetEnumsAsInts set enumsAsInts func (r *Registry) SetEnumsAsInts(enumsAsInts bool) { r.enumsAsInts = enumsAsInts } // GetEnumsAsInts returns enumsAsInts func (r *Registry) GetEnumsAsInts() bool { return r.enumsAsInts } // SetOmitEnumDefaultValue sets omitEnumDefaultValue func (r *Registry) SetOmitEnumDefaultValue(omit bool) { r.omitEnumDefaultValue = omit } // GetOmitEnumDefaultValue returns omitEnumDefaultValue func (r *Registry) GetOmitEnumDefaultValue() bool { return r.omitEnumDefaultValue } // SetVisibilityRestrictionSelectors sets the visibility restriction selectors. func (r *Registry) SetVisibilityRestrictionSelectors(selectors []string) { r.visibilityRestrictionSelectors = make(map[string]bool) for _, selector := range selectors { r.visibilityRestrictionSelectors[strings.TrimSpace(selector)] = true } } // GetVisibilityRestrictionSelectors retrieves he visibility restriction selectors. func (r *Registry) GetVisibilityRestrictionSelectors() map[string]bool { return r.visibilityRestrictionSelectors } // SetDisableDefaultErrors sets disableDefaultErrors func (r *Registry) SetDisableDefaultErrors(use bool) { r.disableDefaultErrors = use } // GetDisableDefaultErrors returns disableDefaultErrors func (r *Registry) GetDisableDefaultErrors() bool { return r.disableDefaultErrors } // SetSimpleOperationIDs sets simpleOperationIDs func (r *Registry) SetSimpleOperationIDs(use bool) { r.simpleOperationIDs = use } // GetSimpleOperationIDs returns simpleOperationIDs func (r *Registry) GetSimpleOperationIDs() bool { return r.simpleOperationIDs } // SetWarnOnUnboundMethods sets warnOnUnboundMethods func (r *Registry) SetWarnOnUnboundMethods(warn bool) { r.warnOnUnboundMethods = warn } // SetGenerateUnboundMethods sets generateUnboundMethods func (r *Registry) SetGenerateUnboundMethods(generate bool) { r.generateUnboundMethods = generate } // SetOmitPackageDoc controls whether the generated code contains a package comment (if set to false, it will contain one) func (r *Registry) SetOmitPackageDoc(omit bool) { r.omitPackageDoc = omit } // GetOmitPackageDoc returns whether a package comment will be omitted from the generated code func (r *Registry) GetOmitPackageDoc() bool { return r.omitPackageDoc } // SetProto3OptionalNullable set proto3OtionalNullable func (r *Registry) SetProto3OptionalNullable(proto3OtionalNullable bool) { r.proto3OptionalNullable = proto3OtionalNullable } // GetProto3OptionalNullable returns proto3OtionalNullable func (r *Registry) GetProto3OptionalNullable() bool { return r.proto3OptionalNullable } // RegisterOpenAPIOptions registers OpenAPI options func (r *Registry) RegisterOpenAPIOptions(opts *openapiconfig.OpenAPIOptions) error { if opts == nil { return nil } for _, opt := range opts.File { if _, ok := r.files[opt.File]; !ok { return fmt.Errorf("no file %s found", opt.File) } r.fileOptions[opt.File] = opt.Option } // build map of all registered methods methods := make(map[string]struct{}) services := make(map[string]struct{}) for _, f := range r.files { for _, s := range f.Services { services[s.FQSN()] = struct{}{} for _, m := range s.Methods { methods[m.FQMN()] = struct{}{} } } } for _, opt := range opts.Method { qualifiedMethod := "." + opt.Method if _, ok := methods[qualifiedMethod]; !ok { return fmt.Errorf("no method %s found", opt.Method) } r.methodOptions[qualifiedMethod] = opt.Option } for _, opt := range opts.Message { qualifiedMessage := "." + opt.Message if _, ok := r.msgs[qualifiedMessage]; !ok { return fmt.Errorf("no message %s found", opt.Message) } r.messageOptions[qualifiedMessage] = opt.Option } for _, opt := range opts.Service { qualifiedService := "." + opt.Service if _, ok := services[qualifiedService]; !ok { return fmt.Errorf("no service %s found", opt.Service) } r.serviceOptions[qualifiedService] = opt.Option } // build map of all registered fields fields := make(map[string]struct{}) for _, m := range r.msgs { for _, f := range m.Fields { fields[f.FQFN()] = struct{}{} } } for _, opt := range opts.Field { qualifiedField := "." + opt.Field if _, ok := fields[qualifiedField]; !ok { return fmt.Errorf("no field %s found", opt.Field) } r.fieldOptions[qualifiedField] = opt.Option } return nil } // GetOpenAPIFileOption returns a registered OpenAPI option for a file func (r *Registry) GetOpenAPIFileOption(file string) (*options.Swagger, bool) { opt, ok := r.fileOptions[file] return opt, ok } // GetOpenAPIMethodOption returns a registered OpenAPI option for a method func (r *Registry) GetOpenAPIMethodOption(qualifiedMethod string) (*options.Operation, bool) { opt, ok := r.methodOptions[qualifiedMethod] return opt, ok } // GetOpenAPIMessageOption returns a registered OpenAPI option for a message func (r *Registry) GetOpenAPIMessageOption(qualifiedMessage string) (*options.Schema, bool) { opt, ok := r.messageOptions[qualifiedMessage] return opt, ok } // GetOpenAPIServiceOption returns a registered OpenAPI option for a service func (r *Registry) GetOpenAPIServiceOption(qualifiedService string) (*options.Tag, bool) { opt, ok := r.serviceOptions[qualifiedService] return opt, ok } // GetOpenAPIFieldOption returns a registered OpenAPI option for a field func (r *Registry) GetOpenAPIFieldOption(qualifiedField string) (*options.JSONSchema, bool) { opt, ok := r.fieldOptions[qualifiedField] return opt, ok } func (r *Registry) FieldName(f *Field) string { if r.useJSONNamesForFields { return f.GetJsonName() } return f.GetName() } func (r *Registry) CheckDuplicateAnnotation(httpMethod string, httpTemplate string, svc *Service) error { a := annotationIdentifier{method: httpMethod, pathTemplate: httpTemplate, service: svc} if _, ok := r.annotationMap[a]; ok { return fmt.Errorf("duplicate annotation: method=%s, template=%s", httpMethod, httpTemplate) } r.annotationMap[a] = struct{}{} return nil } // SetDisableServiceTags sets disableServiceTags func (r *Registry) SetDisableServiceTags(use bool) { r.disableServiceTags = use } // GetDisableServiceTags returns disableServiceTags func (r *Registry) GetDisableServiceTags() bool { return r.disableServiceTags } // SetDisableDefaultResponses setsdisableDefaultResponses func (r *Registry) SetDisableDefaultResponses(use bool) { r.disableDefaultResponses = use } // GetDisableDefaultResponses returns disableDefaultResponses func (r *Registry) GetDisableDefaultResponses() bool { return r.disableDefaultResponses } // SetUseAllOfForRefs sets useAllOfForRefs func (r *Registry) SetUseAllOfForRefs(use bool) { r.useAllOfForRefs = use } // GetUseAllOfForRefs returns useAllOfForRefs func (r *Registry) GetUseAllOfForRefs() bool { return r.useAllOfForRefs } // SetAllowPatchFeature sets allowPatchFeature func (r *Registry) SetAllowPatchFeature(allow bool) { r.allowPatchFeature = allow } // GetAllowPatchFeature returns allowPatchFeature func (r *Registry) GetAllowPatchFeature() bool { return r.allowPatchFeature } // SetPreserveRPCOrder sets preserveRPCOrder func (r *Registry) SetPreserveRPCOrder(preserve bool) { r.preserveRPCOrder = preserve } // IsPreserveRPCOrder returns preserveRPCOrder func (r *Registry) IsPreserveRPCOrder() bool { return r.preserveRPCOrder } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/registry_test.go000066400000000000000000000500201465037340600311110ustar00rootroot00000000000000package descriptor import ( "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) func newGeneratorFromSources(req *pluginpb.CodeGeneratorRequest, sources ...string) (*protogen.Plugin, error) { for _, src := range sources { var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { return nil, err } req.FileToGenerate = append(req.FileToGenerate, fd.GetName()) req.ProtoFile = append(req.ProtoFile, &fd) } return protogen.Options{}.New(req) } func loadFileWithCodeGeneratorRequest(t *testing.T, reg *Registry, req *pluginpb.CodeGeneratorRequest, sources ...string) []*descriptorpb.FileDescriptorProto { t.Helper() plugin, err := newGeneratorFromSources(req, sources...) if err != nil { t.Fatalf("failed to create a generator: %v", err) } err = reg.LoadFromPlugin(plugin) if err != nil { t.Fatalf("failed to Registry.LoadFromPlugin(): %v", err) } return plugin.Request.ProtoFile } func loadFile(t *testing.T, reg *Registry, src string) *descriptorpb.FileDescriptorProto { t.Helper() fds := loadFileWithCodeGeneratorRequest(t, reg, &pluginpb.CodeGeneratorRequest{}, src) return fds[0] } func TestLoadFile(t *testing.T) { reg := NewRegistry() fd := loadFile(t, reg, ` name: 'example.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > message_type < name: 'ExampleMessage' field < name: 'str' label: LABEL_OPTIONAL type: TYPE_STRING number: 1 > > `) file := reg.files["example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } msg, err := reg.LookupMsg("", ".example.ExampleMessage") if err != nil { t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", "", ".example.ExampleMessage", err) return } if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", "", ".example.ExampleMessage", got, want) } if got, want := msg.File, file; got != want { t.Errorf("msg.File = %v; want %v", got, want) } if got := msg.Outers; got != nil { t.Errorf("msg.Outers = %v; want %v", got, nil) } if got, want := len(msg.Fields), 1; got != want { t.Errorf("len(msg.Fields) = %d; want %d", got, want) } else if got, want := msg.Fields[0].FieldDescriptorProto, fd.MessageType[0].Field[0]; got != want { t.Errorf("msg.Fields[0].FieldDescriptorProto = %v; want %v", got, want) } else if got, want := msg.Fields[0].Message, msg; got != want { t.Errorf("msg.Fields[0].Message = %v; want %v", got, want) } if got, want := len(file.Messages), 1; got != want { t.Errorf("file.Meeesages = %#v; want %#v", file.Messages, []*Message{msg}) } if got, want := file.Messages[0], msg; got != want { t.Errorf("file.Meeesages[0] = %v; want %v", got, want) } } func TestLoadFileNestedPackage(t *testing.T) { reg := NewRegistry() loadFile(t, reg, ` name: 'example.proto' package: 'example.nested.nested2' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.nested.nested2' > `) file := reg.files["example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.nested.nested2", Name: "example_nested_nested2"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadFileWithDir(t *testing.T) { reg := NewRegistry() loadFile(t, reg, ` name: 'path/to/example.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `) file := reg.files["path/to/example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadFileWithoutPackage(t *testing.T) { reg := NewRegistry() loadFile(t, reg, ` name: 'path/to/example_file.proto' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example_file' > `) file := reg.files["path/to/example_file.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example_file", Name: "example_file"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadFileWithMapping(t *testing.T) { reg := NewRegistry() loadFileWithCodeGeneratorRequest(t, reg, &pluginpb.CodeGeneratorRequest{ Parameter: proto.String("Mpath/to/example.proto=example.com/proj/example/proto"), }, ` name: 'path/to/example.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `) file := reg.files["path/to/example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "example.com/proj/example/proto", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadFileWithPackageNameCollision(t *testing.T) { reg := NewRegistry() loadFile(t, reg, ` name: 'path/to/another.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `) loadFile(t, reg, ` name: 'path/to/example.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `) if err := reg.ReserveGoPackageAlias("ioutil", "io/ioutil"); err != nil { t.Fatalf("reg.ReserveGoPackageAlias(%q) failed with %v; want success", "ioutil", err) } loadFile(t, reg, ` name: 'path/to/ioutil.proto' package: 'ioutil' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/ioutil' > `) file := reg.files["path/to/another.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/another.proto") return } wantPkg := GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } file = reg.files["path/to/example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/example.proto") return } wantPkg = GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example", Name: "example", Alias: ""} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } file = reg.files["path/to/ioutil.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/ioutil.proto") return } wantPkg = GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/ioutil", Name: "ioutil", Alias: "ioutil_0"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadFileWithIdenticalGoPkg(t *testing.T) { reg := NewRegistry() loadFileWithCodeGeneratorRequest(t, reg, &pluginpb.CodeGeneratorRequest{ Parameter: proto.String("Mpath/to/another.proto=example.com/example,Mpath/to/example.proto=example.com/example"), }, ` name: 'path/to/another.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `, ` name: 'path/to/example.proto' package: 'example' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > `) file := reg.files["path/to/example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "example.com/example", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } file = reg.files["path/to/another.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg = GoPackage{Path: "example.com/example", Name: "example"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } // TestLookupMsgWithoutPackage tests a case when there is no "package" directive. // In Go, it is required to have a generated package so we rely on // google.golang.org/protobuf/compiler/protogen to provide it. func TestLookupMsgWithoutPackage(t *testing.T) { reg := NewRegistry() fd := loadFile(t, reg, ` name: 'example.proto' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > message_type < name: 'ExampleMessage' field < name: 'str' label: LABEL_OPTIONAL type: TYPE_STRING number: 1 > > `) msg, err := reg.LookupMsg("", ".ExampleMessage") if err != nil { t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", "", ".ExampleMessage", err) return } if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", "", ".ExampleMessage", got, want) } } func TestLookupMsgWithNestedPackage(t *testing.T) { reg := NewRegistry() fd := loadFile(t, reg, ` name: 'example.proto' package: 'nested.nested2.mypackage' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > message_type < name: 'ExampleMessage' field < name: 'str' label: LABEL_OPTIONAL type: TYPE_STRING number: 1 > > `) for _, name := range []string{ "nested.nested2.mypackage.ExampleMessage", "nested2.mypackage.ExampleMessage", "mypackage.ExampleMessage", "ExampleMessage", } { msg, err := reg.LookupMsg("nested.nested2.mypackage", name) if err != nil { t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", ".nested.nested2.mypackage", name, err) return } if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", ".nested.nested2.mypackage", name, got, want) } } for _, loc := range []string{ ".nested.nested2.mypackage", "nested.nested2.mypackage", ".nested.nested2", "nested.nested2", ".nested", "nested", ".", "", "somewhere.else", } { name := "nested.nested2.mypackage.ExampleMessage" msg, err := reg.LookupMsg(loc, name) if err != nil { t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", loc, name, err) return } if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", loc, name, got, want) } } for _, loc := range []string{ ".nested.nested2.mypackage", "nested.nested2.mypackage", ".nested.nested2", "nested.nested2", ".nested", "nested", } { name := "nested2.mypackage.ExampleMessage" msg, err := reg.LookupMsg(loc, name) if err != nil { t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", loc, name, err) return } if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", loc, name, got, want) } } } func TestLoadWithInconsistentTargetPackage(t *testing.T) { for _, spec := range []struct { req string consistent bool }{ // root package, explicit go package { req: ` file_to_generate: 'a.proto' file_to_generate: 'b.proto' proto_file < name: 'a.proto' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.foo' > message_type < name: 'A' > service < name: "AService" method < name: "Meth" input_type: "A" output_type: "A" options < [google.api.http] < post: "/v1/a" body: "*" > > > > > proto_file < name: 'b.proto' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.foo' > message_type < name: 'B' > service < name: "BService" method < name: "Meth" input_type: "B" output_type: "B" options < [google.api.http] < post: "/v1/b" body: "*" > > > > > `, consistent: true, }, // named package, explicit go package { req: ` file_to_generate: 'a.proto' file_to_generate: 'b.proto' proto_file < name: 'a.proto' package: 'example.foo' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.foo' > message_type < name: 'A' > service < name: "AService" method < name: "Meth" input_type: "A" output_type: "A" options < [google.api.http] < post: "/v1/a" body: "*" > > > > > proto_file < name: 'b.proto' package: 'example.foo' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example.foo' > message_type < name: 'B' > service < name: "BService" method < name: "Meth" input_type: "B" output_type: "B" options < [google.api.http] < post: "/v1/b" body: "*" > > > > > `, consistent: true, }, } { var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(spec.req), &req); err != nil { t.Fatalf("proto.UnmarshalText(%s, &file) failed with %v; want success", spec.req, err) } _, err := newGeneratorFromSources(&req) if got, want := err == nil, spec.consistent; got != want { if want { t.Errorf("reg.Load(%s) failed with %v; want success", spec.req, err) continue } t.Errorf("reg.Load(%s) succeeded; want an package inconsistency error", spec.req) } } } func TestLoadOverriddenPackageName(t *testing.T) { reg := NewRegistry() loadFile(t, reg, ` name: 'example.proto' package: 'example' options < go_package: 'example.com/xyz;pb' > `) file := reg.files["example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "example.com/xyz", Name: "pb"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestLoadWithStandalone(t *testing.T) { reg := NewRegistry() reg.SetStandalone(true) loadFile(t, reg, ` name: 'example.proto' package: 'example' options < go_package: 'example.com/xyz;pb' > `) file := reg.files["example.proto"] if file == nil { t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") return } wantPkg := GoPackage{Path: "example.com/xyz", Name: "pb", Alias: "extPb"} if got, want := file.GoPkg, wantPkg; got != want { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } func TestUnboundExternalHTTPRules(t *testing.T) { reg := NewRegistry() methodName := ".example.ExampleService.Echo" reg.AddExternalHTTPRule(methodName, nil) assertStringSlice(t, "unbound external HTTP rules", reg.UnboundExternalHTTPRules(), []string{methodName}) loadFile(t, reg, ` name: "path/to/example.proto", package: "example" options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" > > `) assertStringSlice(t, "unbound external HTTP rules", reg.UnboundExternalHTTPRules(), []string{}) } func TestRegisterOpenAPIOptions(t *testing.T) { codeReqText := `file_to_generate: 'a.proto' proto_file < name: 'a.proto' package: 'example.foo' options < go_package: 'github.com/grpc-ecosystem/grpc-gateway/runtime/internal/example' > message_type < name: 'ExampleMessage' field < name: 'str' label: LABEL_OPTIONAL type: TYPE_STRING number: 1 > > service < name: "AService" method < name: "Meth" input_type: "ExampleMessage" output_type: "ExampleMessage" options < [google.api.http] < post: "/v1/a" body: "*" > > > > > ` var codeReq pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(codeReqText), &codeReq); err != nil { t.Fatalf("proto.UnmarshalText(%s, &file) failed with %v; want success", codeReqText, err) } for _, tcase := range []struct { options *openapiconfig.OpenAPIOptions shouldErr bool desc string }{ { desc: "handle nil options", }, { desc: "successfully add options if referenced entity exists", options: &openapiconfig.OpenAPIOptions{ File: []*openapiconfig.OpenAPIFileOption{ { File: "a.proto", }, }, Method: []*openapiconfig.OpenAPIMethodOption{ { Method: "example.foo.AService.Meth", }, }, Message: []*openapiconfig.OpenAPIMessageOption{ { Message: "example.foo.ExampleMessage", }, }, Service: []*openapiconfig.OpenAPIServiceOption{ { Service: "example.foo.AService", }, }, Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.foo.ExampleMessage.str", }, }, }, }, { desc: "reject fully qualified names with leading \".\"", options: &openapiconfig.OpenAPIOptions{ File: []*openapiconfig.OpenAPIFileOption{ { File: "a.proto", }, }, Method: []*openapiconfig.OpenAPIMethodOption{ { Method: ".example.foo.AService.Meth", }, }, Message: []*openapiconfig.OpenAPIMessageOption{ { Message: ".example.foo.ExampleMessage", }, }, Service: []*openapiconfig.OpenAPIServiceOption{ { Service: ".example.foo.AService", }, }, Field: []*openapiconfig.OpenAPIFieldOption{ { Field: ".example.foo.ExampleMessage.str", }, }, }, shouldErr: true, }, { desc: "error if file does not exist", options: &openapiconfig.OpenAPIOptions{ File: []*openapiconfig.OpenAPIFileOption{ { File: "b.proto", }, }, }, shouldErr: true, }, { desc: "error if method does not exist", options: &openapiconfig.OpenAPIOptions{ Method: []*openapiconfig.OpenAPIMethodOption{ { Method: "example.foo.AService.Meth2", }, }, }, shouldErr: true, }, { desc: "error if message does not exist", options: &openapiconfig.OpenAPIOptions{ Message: []*openapiconfig.OpenAPIMessageOption{ { Message: "example.foo.NonexistentMessage", }, }, }, shouldErr: true, }, { desc: "error if service does not exist", options: &openapiconfig.OpenAPIOptions{ Service: []*openapiconfig.OpenAPIServiceOption{ { Service: "example.foo.AService1", }, }, }, shouldErr: true, }, { desc: "error if field does not exist", options: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.foo.ExampleMessage.str1", }, }, }, shouldErr: true, }, } { t.Run(tcase.desc, func(t *testing.T) { reg := NewRegistry() loadFileWithCodeGeneratorRequest(t, reg, &codeReq) err := reg.RegisterOpenAPIOptions(tcase.options) if (err != nil) != tcase.shouldErr { t.Fatalf("got unexpected error: %s", err) } }) } } func assertStringSlice(t *testing.T, message string, got, want []string) { if len(got) != len(want) { t.Errorf("%s = %#v len(%d); want %#v len(%d)", message, got, len(got), want, len(want)) } for i := range want { if got[i] != want[i] { t.Errorf("%s[%d] = %#v; want %#v", message, i, got[i], want[i]) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/services.go000066400000000000000000000227131465037340600300350ustar00rootroot00000000000000package descriptor import ( "errors" "fmt" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" options "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) // loadServices registers services and their methods from "targetFile" to "r". // It must be called after loadFile is called for all files so that loadServices // can resolve names of message types and their fields. func (r *Registry) loadServices(file *File) error { if grpclog.V(1) { grpclog.Infof("Loading services from %s", file.GetName()) } var svcs []*Service for _, sd := range file.GetService() { if grpclog.V(2) { grpclog.Infof("Registering %s", sd.GetName()) } svc := &Service{ File: file, ServiceDescriptorProto: sd, ForcePrefixedName: r.standalone, } for _, md := range sd.GetMethod() { if grpclog.V(2) { grpclog.Infof("Processing %s.%s", sd.GetName(), md.GetName()) } opts, err := extractAPIOptions(md) if err != nil { grpclog.Errorf("Failed to extract HttpRule from %s.%s: %v", svc.GetName(), md.GetName(), err) return err } optsList := r.LookupExternalHTTPRules((&Method{Service: svc, MethodDescriptorProto: md}).FQMN()) if opts != nil { optsList = append(optsList, opts) } if len(optsList) == 0 { if r.generateUnboundMethods { defaultOpts, err := defaultAPIOptions(svc, md) if err != nil { grpclog.Errorf("Failed to generate default HttpRule from %s.%s: %v", svc.GetName(), md.GetName(), err) return err } optsList = append(optsList, defaultOpts) } else { if grpclog.V(1) { logFn := grpclog.Infof if r.warnOnUnboundMethods { logFn = grpclog.Warningf } logFn("No HttpRule found for method: %s.%s", svc.GetName(), md.GetName()) } } } meth, err := r.newMethod(svc, md, optsList) if err != nil { return err } svc.Methods = append(svc.Methods, meth) r.meths[meth.FQMN()] = meth } if len(svc.Methods) == 0 { continue } if grpclog.V(2) { grpclog.Infof("Registered %s with %d method(s)", svc.GetName(), len(svc.Methods)) } svcs = append(svcs, svc) } file.Services = svcs return nil } func (r *Registry) newMethod(svc *Service, md *descriptorpb.MethodDescriptorProto, optsList []*options.HttpRule) (*Method, error) { requestType, err := r.LookupMsg(svc.File.GetPackage(), md.GetInputType()) if err != nil { return nil, err } responseType, err := r.LookupMsg(svc.File.GetPackage(), md.GetOutputType()) if err != nil { return nil, err } meth := &Method{ Service: svc, MethodDescriptorProto: md, RequestType: requestType, ResponseType: responseType, } newBinding := func(opts *options.HttpRule, idx int) (*Binding, error) { var ( httpMethod string pathTemplate string ) switch { case opts.GetGet() != "": httpMethod = "GET" pathTemplate = opts.GetGet() if opts.Body != "" { return nil, fmt.Errorf("must not set request body when http method is GET: %s", md.GetName()) } case opts.GetPut() != "": httpMethod = "PUT" pathTemplate = opts.GetPut() case opts.GetPost() != "": httpMethod = "POST" pathTemplate = opts.GetPost() case opts.GetDelete() != "": httpMethod = "DELETE" pathTemplate = opts.GetDelete() if opts.Body != "" && !r.allowDeleteBody { return nil, fmt.Errorf("must not set request body when http method is DELETE except allow_delete_body option is true: %s", md.GetName()) } case opts.GetPatch() != "": httpMethod = "PATCH" pathTemplate = opts.GetPatch() case opts.GetCustom() != nil: custom := opts.GetCustom() httpMethod = custom.Kind pathTemplate = custom.Path default: if grpclog.V(1) { grpclog.Infof("No pattern specified in google.api.HttpRule: %s", md.GetName()) } return nil, nil } parsed, err := httprule.Parse(pathTemplate) if err != nil { return nil, err } tmpl := parsed.Compile() if md.GetClientStreaming() && len(tmpl.Fields) > 0 { return nil, errors.New("cannot use path parameter in client streaming") } b := &Binding{ Method: meth, Index: idx, PathTmpl: tmpl, HTTPMethod: httpMethod, } for _, f := range tmpl.Fields { param, err := r.newParam(meth, f) if err != nil { return nil, err } b.PathParams = append(b.PathParams, param) } // TODO(yugui) Handle query params b.Body, err = r.newBody(meth, opts.Body) if err != nil { return nil, err } b.ResponseBody, err = r.newResponse(meth, opts.ResponseBody) if err != nil { return nil, err } return b, nil } applyOpts := func(opts *options.HttpRule) error { b, err := newBinding(opts, len(meth.Bindings)) if err != nil { return err } if b != nil { meth.Bindings = append(meth.Bindings, b) } for _, additional := range opts.GetAdditionalBindings() { if len(additional.AdditionalBindings) > 0 { return fmt.Errorf("additional_binding in additional_binding not allowed: %s.%s", svc.GetName(), meth.GetName()) } b, err := newBinding(additional, len(meth.Bindings)) if err != nil { return err } meth.Bindings = append(meth.Bindings, b) } return nil } for _, opts := range optsList { if err := applyOpts(opts); err != nil { return nil, err } } return meth, nil } func extractAPIOptions(meth *descriptorpb.MethodDescriptorProto) (*options.HttpRule, error) { if meth.Options == nil { return nil, nil } if !proto.HasExtension(meth.Options, options.E_Http) { return nil, nil } ext := proto.GetExtension(meth.Options, options.E_Http) opts, ok := ext.(*options.HttpRule) if !ok { return nil, fmt.Errorf("extension is %T; want an HttpRule", ext) } return opts, nil } func defaultAPIOptions(svc *Service, md *descriptorpb.MethodDescriptorProto) (*options.HttpRule, error) { // FQSN prefixes the service's full name with a '.', e.g.: '.example.ExampleService' fqsn := strings.TrimPrefix(svc.FQSN(), ".") // This generates an HttpRule that matches the gRPC mapping to HTTP/2 described in // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests // i.e.: // * method is POST // * path is "//" // * body should contain the serialized request message rule := &options.HttpRule{ Pattern: &options.HttpRule_Post{ Post: fmt.Sprintf("/%s/%s", fqsn, md.GetName()), }, Body: "*", } return rule, nil } func (r *Registry) newParam(meth *Method, path string) (Parameter, error) { msg := meth.RequestType fields, err := r.resolveFieldPath(msg, path, true) if err != nil { return Parameter{}, err } l := len(fields) if l == 0 { return Parameter{}, fmt.Errorf("invalid field access list for %s", path) } target := fields[l-1].Target switch target.GetType() { case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, descriptorpb.FieldDescriptorProto_TYPE_GROUP: if grpclog.V(2) { grpclog.Infoln("found aggregate type:", target, target.TypeName) } if IsWellKnownType(*target.TypeName) { if grpclog.V(2) { grpclog.Infoln("found well known aggregate type:", target) } } else { return Parameter{}, fmt.Errorf("%s.%s: %s is a protobuf message type. Protobuf message types cannot be used as path parameters, use a scalar value type (such as string) instead", meth.Service.GetName(), meth.GetName(), path) } } return Parameter{ FieldPath: FieldPath(fields), Method: meth, Target: fields[l-1].Target, }, nil } func (r *Registry) newBody(meth *Method, path string) (*Body, error) { switch path { case "": return nil, nil case "*": return &Body{FieldPath: nil}, nil } msg := meth.RequestType fields, err := r.resolveFieldPath(msg, path, false) if err != nil { return nil, err } return &Body{FieldPath: FieldPath(fields)}, nil } func (r *Registry) newResponse(meth *Method, path string) (*Body, error) { msg := meth.ResponseType switch path { case "", "*": return nil, nil } fields, err := r.resolveFieldPath(msg, path, false) if err != nil { return nil, err } return &Body{FieldPath: FieldPath(fields)}, nil } // lookupField looks up a field named "name" within "msg". // It returns nil if no such field found. func lookupField(msg *Message, name string) *Field { for _, f := range msg.Fields { if f.GetName() == name { return f } } return nil } // resolveFieldPath resolves "path" into a list of fieldDescriptor, starting from "msg". func (r *Registry) resolveFieldPath(msg *Message, path string, isPathParam bool) ([]FieldPathComponent, error) { if path == "" { return nil, nil } root := msg var result []FieldPathComponent for i, c := range strings.Split(path, ".") { if i > 0 { f := result[i-1].Target switch f.GetType() { case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, descriptorpb.FieldDescriptorProto_TYPE_GROUP: var err error msg, err = r.LookupMsg(msg.FQMN(), f.GetTypeName()) if err != nil { return nil, err } default: return nil, fmt.Errorf("not an aggregate type: %s in %s", f.GetName(), path) } } if grpclog.V(2) { grpclog.Infof("Lookup %s in %s", c, msg.FQMN()) } f := lookupField(msg, c) if f == nil { return nil, fmt.Errorf("no field %q found in %s", path, root.GetName()) } if isPathParam && f.GetProto3Optional() { return nil, fmt.Errorf("optional field not allowed in field path: %s in %s", f.GetName(), path) } result = append(result, FieldPathComponent{Name: c, Target: f}) } return result, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/services_test.go000066400000000000000000001031771465037340600311000ustar00rootroot00000000000000package descriptor import ( "reflect" "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) func compilePath(t *testing.T, path string) httprule.Template { parsed, err := httprule.Parse(path) if err != nil { t.Fatalf("httprule.Parse(%q) failed with %v; want success", path, err) } return parsed.Compile() } func testExtractServices(t *testing.T, input []*descriptorpb.FileDescriptorProto, target string, wantSvcs []*Service) { testExtractServicesWithRegistry(t, NewRegistry(), input, target, wantSvcs) } func testExtractServicesWithRegistry(t *testing.T, reg *Registry, input []*descriptorpb.FileDescriptorProto, target string, wantSvcs []*Service) { for _, file := range input { reg.loadFile(file.GetName(), &protogen.File{ Proto: file, }) } err := reg.loadServices(reg.files[target]) if err != nil { t.Errorf("loadServices(%q) failed with %v; want success; files=%v", target, err, input) } file := reg.files[target] svcs := file.Services var i int for i = 0; i < len(svcs) && i < len(wantSvcs); i++ { svc, wantSvc := svcs[i], wantSvcs[i] if got, want := svc.ServiceDescriptorProto, wantSvc.ServiceDescriptorProto; !proto.Equal(got, want) { t.Errorf("svcs[%d].ServiceDescriptorProto = %v; want %v; input = %v", i, got, want, input) continue } var j int for j = 0; j < len(svc.Methods) && j < len(wantSvc.Methods); j++ { meth, wantMeth := svc.Methods[j], wantSvc.Methods[j] if got, want := meth.MethodDescriptorProto, wantMeth.MethodDescriptorProto; !proto.Equal(got, want) { t.Errorf("svcs[%d].Methods[%d].MethodDescriptorProto = %v; want %v; input = %v", i, j, got, want, input) continue } if got, want := meth.RequestType, wantMeth.RequestType; got.FQMN() != want.FQMN() { t.Errorf("svcs[%d].Methods[%d].RequestType = %s; want %s; input = %v", i, j, got.FQMN(), want.FQMN(), input) } if got, want := meth.ResponseType, wantMeth.ResponseType; got.FQMN() != want.FQMN() { t.Errorf("svcs[%d].Methods[%d].ResponseType = %s; want %s; input = %v", i, j, got.FQMN(), want.FQMN(), input) } var k int for k = 0; k < len(meth.Bindings) && k < len(wantMeth.Bindings); k++ { binding, wantBinding := meth.Bindings[k], wantMeth.Bindings[k] if got, want := binding.Index, wantBinding.Index; got != want { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Index = %d; want %d; input = %v", i, j, k, got, want, input) } if got, want := binding.PathTmpl, wantBinding.PathTmpl; !reflect.DeepEqual(got, want) { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathTmpl = %#v; want %#v; input = %v", i, j, k, got, want, input) } if got, want := binding.HTTPMethod, wantBinding.HTTPMethod; got != want { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].HTTPMethod = %q; want %q; input = %v", i, j, k, got, want, input) } var l int for l = 0; l < len(binding.PathParams) && l < len(wantBinding.PathParams); l++ { param, wantParam := binding.PathParams[l], wantBinding.PathParams[l] if got, want := param.FieldPath.String(), wantParam.FieldPath.String(); got != want { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d].FieldPath.String() = %q; want %q; input = %v", i, j, k, l, got, want, input) continue } for m := 0; m < len(param.FieldPath) && m < len(wantParam.FieldPath); m++ { field, wantField := param.FieldPath[m].Target, wantParam.FieldPath[m].Target if got, want := field.FieldDescriptorProto, wantField.FieldDescriptorProto; !proto.Equal(got, want) { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d].FieldPath[%d].Target.FieldDescriptorProto = %v; want %v; input = %v", i, j, k, l, m, got, want, input) } } } for ; l < len(binding.PathParams); l++ { got := binding.PathParams[l].FieldPath.String() t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d] = %q; want it to be missing; input = %v", i, j, k, l, got, input) } for ; l < len(wantBinding.PathParams); l++ { want := wantBinding.PathParams[l].FieldPath.String() t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d] missing; want %q; input = %v", i, j, k, l, want, input) } if got, want := (binding.Body != nil), (wantBinding.Body != nil); got != want { if got { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body = %q; want it to be missing; input = %v", i, j, k, binding.Body.FieldPath.String(), input) } else { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body missing; want %q; input = %v", i, j, k, wantBinding.Body.FieldPath.String(), input) } } else if binding.Body != nil { if got, want := binding.Body.FieldPath.String(), wantBinding.Body.FieldPath.String(); got != want { t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body = %q; want %q; input = %v", i, j, k, got, want, input) } } } for ; k < len(meth.Bindings); k++ { got := meth.Bindings[k] t.Errorf("svcs[%d].Methods[%d].Bindings[%d] = %v; want it to be missing; input = %v", i, j, k, got, input) } for ; k < len(wantMeth.Bindings); k++ { want := wantMeth.Bindings[k] t.Errorf("svcs[%d].Methods[%d].Bindings[%d] missing; want %v; input = %v", i, j, k, want, input) } } for ; j < len(svc.Methods); j++ { got := svc.Methods[j].MethodDescriptorProto t.Errorf("svcs[%d].Methods[%d] = %v; want it to be missing; input = %v", i, j, got, input) } for ; j < len(wantSvc.Methods); j++ { want := wantSvc.Methods[j].MethodDescriptorProto t.Errorf("svcs[%d].Methods[%d] missing; want %v; input = %v", i, j, want, input) } } for ; i < len(svcs); i++ { got := svcs[i].ServiceDescriptorProto t.Errorf("svcs[%d] = %v; want it to be missing; input = %v", i, got, input) } for ; i < len(wantSvcs); i++ { want := wantSvcs[i].ServiceDescriptorProto t.Errorf("svcs[%d] missing; want %v; input = %v", i, want, input) } } func crossLinkFixture(f *File) *File { for _, m := range f.Messages { m.File = f for _, f := range m.Fields { f.Message = m } } for _, svc := range f.Services { svc.File = f for _, m := range svc.Methods { m.Service = svc for _, b := range m.Bindings { b.Method = m for _, param := range b.PathParams { param.Method = m } } } } for _, e := range f.Enums { e.File = f } return f } func TestExtractServicesSimple(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo" body: "*" > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, Bindings: []*Binding{ { PathTmpl: compilePath(t, "/v1/example/echo"), HTTPMethod: "POST", Body: &Body{FieldPath: nil}, }, }, }, }, }, }, } crossLinkFixture(file) testExtractServices(t, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesWithoutAnnotation(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, }, }, }, }, } crossLinkFixture(file) testExtractServices(t, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesGenerateUnboundMethods(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("prototext.Unmarshal (%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, Bindings: []*Binding{ { PathTmpl: compilePath(t, "/example.ExampleService/Echo"), HTTPMethod: "POST", Body: &Body{FieldPath: nil}, }, }, }, }, }, }, } crossLinkFixture(file) reg := NewRegistry() reg.SetGenerateUnboundMethods(true) testExtractServicesWithRegistry(t, reg, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesCrossPackage(t *testing.T) { srcs := []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "ToString" input_type: ".another.example.BoolMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/to_s" body: "*" > > > > `, ` name: "path/to/another/example.proto", package: "another.example" message_type < name: "BoolMessage" field < name: "bool" number: 1 label: LABEL_OPTIONAL type: TYPE_BOOL > > `, } var fds []*descriptorpb.FileDescriptorProto for _, src := range srcs { var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("prototext.Unmarshal(%s, &fd) failed with %v; want success", src, err) } fds = append(fds, &fd) } stringMsg := &Message{ DescriptorProto: fds[0].MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fds[0].MessageType[0].Field[0], }, }, } boolMsg := &Message{ DescriptorProto: fds[1].MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fds[1].MessageType[0].Field[0], }, }, } files := []*File{ { FileDescriptorProto: fds[0], GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{stringMsg}, Services: []*Service{ { ServiceDescriptorProto: fds[0].Service[0], Methods: []*Method{ { MethodDescriptorProto: fds[0].Service[0].Method[0], RequestType: boolMsg, ResponseType: stringMsg, Bindings: []*Binding{ { PathTmpl: compilePath(t, "/v1/example/to_s"), HTTPMethod: "POST", Body: &Body{FieldPath: nil}, }, }, }, }, }, }, }, { FileDescriptorProto: fds[1], GoPkg: GoPackage{ Path: "path/to/another/example.pb", Name: "example_pb", }, Messages: []*Message{boolMsg}, }, } for _, file := range files { crossLinkFixture(file) } testExtractServices(t, fds, "path/to/example.proto", files[0].Services) } func TestExtractServicesWithBodyPath(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "OuterMessage" nested_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > field < name: "nested" number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: "StringMessage" > > service < name: "ExampleService" method < name: "Echo" input_type: "OuterMessage" output_type: "OuterMessage" options < [google.api.http] < post: "/v1/example/echo" body: "nested" > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, Bindings: []*Binding{ { PathTmpl: compilePath(t, "/v1/example/echo"), HTTPMethod: "POST", Body: &Body{ FieldPath: FieldPath{ { Name: "nested", Target: msg.Fields[0], }, }, }, }, }, }, }, }, }, } crossLinkFixture(file) testExtractServices(t, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesWithPathParam(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < get: "/v1/example/echo/{string=*}" > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, Bindings: []*Binding{ { PathTmpl: compilePath(t, "/v1/example/echo/{string=*}"), HTTPMethod: "GET", PathParams: []Parameter{ { FieldPath: FieldPath{ { Name: "string", Target: msg.Fields[0], }, }, Target: msg.Fields[0], }, }, }, }, }, }, }, }, } crossLinkFixture(file) testExtractServices(t, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesWithAdditionalBinding(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo" body: "*" additional_bindings < get: "/v1/example/echo/{string}" > additional_bindings < post: "/v2/example/echo" body: "string" > > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ { FieldDescriptorProto: fd.MessageType[0].Field[0], }, }, } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{ Path: "path/to/example.pb", Name: "example_pb", }, Messages: []*Message{msg}, Services: []*Service{ { ServiceDescriptorProto: fd.Service[0], Methods: []*Method{ { MethodDescriptorProto: fd.Service[0].Method[0], RequestType: msg, ResponseType: msg, Bindings: []*Binding{ { Index: 0, PathTmpl: compilePath(t, "/v1/example/echo"), HTTPMethod: "POST", Body: &Body{FieldPath: nil}, }, { Index: 1, PathTmpl: compilePath(t, "/v1/example/echo/{string}"), HTTPMethod: "GET", PathParams: []Parameter{ { FieldPath: FieldPath{ { Name: "string", Target: msg.Fields[0], }, }, Target: msg.Fields[0], }, }, Body: nil, }, { Index: 2, PathTmpl: compilePath(t, "/v2/example/echo"), HTTPMethod: "POST", Body: &Body{ FieldPath: FieldPath{ FieldPathComponent{ Name: "string", Target: msg.Fields[0], }, }, }, }, }, }, }, }, }, } crossLinkFixture(file) testExtractServices(t, []*descriptorpb.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } func TestExtractServicesWithError(t *testing.T) { for _, spec := range []struct { target string srcs []string }{ { target: "path/to/example.proto", srcs: []string{ // message not found ` name: "path/to/example.proto", package: "example" service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo" body: "*" > > > > `, }, }, // body field path not resolved { target: "path/to/example.proto", srcs: []string{` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo" body: "bool" > > > >`, }, }, // param field path not resolved { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo/{bool=*}" > > > > `, }, }, // non aggregate type on field path { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "OuterMessage" field < name: "mid" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > field < name: "bool" number: 2 label: LABEL_OPTIONAL type: TYPE_BOOL > > service < name: "ExampleService" method < name: "Echo" input_type: "OuterMessage" output_type: "OuterMessage" options < [google.api.http] < post: "/v1/example/echo/{mid.bool=*}" > > > > `, }, }, // path param in client streaming { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < post: "/v1/example/echo/{bool=*}" > > client_streaming: true > > `, }, }, // body for GET { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < get: "/v1/example/echo" body: "string" > > > > `, }, }, // body for DELETE { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "RemoveResource" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < delete: "/v1/example/resource" body: "string" > > > > `, }, }, // no pattern specified { target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" service < name: "ExampleService" method < name: "RemoveResource" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < body: "string" > > > > `, }, }, // unsupported path parameter type { target: "path/to/example.proto", srcs: []string{` name: "path/to/example.proto", package: "example" message_type < name: "OuterMessage" nested_type < name: "StringMessage" field < name: "value" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: "StringMessage" > > service < name: "ExampleService" method < name: "Echo" input_type: "OuterMessage" output_type: "OuterMessage" options < [google.api.http] < get: "/v1/example/echo/{string=*}" > > > > `, }, }, } { reg := NewRegistry() for _, src := range spec.srcs { var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } reg.loadFile(spec.target, &protogen.File{ Proto: &fd, }) } err := reg.loadServices(reg.files[spec.target]) if err == nil { t.Errorf("loadServices(%q) succeeded; want an error; files=%v", spec.target, spec.srcs) } t.Log(err) } } func TestResolveFieldPath(t *testing.T) { for _, spec := range []struct { src string path string wantErr bool }{ { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'string' type: TYPE_STRING label: LABEL_OPTIONAL number: 1 > > `, path: "string", wantErr: false, }, // no such field { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'string' type: TYPE_STRING label: LABEL_OPTIONAL number: 1 > > `, path: "something_else", wantErr: true, }, // repeated field { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'string' type: TYPE_STRING label: LABEL_REPEATED number: 1 > > `, path: "string", wantErr: false, }, // nested field { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'nested' type: TYPE_MESSAGE type_name: 'AnotherMessage' label: LABEL_OPTIONAL number: 1 > field < name: 'terminal' type: TYPE_BOOL label: LABEL_OPTIONAL number: 2 > > message_type < name: 'AnotherMessage' field < name: 'nested2' type: TYPE_MESSAGE type_name: 'ExampleMessage' label: LABEL_OPTIONAL number: 1 > > `, path: "nested.nested2.nested.nested2.nested.nested2.terminal", wantErr: false, }, // non aggregate field on the path { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'nested' type: TYPE_MESSAGE type_name: 'AnotherMessage' label: LABEL_OPTIONAL number: 1 > field < name: 'terminal' type: TYPE_BOOL label: LABEL_OPTIONAL number: 2 > > message_type < name: 'AnotherMessage' field < name: 'nested2' type: TYPE_MESSAGE type_name: 'ExampleMessage' label: LABEL_OPTIONAL number: 1 > > `, path: "nested.terminal.nested2", wantErr: true, }, // repeated field { src: ` name: 'example.proto' package: 'example' message_type < name: 'ExampleMessage' field < name: 'nested' type: TYPE_MESSAGE type_name: 'AnotherMessage' label: LABEL_OPTIONAL number: 1 > field < name: 'terminal' type: TYPE_BOOL label: LABEL_OPTIONAL number: 2 > > message_type < name: 'AnotherMessage' field < name: 'nested2' type: TYPE_MESSAGE type_name: 'ExampleMessage' label: LABEL_REPEATED number: 1 > > `, path: "nested.nested2.terminal", wantErr: false, }, } { var file descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(spec.src), &file); err != nil { t.Fatalf("proto.Unmarshal(%s) failed with %v; want success", spec.src, err) } reg := NewRegistry() reg.loadFile(file.GetName(), &protogen.File{ Proto: &file, }) f, err := reg.LookupFile(file.GetName()) if err != nil { t.Fatalf("reg.LookupFile(%q) failed with %v; want success; on file=%s", file.GetName(), err, spec.src) } _, err = reg.resolveFieldPath(f.Messages[0], spec.path, false) if got, want := err != nil, spec.wantErr; got != want { if want { t.Errorf("reg.resolveFiledPath(%q, %q) succeeded; want an error", f.Messages[0].GetName(), spec.path) continue } t.Errorf("reg.resolveFiledPath(%q, %q) failed with %v; want success", f.Messages[0].GetName(), spec.path, err) } } } func TestExtractServicesWithDeleteBody(t *testing.T) { for _, spec := range []struct { allowDeleteBody bool expectErr bool target string srcs []string }{ // body for DELETE, but registry configured to allow it { allowDeleteBody: true, expectErr: false, target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "RemoveResource" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < delete: "/v1/example/resource" body: "string" > > > > `, }, }, // body for DELETE, registry configured not to allow it { allowDeleteBody: false, expectErr: true, target: "path/to/example.proto", srcs: []string{ ` name: "path/to/example.proto", package: "example" message_type < name: "StringMessage" field < name: "string" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING > > service < name: "ExampleService" method < name: "RemoveResource" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < delete: "/v1/example/resource" body: "string" > > > > `, }, }, } { reg := NewRegistry() reg.SetAllowDeleteBody(spec.allowDeleteBody) for _, src := range spec.srcs { var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } reg.loadFile(fd.GetName(), &protogen.File{ Proto: &fd, }) } err := reg.loadServices(reg.files[spec.target]) if spec.expectErr && err == nil { t.Errorf("loadServices(%q) succeeded; want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) } if !spec.expectErr && err != nil { t.Errorf("loadServices(%q) failed; do not want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) } t.Log(err) } } func TestCauseErrorWithPathParam(t *testing.T) { src := ` name: "path/to/example.proto", package: "example" message_type < name: "TypeMessage" field < name: "message" type: TYPE_MESSAGE type_name: 'ExampleMessage' number: 1, label: LABEL_OPTIONAL > > service < name: "ExampleService" method < name: "Echo" input_type: "TypeMessage" output_type: "TypeMessage" options < [google.api.http] < get: "/v1/example/echo/{message=*}" > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } target := "path/to/example.proto" reg := NewRegistry() input := []*descriptorpb.FileDescriptorProto{&fd} reg.loadFile(fd.GetName(), &protogen.File{ Proto: &fd, }) // switch this field to see the error wantErr := true err := reg.loadServices(reg.files[target]) if got, want := err != nil, wantErr; got != want { if want { t.Errorf("loadServices(%q, %q) succeeded; want an error", target, input) } t.Errorf("loadServices(%q, %q) failed with %v; want success", target, input, err) } } func TestOptionalProto3URLPathMappingError(t *testing.T) { src := ` name: "path/to/example.proto" package: "example" message_type < name: "StringMessage" field < name: "field1" number: 1 type: TYPE_STRING proto3_optional: true > > service < name: "ExampleService" method < name: "Echo" input_type: "StringMessage" output_type: "StringMessage" options < [google.api.http] < get: "/v1/example/echo/{field1=*}" > > > > ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } target := "path/to/example.proto" reg := NewRegistry() input := []*descriptorpb.FileDescriptorProto{&fd} reg.loadFile(fd.GetName(), &protogen.File{ Proto: &fd, }) wantErrMsg := "field not allowed in field path: field1 in field1" err := reg.loadServices(reg.files[target]) if err != nil { if !strings.Contains(err.Error(), wantErrMsg) { t.Errorf("loadServices(%q, %q) failed with %v; want %s", target, input, err, wantErrMsg) } } else { t.Errorf("loadServices(%q, %q) expcted an error %s, got nil", target, input, wantErrMsg) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/types.go000066400000000000000000000530741465037340600273620ustar00rootroot00000000000000package descriptor import ( "fmt" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) // IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'. func IsWellKnownType(typeName string) bool { _, ok := wellKnownTypeConv[typeName] return ok } // GoPackage represents a golang package. type GoPackage struct { // Path is the package path to the package. Path string // Name is the package name of the package Name string // Alias is an alias of the package unique within the current invocation of gRPC-Gateway generator. Alias string } // Standard returns whether the import is a golang standard package. func (p GoPackage) Standard() bool { return !strings.Contains(p.Path, ".") } // String returns a string representation of this package in the form of import line in golang. func (p GoPackage) String() string { if p.Alias == "" { return fmt.Sprintf("%q", p.Path) } return fmt.Sprintf("%s %q", p.Alias, p.Path) } // ResponseFile wraps pluginpb.CodeGeneratorResponse_File. type ResponseFile struct { *pluginpb.CodeGeneratorResponse_File // GoPkg is the Go package of the generated file. GoPkg GoPackage } // File wraps descriptorpb.FileDescriptorProto for richer features. type File struct { *descriptorpb.FileDescriptorProto // GoPkg is the go package of the go file generated from this file. GoPkg GoPackage // GeneratedFilenamePrefix is used to construct filenames for generated // files associated with this source file. // // For example, the source file "dir/foo.proto" might have a filename prefix // of "dir/foo". Appending ".pb.go" produces an output file of "dir/foo.pb.go". GeneratedFilenamePrefix string // Messages is the list of messages defined in this file. Messages []*Message // Enums is the list of enums defined in this file. Enums []*Enum // Services is the list of services defined in this file. Services []*Service } // Pkg returns package name or alias if it's present func (f *File) Pkg() string { pkg := f.GoPkg.Name if alias := f.GoPkg.Alias; alias != "" { pkg = alias } return pkg } // proto2 determines if the syntax of the file is proto2. func (f *File) proto2() bool { return f.Syntax == nil || f.GetSyntax() == "proto2" } // Message describes a protocol buffer message types. type Message struct { *descriptorpb.DescriptorProto // File is the file where the message is defined. File *File // Outers is a list of outer messages if this message is a nested type. Outers []string // Fields is a list of message fields. Fields []*Field // Index is proto path index of this message in File. Index int // ForcePrefixedName when set to true, prefixes a type with a package prefix. ForcePrefixedName bool } // FQMN returns a fully qualified message name of this message. func (m *Message) FQMN() string { components := []string{""} if m.File.Package != nil { components = append(components, m.File.GetPackage()) } components = append(components, m.Outers...) components = append(components, m.GetName()) return strings.Join(components, ".") } // GoType returns a go type name for the message type. // It prefixes the type name with the package alias if // its belonging package is not "currentPackage". func (m *Message) GoType(currentPackage string) string { var components []string components = append(components, m.Outers...) components = append(components, m.GetName()) name := strings.Join(components, "_") if !m.ForcePrefixedName && m.File.GoPkg.Path == currentPackage { return name } return fmt.Sprintf("%s.%s", m.File.Pkg(), name) } // Enum describes a protocol buffer enum types. type Enum struct { *descriptorpb.EnumDescriptorProto // File is the file where the enum is defined File *File // Outers is a list of outer messages if this enum is a nested type. Outers []string // Index is a enum index value. Index int // ForcePrefixedName when set to true, prefixes a type with a package prefix. ForcePrefixedName bool } // FQEN returns a fully qualified enum name of this enum. func (e *Enum) FQEN() string { components := []string{""} if e.File.Package != nil { components = append(components, e.File.GetPackage()) } components = append(components, e.Outers...) components = append(components, e.GetName()) return strings.Join(components, ".") } // GoType returns a go type name for the enum type. // It prefixes the type name with the package alias if // its belonging package is not "currentPackage". func (e *Enum) GoType(currentPackage string) string { var components []string components = append(components, e.Outers...) components = append(components, e.GetName()) name := strings.Join(components, "_") if !e.ForcePrefixedName && e.File.GoPkg.Path == currentPackage { return name } return fmt.Sprintf("%s.%s", e.File.Pkg(), name) } // Service wraps descriptorpb.ServiceDescriptorProto for richer features. type Service struct { *descriptorpb.ServiceDescriptorProto // File is the file where this service is defined. File *File // Methods is the list of methods defined in this service. Methods []*Method // ForcePrefixedName when set to true, prefixes a type with a package prefix. ForcePrefixedName bool } // FQSN returns the fully qualified service name of this service. func (s *Service) FQSN() string { components := []string{""} if s.File.Package != nil { components = append(components, s.File.GetPackage()) } components = append(components, s.GetName()) return strings.Join(components, ".") } // InstanceName returns object name of the service with package prefix if needed func (s *Service) InstanceName() string { if !s.ForcePrefixedName { return s.GetName() } return fmt.Sprintf("%s.%s", s.File.Pkg(), s.GetName()) } // ClientConstructorName returns name of the Client constructor with package prefix if needed func (s *Service) ClientConstructorName() string { constructor := "New" + s.GetName() + "Client" if !s.ForcePrefixedName { return constructor } return fmt.Sprintf("%s.%s", s.File.Pkg(), constructor) } // Method wraps descriptorpb.MethodDescriptorProto for richer features. type Method struct { *descriptorpb.MethodDescriptorProto // Service is the service which this method belongs to. Service *Service // RequestType is the message type of requests to this method. RequestType *Message // ResponseType is the message type of responses from this method. ResponseType *Message Bindings []*Binding } // FQMN returns a fully qualified rpc method name of this method. func (m *Method) FQMN() string { var components []string components = append(components, m.Service.FQSN()) components = append(components, m.GetName()) return strings.Join(components, ".") } // Binding describes how an HTTP endpoint is bound to a gRPC method. type Binding struct { // Method is the method which the endpoint is bound to. Method *Method // Index is a zero-origin index of the binding in the target method Index int // PathTmpl is path template where this method is mapped to. PathTmpl httprule.Template // HTTPMethod is the HTTP method which this method is mapped to. HTTPMethod string // PathParams is the list of parameters provided in HTTP request paths. PathParams []Parameter // Body describes parameters provided in HTTP request body. Body *Body // ResponseBody describes field in response struct to marshal in HTTP response body. ResponseBody *Body } // ExplicitParams returns a list of explicitly bound parameters of "b", // i.e. a union of field path for body and field paths for path parameters. func (b *Binding) ExplicitParams() []string { var result []string if b.Body != nil { result = append(result, b.Body.FieldPath.String()) } for _, p := range b.PathParams { result = append(result, p.FieldPath.String()) } return result } // Field wraps descriptorpb.FieldDescriptorProto for richer features. type Field struct { *descriptorpb.FieldDescriptorProto // Message is the message type which this field belongs to. Message *Message // FieldMessage is the message type of the field. FieldMessage *Message // ForcePrefixedName when set to true, prefixes a type with a package prefix. ForcePrefixedName bool } // FQFN returns a fully qualified field name of this field. func (f *Field) FQFN() string { return strings.Join([]string{f.Message.FQMN(), f.GetName()}, ".") } // Parameter is a parameter provided in http requests type Parameter struct { // FieldPath is a path to a proto field which this parameter is mapped to. FieldPath // Target is the proto field which this parameter is mapped to. Target *Field // Method is the method which this parameter is used for. Method *Method } // ConvertFuncExpr returns a go expression of a converter function. // The converter function converts a string into a value for the parameter. func (p Parameter) ConvertFuncExpr() (string, error) { tbl := proto3ConvertFuncs if !p.IsProto2() && p.IsRepeated() { tbl = proto3RepeatedConvertFuncs } else if !p.IsProto2() && p.IsOptionalProto3() { tbl = proto3OptionalConvertFuncs } else if p.IsProto2() && !p.IsRepeated() { tbl = proto2ConvertFuncs } else if p.IsProto2() && p.IsRepeated() { tbl = proto2RepeatedConvertFuncs } typ := p.Target.GetType() conv, ok := tbl[typ] if !ok { conv, ok = wellKnownTypeConv[p.Target.GetTypeName()] } if !ok { return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName()) } return conv, nil } // IsEnum returns true if the field is an enum type, otherwise false is returned. func (p Parameter) IsEnum() bool { return p.Target.GetType() == descriptorpb.FieldDescriptorProto_TYPE_ENUM } // IsRepeated returns true if the field is repeated, otherwise false is returned. func (p Parameter) IsRepeated() bool { return p.Target.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REPEATED } // IsProto2 returns true if the field is proto2, otherwise false is returned. func (p Parameter) IsProto2() bool { return p.Target.Message.File.proto2() } // Body describes a http (request|response) body to be sent to the (method|client). // This is used in body and response_body options in google.api.HttpRule type Body struct { // FieldPath is a path to a proto field which the (request|response) body is mapped to. // The (request|response) body is mapped to the (request|response) type itself if FieldPath is empty. FieldPath FieldPath } // AssignableExpr returns an assignable expression in Go to be used to initialize method request object. // It starts with "msgExpr", which is the go expression of the method request object. func (b Body) AssignableExpr(msgExpr string, currentPackage string) string { return b.FieldPath.AssignableExpr(msgExpr, currentPackage) } // AssignableExprPrep returns preparatory statements for an assignable expression to initialize the // method request object. func (b Body) AssignableExprPrep(msgExpr string, currentPackage string) string { return b.FieldPath.AssignableExprPrep(msgExpr, currentPackage) } // FieldPath is a path to a field from a request message. type FieldPath []FieldPathComponent // String returns a string representation of the field path. func (p FieldPath) String() string { components := make([]string, 0, len(p)) for _, c := range p { components = append(components, c.Name) } return strings.Join(components, ".") } // IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path. func (p FieldPath) IsNestedProto3() bool { if len(p) > 1 && !p[0].Target.Message.File.proto2() { return true } return false } // IsOptionalProto3 indicates whether the FieldPath is a proto3 optional field. func (p FieldPath) IsOptionalProto3() bool { if len(p) == 0 { return false } return p[0].Target.GetProto3Optional() } // AssignableExpr is an assignable expression in Go to be used to assign a value to the target field. // It starts with "msgExpr", which is the go expression of the method request object. Before using // such an expression the prep statements must be emitted first, in case the field path includes // a oneof. See FieldPath.AssignableExprPrep. func (p FieldPath) AssignableExpr(msgExpr string, currentPackage string) string { l := len(p) if l == 0 { return msgExpr } components := msgExpr for i, c := range p { // We need to check if the target is not proto3_optional first. // Under the hood, proto3_optional uses oneof to signal to old proto3 clients // that presence is tracked for this field. This oneof is known as a "synthetic" oneof. if !c.Target.GetProto3Optional() && c.Target.OneofIndex != nil { index := c.Target.OneofIndex msg := c.Target.Message oneOfName := casing.Camel(msg.GetOneofDecl()[*index].GetName()) oneofFieldName := msg.GoType(currentPackage) + "_" + c.AssignableExpr() if c.Target.ForcePrefixedName { oneofFieldName = msg.File.Pkg() + "." + msg.GetName() + "_" + c.AssignableExpr() } components = components + "." + oneOfName + ".(*" + oneofFieldName + ")" } if i == l-1 { components = components + "." + c.AssignableExpr() continue } components = components + "." + c.ValueExpr() } return components } // AssignableExprPrep returns preparation statements for an assignable expression to assign a value // to the target field. The Go expression of the method request object is "msgExpr". This is only // needed for field paths that contain oneofs. Otherwise, an empty string is returned. func (p FieldPath) AssignableExprPrep(msgExpr string, currentPackage string) string { l := len(p) if l == 0 { return "" } var preparations []string components := msgExpr for i, c := range p { // We need to check if the target is not proto3_optional first. // Under the hood, proto3_optional uses oneof to signal to old proto3 clients // that presence is tracked for this field. This oneof is known as a "synthetic" oneof. if !c.Target.GetProto3Optional() && c.Target.OneofIndex != nil { index := c.Target.OneofIndex msg := c.Target.Message oneOfName := casing.Camel(msg.GetOneofDecl()[*index].GetName()) oneofFieldName := msg.GoType(currentPackage) + "_" + c.AssignableExpr() if c.Target.ForcePrefixedName { oneofFieldName = msg.File.Pkg() + "." + msg.GetName() + "_" + c.AssignableExpr() } components = components + "." + oneOfName s := `if %s == nil { %s =&%s{} } else if _, ok := %s.(*%s); !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *%s, but: %%t\n",%s) }` preparations = append(preparations, fmt.Sprintf(s, components, components, oneofFieldName, components, oneofFieldName, oneofFieldName, components)) components = components + ".(*" + oneofFieldName + ")" } if i == l-1 { components = components + "." + c.AssignableExpr() continue } components = components + "." + c.ValueExpr() } return strings.Join(preparations, "\n") } // FieldPathComponent is a path component in FieldPath type FieldPathComponent struct { // Name is a name of the proto field which this component corresponds to. // TODO(yugui) is this necessary? Name string // Target is the proto field which this component corresponds to. Target *Field } // AssignableExpr returns an assignable expression in go for this field. func (c FieldPathComponent) AssignableExpr() string { return casing.Camel(c.Name) } // ValueExpr returns an expression in go for this field. func (c FieldPathComponent) ValueExpr() string { if c.Target.Message.File.proto2() { return fmt.Sprintf("Get%s()", casing.Camel(c.Name)) } return casing.Camel(c.Name) } var ( proto3ConvertFuncs = map[descriptorpb.FieldDescriptorProto_Type]string{ descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64", descriptorpb.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32", descriptorpb.FieldDescriptorProto_TYPE_INT64: "runtime.Int64", descriptorpb.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64", descriptorpb.FieldDescriptorProto_TYPE_INT32: "runtime.Int32", descriptorpb.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64", descriptorpb.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32", descriptorpb.FieldDescriptorProto_TYPE_BOOL: "runtime.Bool", descriptorpb.FieldDescriptorProto_TYPE_STRING: "runtime.String", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE descriptorpb.FieldDescriptorProto_TYPE_BYTES: "runtime.Bytes", descriptorpb.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32", descriptorpb.FieldDescriptorProto_TYPE_ENUM: "runtime.Enum", descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32", descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64", descriptorpb.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32", descriptorpb.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64", } proto3OptionalConvertFuncs = func() map[descriptorpb.FieldDescriptorProto_Type]string { result := make(map[descriptorpb.FieldDescriptorProto_Type]string) for typ, converter := range proto3ConvertFuncs { // TODO: this will use convert functions from proto2. // The converters returning pointers should be moved // to a more generic file. result[typ] = converter + "P" } return result }() // TODO: replace it with a IIFE proto3RepeatedConvertFuncs = map[descriptorpb.FieldDescriptorProto_Type]string{ descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64Slice", descriptorpb.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32Slice", descriptorpb.FieldDescriptorProto_TYPE_INT64: "runtime.Int64Slice", descriptorpb.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64Slice", descriptorpb.FieldDescriptorProto_TYPE_INT32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64Slice", descriptorpb.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32Slice", descriptorpb.FieldDescriptorProto_TYPE_BOOL: "runtime.BoolSlice", descriptorpb.FieldDescriptorProto_TYPE_STRING: "runtime.StringSlice", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE descriptorpb.FieldDescriptorProto_TYPE_BYTES: "runtime.BytesSlice", descriptorpb.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32Slice", descriptorpb.FieldDescriptorProto_TYPE_ENUM: "runtime.EnumSlice", descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64Slice", descriptorpb.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64Slice", } proto2ConvertFuncs = map[descriptorpb.FieldDescriptorProto_Type]string{ descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64P", descriptorpb.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32P", descriptorpb.FieldDescriptorProto_TYPE_INT64: "runtime.Int64P", descriptorpb.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64P", descriptorpb.FieldDescriptorProto_TYPE_INT32: "runtime.Int32P", descriptorpb.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64P", descriptorpb.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32P", descriptorpb.FieldDescriptorProto_TYPE_BOOL: "runtime.BoolP", descriptorpb.FieldDescriptorProto_TYPE_STRING: "runtime.StringP", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE // FieldDescriptorProto_TYPE_BYTES // TODO(yugui) Handle bytes descriptorpb.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32P", descriptorpb.FieldDescriptorProto_TYPE_ENUM: "runtime.EnumP", descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32P", descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64P", descriptorpb.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32P", descriptorpb.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64P", } proto2RepeatedConvertFuncs = map[descriptorpb.FieldDescriptorProto_Type]string{ descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64Slice", descriptorpb.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32Slice", descriptorpb.FieldDescriptorProto_TYPE_INT64: "runtime.Int64Slice", descriptorpb.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64Slice", descriptorpb.FieldDescriptorProto_TYPE_INT32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64Slice", descriptorpb.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32Slice", descriptorpb.FieldDescriptorProto_TYPE_BOOL: "runtime.BoolSlice", descriptorpb.FieldDescriptorProto_TYPE_STRING: "runtime.StringSlice", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE // FieldDescriptorProto_TYPE_BYTES // TODO(maros7) Handle bytes descriptorpb.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32Slice", descriptorpb.FieldDescriptorProto_TYPE_ENUM: "runtime.EnumSlice", descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64Slice", descriptorpb.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32Slice", descriptorpb.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64Slice", } wellKnownTypeConv = map[string]string{ ".google.protobuf.Timestamp": "runtime.Timestamp", ".google.protobuf.Duration": "runtime.Duration", ".google.protobuf.StringValue": "runtime.StringValue", ".google.protobuf.FloatValue": "runtime.FloatValue", ".google.protobuf.DoubleValue": "runtime.DoubleValue", ".google.protobuf.BoolValue": "runtime.BoolValue", ".google.protobuf.BytesValue": "runtime.BytesValue", ".google.protobuf.Int32Value": "runtime.Int32Value", ".google.protobuf.UInt32Value": "runtime.UInt32Value", ".google.protobuf.Int64Value": "runtime.Int64Value", ".google.protobuf.UInt64Value": "runtime.UInt64Value", } ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/descriptor/types_test.go000066400000000000000000000155101465037340600304120ustar00rootroot00000000000000package descriptor import ( "testing" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/types/descriptorpb" ) func TestGoPackageStandard(t *testing.T) { for _, spec := range []struct { pkg GoPackage want bool }{ { pkg: GoPackage{Path: "fmt", Name: "fmt"}, want: true, }, { pkg: GoPackage{Path: "encoding/json", Name: "json"}, want: true, }, { pkg: GoPackage{Path: "google.golang.org/protobuf/encoding/protojson", Name: "jsonpb"}, want: false, }, { pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, want: false, }, { pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, want: false, }, { pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, want: false, }, } { if got, want := spec.pkg.Standard(), spec.want; got != want { t.Errorf("%#v.Standard() = %v; want %v", spec.pkg, got, want) } } } func TestGoPackageString(t *testing.T) { for _, spec := range []struct { pkg GoPackage want string }{ { pkg: GoPackage{Path: "fmt", Name: "fmt"}, want: `"fmt"`, }, { pkg: GoPackage{Path: "encoding/json", Name: "json"}, want: `"encoding/json"`, }, { pkg: GoPackage{Path: "google.golang.org/protobuf/encoding/protojson", Name: "jsonpb"}, want: `"google.golang.org/protobuf/encoding/protojson"`, }, { pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, want: `"golang.org/x/net/context"`, }, { pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, want: `"github.com/grpc-ecosystem/grpc-gateway"`, }, { pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, want: `htpb "github.com/google/googleapis/google/api/http.pb"`, }, } { if got, want := spec.pkg.String(), spec.want; got != want { t.Errorf("%#v.String() = %q; want %q", spec.pkg, got, want) } } } func TestFieldPath(t *testing.T) { var fds []*descriptorpb.FileDescriptorProto for _, src := range []string{ ` name: 'example.proto' package: 'example' message_type < name: 'Nest' field < name: 'nest2_field' label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: 'Nest2' number: 1 > field < name: 'terminal_field' label: LABEL_OPTIONAL type: TYPE_STRING number: 2 > > syntax: "proto3" `, ` name: 'another.proto' package: 'example' message_type < name: 'Nest2' field < name: 'nest_field' label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: 'Nest' number: 1 > field < name: 'terminal_field' label: LABEL_OPTIONAL type: TYPE_STRING number: 2 > > syntax: "proto2" `, } { var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } fds = append(fds, &fd) } nest1 := &Message{ DescriptorProto: fds[0].MessageType[0], Fields: []*Field{ {FieldDescriptorProto: fds[0].MessageType[0].Field[0]}, {FieldDescriptorProto: fds[0].MessageType[0].Field[1]}, }, } nest2 := &Message{ DescriptorProto: fds[1].MessageType[0], Fields: []*Field{ {FieldDescriptorProto: fds[1].MessageType[0].Field[0]}, {FieldDescriptorProto: fds[1].MessageType[0].Field[1]}, }, } file1 := &File{ FileDescriptorProto: fds[0], GoPkg: GoPackage{Path: "example", Name: "example"}, Messages: []*Message{nest1}, } file2 := &File{ FileDescriptorProto: fds[1], GoPkg: GoPackage{Path: "example", Name: "example"}, Messages: []*Message{nest2}, } crossLinkFixture(file1) crossLinkFixture(file2) c1 := FieldPathComponent{ Name: "nest_field", Target: nest2.Fields[0], } if got, want := c1.ValueExpr(), "GetNestField()"; got != want { t.Errorf("c1.ValueExpr() = %q; want %q", got, want) } if got, want := c1.AssignableExpr(), "NestField"; got != want { t.Errorf("c1.AssignableExpr() = %q; want %q", got, want) } c2 := FieldPathComponent{ Name: "nest2_field", Target: nest1.Fields[0], } if got, want := c2.ValueExpr(), "Nest2Field"; got != want { t.Errorf("c2.ValueExpr() = %q; want %q", got, want) } if got, want := c2.ValueExpr(), "Nest2Field"; got != want { t.Errorf("c2.ValueExpr() = %q; want %q", got, want) } fp := FieldPath{ c1, c2, c1, FieldPathComponent{ Name: "terminal_field", Target: nest1.Fields[1], }, } if got, want := fp.AssignableExpr("resp", "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { t.Errorf("fp.AssignableExpr(%q) = %q; want %q", "resp", got, want) } fp2 := FieldPath{ c2, c1, c2, FieldPathComponent{ Name: "terminal_field", Target: nest2.Fields[1], }, } if got, want := fp2.AssignableExpr("resp", "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { t.Errorf("fp2.AssignableExpr(%q) = %q; want %q", "resp", got, want) } var fpEmpty FieldPath if got, want := fpEmpty.AssignableExpr("resp", "example"), "resp"; got != want { t.Errorf("fpEmpty.AssignableExpr(%q) = %q; want %q", "resp", got, want) } } func TestGoType(t *testing.T) { src := ` name: 'example.proto' package: 'example' message_type < name: 'Message' field < name: 'field' type: TYPE_STRING number: 1 > >, enum_type < name: 'EnumName' >, ` var fd descriptorpb.FileDescriptorProto if err := prototext.Unmarshal([]byte(src), &fd); err != nil { t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) } msg := &Message{ DescriptorProto: fd.MessageType[0], Fields: []*Field{ {FieldDescriptorProto: fd.MessageType[0].Field[0]}, }, } enum := &Enum{ EnumDescriptorProto: fd.EnumType[0], } file := &File{ FileDescriptorProto: &fd, GoPkg: GoPackage{Path: "example", Name: "example"}, Messages: []*Message{msg}, Enums: []*Enum{enum}, } crossLinkFixture(file) if got, want := msg.GoType("example"), "Message"; got != want { t.Errorf("msg.GoType() = %q; want %q", got, want) } if got, want := msg.GoType("extPackage"), "example.Message"; got != want { t.Errorf("msg.GoType() = %q; want %q", got, want) } msg.ForcePrefixedName = true if got, want := msg.GoType("example"), "example.Message"; got != want { t.Errorf("msg.GoType() = %q; want %q", got, want) } if got, want := enum.GoType("example"), "EnumName"; got != want { t.Errorf("enum.GoType() = %q; want %q", got, want) } if got, want := enum.GoType("extPackage"), "example.EnumName"; got != want { t.Errorf("enum.GoType() = %q; want %q", got, want) } enum.ForcePrefixedName = true if got, want := enum.GoType("example"), "example.EnumName"; got != want { t.Errorf("enum.GoType() = %q; want %q", got, want) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/generator/000077500000000000000000000000001465037340600254665ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/generator/BUILD.bazel000066400000000000000000000006261465037340600273500ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") package(default_visibility = ["//visibility:public"]) go_library( name = "generator", srcs = ["generator.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator", deps = ["//internal/descriptor"], ) alias( name = "go_default_library", actual = ":generator", visibility = ["//:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/generator/generator.go000066400000000000000000000005771465037340600300140ustar00rootroot00000000000000// Package generator provides an abstract interface to code generators. package generator import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" ) // Generator is an abstraction of code generators. type Generator interface { // Generate generates output files from input .proto files. Generate(targets []*descriptor.File) ([]*descriptor.ResponseFile, error) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/000077500000000000000000000000001465037340600253475ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/BUILD.bazel000066400000000000000000000013301465037340600272220ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) go_library( name = "httprule", srcs = [ "compile.go", "parse.go", "types.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule", deps = ["//utilities"], ) go_test( name = "httprule_test", size = "small", srcs = [ "compile_test.go", "parse_test.go", "types_test.go", ], embed = [":httprule"], deps = [ "//utilities", "@org_golang_google_grpc//grpclog", ], ) alias( name = "go_default_library", actual = ":httprule", visibility = ["//:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/compile.go000066400000000000000000000045021465037340600273270ustar00rootroot00000000000000package httprule import ( "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) const ( opcodeVersion = 1 ) // Template is a compiled representation of path templates. type Template struct { // Version is the version number of the format. Version int // OpCodes is a sequence of operations. OpCodes []int // Pool is a constant pool Pool []string // Verb is a VERB part in the template. Verb string // Fields is a list of field paths bound in this template. Fields []string // Original template (example: /v1/a_bit_of_everything) Template string } // Compiler compiles utilities representation of path templates into marshallable operations. // They can be unmarshalled by runtime.NewPattern. type Compiler interface { Compile() Template } type op struct { // code is the opcode of the operation code utilities.OpCode // str is a string operand of the code. // num is ignored if str is not empty. str string // num is a numeric operand of the code. num int } func (w wildcard) compile() []op { return []op{ {code: utilities.OpPush}, } } func (w deepWildcard) compile() []op { return []op{ {code: utilities.OpPushM}, } } func (l literal) compile() []op { return []op{ { code: utilities.OpLitPush, str: string(l), }, } } func (v variable) compile() []op { var ops []op for _, s := range v.segments { ops = append(ops, s.compile()...) } ops = append(ops, op{ code: utilities.OpConcatN, num: len(v.segments), }, op{ code: utilities.OpCapture, str: v.path, }) return ops } func (t template) Compile() Template { var rawOps []op for _, s := range t.segments { rawOps = append(rawOps, s.compile()...) } var ( ops []int pool []string fields []string ) consts := make(map[string]int) for _, op := range rawOps { ops = append(ops, int(op.code)) if op.str == "" { ops = append(ops, op.num) } else { // eof segment literal represents the "/" path pattern if op.str == eof { op.str = "" } if _, ok := consts[op.str]; !ok { consts[op.str] = len(pool) pool = append(pool, op.str) } ops = append(ops, consts[op.str]) } if op.code == utilities.OpCapture { fields = append(fields, op.str) } } return Template{ Version: opcodeVersion, OpCodes: ops, Pool: pool, Verb: t.verb, Fields: fields, Template: t.template, } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/compile_test.go000066400000000000000000000056121465037340600303710ustar00rootroot00000000000000package httprule import ( "reflect" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) const ( operandFiller = 0 ) func TestCompile(t *testing.T) { for _, spec := range []struct { segs []segment verb string ops []int pool []string fields []string }{ {}, { segs: []segment{ literal(eof), }, ops: []int{int(utilities.OpLitPush), 0}, pool: []string{""}, }, { segs: []segment{ wildcard{}, }, ops: []int{int(utilities.OpPush), operandFiller}, }, { segs: []segment{ deepWildcard{}, }, ops: []int{int(utilities.OpPushM), operandFiller}, }, { segs: []segment{ literal("v1"), }, ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"v1"}, }, { segs: []segment{ literal("v1"), }, verb: "LOCK", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"v1"}, }, { segs: []segment{ variable{ path: "name.nested", segments: []segment{ wildcard{}, }, }, }, ops: []int{ int(utilities.OpPush), operandFiller, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 0, }, pool: []string{"name.nested"}, fields: []string{"name.nested"}, }, { segs: []segment{ literal("obj"), variable{ path: "name.nested", segments: []segment{ literal("a"), wildcard{}, literal("b"), }, }, variable{ path: "obj", segments: []segment{ deepWildcard{}, }, }, }, ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), operandFiller, int(utilities.OpLitPush), 2, int(utilities.OpConcatN), 3, int(utilities.OpCapture), 3, int(utilities.OpPushM), operandFiller, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 0, }, pool: []string{"obj", "a", "b", "name.nested"}, fields: []string{"name.nested", "obj"}, }, } { tmpl := template{ segments: spec.segs, verb: spec.verb, } compiled := tmpl.Compile() if got, want := compiled.Version, opcodeVersion; got != want { t.Errorf("tmpl.Compile().Version = %d; want %d; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) } if got, want := compiled.OpCodes, spec.ops; !reflect.DeepEqual(got, want) { t.Errorf("tmpl.Compile().OpCodes = %v; want %v; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) } if got, want := compiled.Pool, spec.pool; !reflect.DeepEqual(got, want) { t.Errorf("tmpl.Compile().Pool = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) } if got, want := compiled.Verb, spec.verb; got != want { t.Errorf("tmpl.Compile().Verb = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) } if got, want := compiled.Fields, spec.fields; !reflect.DeepEqual(got, want) { t.Errorf("tmpl.Compile().Fields = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/fuzz.go000066400000000000000000000002351465037340600266740ustar00rootroot00000000000000//go:build gofuzz // +build gofuzz package httprule func Fuzz(data []byte) int { if _, err := Parse(string(data)); err != nil { return 0 } return 0 } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/parse.go000066400000000000000000000202351465037340600270120ustar00rootroot00000000000000package httprule import ( "errors" "fmt" "strings" ) // InvalidTemplateError indicates that the path template is not valid. type InvalidTemplateError struct { tmpl string msg string } func (e InvalidTemplateError) Error() string { return fmt.Sprintf("%s: %s", e.msg, e.tmpl) } // Parse parses the string representation of path template func Parse(tmpl string) (Compiler, error) { if !strings.HasPrefix(tmpl, "/") { return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"} } tokens, verb := tokenize(tmpl[1:]) p := parser{tokens: tokens} segs, err := p.topLevelSegments() if err != nil { return template{}, InvalidTemplateError{tmpl: tmpl, msg: err.Error()} } return template{ segments: segs, verb: verb, template: tmpl, }, nil } func tokenize(path string) (tokens []string, verb string) { if path == "" { return []string{eof}, "" } const ( init = iota field nested ) st := init for path != "" { var idx int switch st { case init: idx = strings.IndexAny(path, "/{") case field: idx = strings.IndexAny(path, ".=}") case nested: idx = strings.IndexAny(path, "/}") } if idx < 0 { tokens = append(tokens, path) break } switch r := path[idx]; r { case '/', '.': case '{': st = field case '=': st = nested case '}': st = init } if idx == 0 { tokens = append(tokens, path[idx:idx+1]) } else { tokens = append(tokens, path[:idx], path[idx:idx+1]) } path = path[idx+1:] } l := len(tokens) // See // https://github.com/grpc-ecosystem/grpc-gateway/pull/1947#issuecomment-774523693 ; // although normal and backwards-compat logic here is to use the last index // of a colon, if the final segment is a variable followed by a colon, the // part following the colon must be a verb. Hence if the previous token is // an end var marker, we switch the index we're looking for to Index instead // of LastIndex, so that we correctly grab the remaining part of the path as // the verb. var penultimateTokenIsEndVar bool switch l { case 0, 1: // Not enough to be variable so skip this logic and don't result in an // invalid index default: penultimateTokenIsEndVar = tokens[l-2] == "}" } t := tokens[l-1] var idx int if penultimateTokenIsEndVar { idx = strings.Index(t, ":") } else { idx = strings.LastIndex(t, ":") } if idx == 0 { tokens, verb = tokens[:l-1], t[1:] } else if idx > 0 { tokens[l-1], verb = t[:idx], t[idx+1:] } tokens = append(tokens, eof) return tokens, verb } // parser is a parser of the template syntax defined in github.com/googleapis/googleapis/google/api/http.proto. type parser struct { tokens []string accepted []string } // topLevelSegments is the target of this parser. func (p *parser) topLevelSegments() ([]segment, error) { if _, err := p.accept(typeEOF); err == nil { p.tokens = p.tokens[:0] return []segment{literal(eof)}, nil } segs, err := p.segments() if err != nil { return nil, err } if _, err := p.accept(typeEOF); err != nil { return nil, fmt.Errorf("unexpected token %q after segments %q", p.tokens[0], strings.Join(p.accepted, "")) } return segs, nil } func (p *parser) segments() ([]segment, error) { s, err := p.segment() if err != nil { return nil, err } segs := []segment{s} for { if _, err := p.accept("/"); err != nil { return segs, nil } s, err := p.segment() if err != nil { return segs, err } segs = append(segs, s) } } func (p *parser) segment() (segment, error) { if _, err := p.accept("*"); err == nil { return wildcard{}, nil } if _, err := p.accept("**"); err == nil { return deepWildcard{}, nil } if l, err := p.literal(); err == nil { return l, nil } v, err := p.variable() if err != nil { return nil, fmt.Errorf("segment neither wildcards, literal or variable: %w", err) } return v, nil } func (p *parser) literal() (segment, error) { lit, err := p.accept(typeLiteral) if err != nil { return nil, err } return literal(lit), nil } func (p *parser) variable() (segment, error) { if _, err := p.accept("{"); err != nil { return nil, err } path, err := p.fieldPath() if err != nil { return nil, err } var segs []segment if _, err := p.accept("="); err == nil { segs, err = p.segments() if err != nil { return nil, fmt.Errorf("invalid segment in variable %q: %w", path, err) } } else { segs = []segment{wildcard{}} } if _, err := p.accept("}"); err != nil { return nil, fmt.Errorf("unterminated variable segment: %s", path) } return variable{ path: path, segments: segs, }, nil } func (p *parser) fieldPath() (string, error) { c, err := p.accept(typeIdent) if err != nil { return "", err } components := []string{c} for { if _, err := p.accept("."); err != nil { return strings.Join(components, "."), nil } c, err := p.accept(typeIdent) if err != nil { return "", fmt.Errorf("invalid field path component: %w", err) } components = append(components, c) } } // A termType is a type of terminal symbols. type termType string // These constants define some of valid values of termType. // They improve readability of parse functions. // // You can also use "/", "*", "**", "." or "=" as valid values. const ( typeIdent = termType("ident") typeLiteral = termType("literal") typeEOF = termType("$") ) // eof is the terminal symbol which always appears at the end of token sequence. const eof = "\u0000" // accept tries to accept a token in "p". // This function consumes a token and returns it if it matches to the specified "term". // If it doesn't match, the function does not consume any tokens and return an error. func (p *parser) accept(term termType) (string, error) { t := p.tokens[0] switch term { case "/", "*", "**", ".", "=", "{", "}": if t != string(term) && t != "/" { return "", fmt.Errorf("expected %q but got %q", term, t) } case typeEOF: if t != eof { return "", fmt.Errorf("expected EOF but got %q", t) } case typeIdent: if err := expectIdent(t); err != nil { return "", err } case typeLiteral: if err := expectPChars(t); err != nil { return "", err } default: return "", fmt.Errorf("unknown termType %q", term) } p.tokens = p.tokens[1:] p.accepted = append(p.accepted, t) return t, nil } // expectPChars determines if "t" consists of only pchars defined in RFC3986. // // https://www.ietf.org/rfc/rfc3986.txt, P.49 // // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" // / "*" / "+" / "," / ";" / "=" // pct-encoded = "%" HEXDIG HEXDIG func expectPChars(t string) error { const ( init = iota pct1 pct2 ) st := init for _, r := range t { if st != init { if !isHexDigit(r) { return fmt.Errorf("invalid hexdigit: %c(%U)", r, r) } switch st { case pct1: st = pct2 case pct2: st = init } continue } // unreserved switch { case 'A' <= r && r <= 'Z': continue case 'a' <= r && r <= 'z': continue case '0' <= r && r <= '9': continue } switch r { case '-', '.', '_', '~': // unreserved case '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims case ':', '@': // rest of pchar case '%': // pct-encoded st = pct1 default: return fmt.Errorf("invalid character in path segment: %q(%U)", r, r) } } if st != init { return fmt.Errorf("invalid percent-encoding in %q", t) } return nil } // expectIdent determines if "ident" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*). func expectIdent(ident string) error { if ident == "" { return errors.New("empty identifier") } for pos, r := range ident { switch { case '0' <= r && r <= '9': if pos == 0 { return fmt.Errorf("identifier starting with digit: %s", ident) } continue case 'A' <= r && r <= 'Z': continue case 'a' <= r && r <= 'z': continue case r == '_': continue default: return fmt.Errorf("invalid character %q(%U) in identifier: %s", r, r, ident) } } return nil } func isHexDigit(r rune) bool { switch { case '0' <= r && r <= '9': return true case 'A' <= r && r <= 'F': return true case 'a' <= r && r <= 'f': return true } return false } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/parse_test.go000066400000000000000000000212621465037340600300520ustar00rootroot00000000000000package httprule import ( "errors" "fmt" "reflect" "testing" "google.golang.org/grpc/grpclog" ) func TestTokenize(t *testing.T) { for _, spec := range []struct { src string tokens []string verb string }{ { src: "", tokens: []string{eof}, }, { src: "v1", tokens: []string{"v1", eof}, }, { src: "v1/b", tokens: []string{"v1", "/", "b", eof}, }, { src: "v1/endpoint/*", tokens: []string{"v1", "/", "endpoint", "/", "*", eof}, }, { src: "v1/endpoint/**", tokens: []string{"v1", "/", "endpoint", "/", "**", eof}, }, { src: "v1/b/{bucket_name=*}", tokens: []string{ "v1", "/", "b", "/", "{", "bucket_name", "=", "*", "}", eof, }, }, { src: "v1/b/{bucket_name=buckets/*}", tokens: []string{ "v1", "/", "b", "/", "{", "bucket_name", "=", "buckets", "/", "*", "}", eof, }, }, { src: "v1/b/{bucket_name=buckets/*}/o", tokens: []string{ "v1", "/", "b", "/", "{", "bucket_name", "=", "buckets", "/", "*", "}", "/", "o", eof, }, }, { src: "v1/b/{bucket_name=buckets/*}/o/{name}", tokens: []string{ "v1", "/", "b", "/", "{", "bucket_name", "=", "buckets", "/", "*", "}", "/", "o", "/", "{", "name", "}", eof, }, }, { src: "v1/a=b&c=d;e=f:g/endpoint.rdf", tokens: []string{ "v1", "/", "a=b&c=d;e=f:g", "/", "endpoint.rdf", eof, }, }, { src: "v1/a/{endpoint}:a", tokens: []string{ "v1", "/", "a", "/", "{", "endpoint", "}", eof, }, verb: "a", }, { src: "v1/a/{endpoint}:b:c", tokens: []string{ "v1", "/", "a", "/", "{", "endpoint", "}", eof, }, verb: "b:c", }, } { tokens, verb := tokenize(spec.src) if got, want := tokens, spec.tokens; !reflect.DeepEqual(got, want) { t.Errorf("tokenize(%q) = %q, _; want %q, _", spec.src, got, want) } switch { case spec.verb != "": if got, want := verb, spec.verb; !reflect.DeepEqual(got, want) { t.Errorf("tokenize(%q) = %q, _; want %q, _", spec.src, got, want) } default: if got, want := verb, ""; got != want { t.Errorf("tokenize(%q) = _, %q; want _, %q", spec.src, got, want) } src := fmt.Sprintf("%s:%s", spec.src, "LOCK") tokens, verb = tokenize(src) if got, want := tokens, spec.tokens; !reflect.DeepEqual(got, want) { t.Errorf("tokenize(%q) = %q, _; want %q, _", src, got, want) } if got, want := verb, "LOCK"; got != want { t.Errorf("tokenize(%q) = _, %q; want _, %q", src, got, want) } } } } func TestParseSegments(t *testing.T) { for _, spec := range []struct { tokens []string want []segment }{ { tokens: []string{eof}, want: []segment{ literal(eof), }, }, { // Note: this case will never arise as tokenize() will never return such a sequence of tokens // and even if it does it will be treated as [eof] tokens: []string{eof, "v1", eof}, want: []segment{ literal(eof), }, }, { tokens: []string{"v1", eof}, want: []segment{ literal("v1"), }, }, { tokens: []string{"/", eof}, want: []segment{ wildcard{}, }, }, { tokens: []string{"-._~!$&'()*+,;=:@", eof}, want: []segment{ literal("-._~!$&'()*+,;=:@"), }, }, { tokens: []string{"%e7%ac%ac%e4%b8%80%e7%89%88", eof}, want: []segment{ literal("%e7%ac%ac%e4%b8%80%e7%89%88"), }, }, { tokens: []string{"v1", "/", "*", eof}, want: []segment{ literal("v1"), wildcard{}, }, }, { tokens: []string{"v1", "/", "**", eof}, want: []segment{ literal("v1"), deepWildcard{}, }, }, { tokens: []string{"{", "name", "}", eof}, want: []segment{ variable{ path: "name", segments: []segment{ wildcard{}, }, }, }, }, { tokens: []string{"{", "name", "=", "*", "}", eof}, want: []segment{ variable{ path: "name", segments: []segment{ wildcard{}, }, }, }, }, { tokens: []string{"{", "field", ".", "nested", ".", "nested2", "=", "*", "}", eof}, want: []segment{ variable{ path: "field.nested.nested2", segments: []segment{ wildcard{}, }, }, }, }, { tokens: []string{"{", "name", "=", "a", "/", "b", "/", "*", "}", eof}, want: []segment{ variable{ path: "name", segments: []segment{ literal("a"), literal("b"), wildcard{}, }, }, }, }, { tokens: []string{ "v1", "/", "{", "name", ".", "nested", ".", "nested2", "=", "a", "/", "b", "/", "*", "}", "/", "o", "/", "{", "another_name", "=", "a", "/", "b", "/", "*", "/", "c", "}", "/", "**", eof, }, want: []segment{ literal("v1"), variable{ path: "name.nested.nested2", segments: []segment{ literal("a"), literal("b"), wildcard{}, }, }, literal("o"), variable{ path: "another_name", segments: []segment{ literal("a"), literal("b"), wildcard{}, literal("c"), }, }, deepWildcard{}, }, }, } { p := parser{tokens: spec.tokens} segs, err := p.topLevelSegments() if err != nil { t.Errorf("parser{%q}.segments() failed with %v; want success", spec.tokens, err) continue } if got, want := segs, spec.want; !reflect.DeepEqual(got, want) { t.Errorf("parser{%q}.segments() = %#v; want %#v", spec.tokens, got, want) } if got := p.tokens; len(got) > 0 { t.Errorf("p.tokens = %q; want []; spec.tokens=%q", got, spec.tokens) } } } func TestParse(t *testing.T) { for _, spec := range []struct { input string wantFields []string wantOpCodes []int wantPool []string wantVerb string }{ { input: "/v1/{name}:bla:baa", wantFields: []string{ "name", }, wantPool: []string{"v1", "name"}, wantVerb: "bla:baa", }, { input: "/v1/{name}:", wantFields: []string{ "name", }, wantPool: []string{"v1", "name"}, wantVerb: "", }, { input: "/v1/{name=segment/wi:th}", wantFields: []string{ "name", }, wantPool: []string{"v1", "segment", "wi:th", "name"}, wantVerb: "", }, } { f, err := Parse(spec.input) if err != nil { t.Errorf("Parse(%q) failed with %v; want success", spec.input, err) continue } tmpl := f.Compile() if !reflect.DeepEqual(tmpl.Fields, spec.wantFields) { t.Errorf("Parse(%q).Fields = %#v; want %#v", spec.input, tmpl.Fields, spec.wantFields) } if !reflect.DeepEqual(tmpl.Pool, spec.wantPool) { t.Errorf("Parse(%q).Pool = %#v; want %#v", spec.input, tmpl.Pool, spec.wantPool) } if tmpl.Template != spec.input { t.Errorf("Parse(%q).Template = %q; want %q", spec.input, tmpl.Template, spec.input) } if tmpl.Verb != spec.wantVerb { t.Errorf("Parse(%q).Verb = %q; want %q", spec.input, tmpl.Verb, spec.wantVerb) } } } func TestParseError(t *testing.T) { for _, spec := range []struct { input string wantError error }{ { input: "v1/{name}", wantError: InvalidTemplateError{ tmpl: "v1/{name}", msg: "no leading /", }, }, } { _, err := Parse(spec.input) if err == nil { t.Errorf("Parse(%q) unexpectedly did not fail", spec.input) continue } if !errors.Is(err, spec.wantError) { t.Errorf("Error did not match expected error: got %v wanted %v", err, spec.wantError) } } } func TestParseSegmentsWithErrors(t *testing.T) { for _, spec := range []struct { tokens []string }{ { // double slash tokens: []string{"//", eof}, }, { // invalid literal tokens: []string{"a?b", eof}, }, { // invalid percent-encoding tokens: []string{"%", eof}, }, { // invalid percent-encoding tokens: []string{"%2", eof}, }, { // invalid percent-encoding tokens: []string{"a%2z", eof}, }, { // unterminated variable tokens: []string{"{", "name", eof}, }, { // unterminated variable tokens: []string{"{", "name", "=", eof}, }, { // unterminated variable tokens: []string{"{", "name", "=", "*", eof}, }, { // empty component in field path tokens: []string{"{", "name", ".", "}", eof}, }, { // empty component in field path tokens: []string{"{", "name", ".", ".", "nested", "}", eof}, }, { // invalid character in identifier tokens: []string{"{", "field-name", "}", eof}, }, { // no slash between segments tokens: []string{"v1", "endpoint", eof}, }, { // no slash between segments tokens: []string{"v1", "{", "name", "}", eof}, }, } { p := parser{tokens: spec.tokens} segs, err := p.topLevelSegments() if err == nil { t.Errorf("parser{%q}.segments() succeeded; want InvalidTemplateError; accepted %#v", spec.tokens, segs) continue } if grpclog.V(1) { grpclog.Info(err) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/types.go000066400000000000000000000016261465037340600270470ustar00rootroot00000000000000package httprule import ( "fmt" "strings" ) type template struct { segments []segment verb string template string } type segment interface { fmt.Stringer compile() (ops []op) } type wildcard struct{} type deepWildcard struct{} type literal string type variable struct { path string segments []segment } func (wildcard) String() string { return "*" } func (deepWildcard) String() string { return "**" } func (l literal) String() string { return string(l) } func (v variable) String() string { var segs []string for _, s := range v.segments { segs = append(segs, s.String()) } return fmt.Sprintf("{%s=%s}", v.path, strings.Join(segs, "/")) } func (t template) String() string { var segs []string for _, s := range t.segments { segs = append(segs, s.String()) } str := strings.Join(segs, "/") if t.verb != "" { str = fmt.Sprintf("%s:%s", str, t.verb) } return "/" + str } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/internal/httprule/types_test.go000066400000000000000000000027121465037340600301030ustar00rootroot00000000000000package httprule import ( "fmt" "testing" ) func TestTemplateStringer(t *testing.T) { for _, spec := range []struct { segs []segment want string }{ { segs: []segment{ literal("v1"), }, want: "/v1", }, { segs: []segment{ wildcard{}, }, want: "/*", }, { segs: []segment{ deepWildcard{}, }, want: "/**", }, { segs: []segment{ variable{ path: "name", segments: []segment{ literal("a"), }, }, }, want: "/{name=a}", }, { segs: []segment{ variable{ path: "name", segments: []segment{ literal("a"), wildcard{}, literal("b"), }, }, }, want: "/{name=a/*/b}", }, { segs: []segment{ literal("v1"), variable{ path: "name", segments: []segment{ literal("a"), wildcard{}, literal("b"), }, }, literal("c"), variable{ path: "field.nested", segments: []segment{ wildcard{}, literal("d"), }, }, wildcard{}, literal("e"), deepWildcard{}, }, want: "/v1/{name=a/*/b}/c/{field.nested=*/d}/*/e/**", }, } { tmpl := template{segments: spec.segs} if got, want := tmpl.String(), spec.want; got != want { t.Errorf("%#v.String() = %q; want %q", tmpl, got, want) } tmpl.verb = "LOCK" if got, want := tmpl.String(), fmt.Sprintf("%s:LOCK", spec.want); got != want { t.Errorf("%#v.String() = %q; want %q", tmpl, got, want) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/000077500000000000000000000000001465037340600263315ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/BUILD.bazel000066400000000000000000000021631465037340600302110ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") package(default_visibility = ["//visibility:private"]) go_library( name = "protoc-gen-grpc-gateway_lib", srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway", deps = [ "//internal/codegenerator", "//internal/descriptor", "//protoc-gen-grpc-gateway/internal/gengateway", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//compiler/protogen", ], ) go_binary( name = "protoc-gen-grpc-gateway", embed = [":protoc-gen-grpc-gateway_lib"], visibility = ["//visibility:public"], ) go_proto_compiler( name = "go_gen_grpc_gateway", plugin = ":protoc-gen-grpc-gateway", suffix = ".pb.gw.go", visibility = ["//visibility:public"], deps = [ "//runtime:go_default_library", "//utilities:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", ], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/000077500000000000000000000000001465037340600301455ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengateway/000077500000000000000000000000001465037340600323005ustar00rootroot00000000000000BUILD.bazel000066400000000000000000000021721465037340600341010ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengatewayload("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//protoc-gen-grpc-gateway:__subpackages__"]) go_library( name = "gengateway", srcs = [ "doc.go", "generator.go", "template.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway", deps = [ "//internal/casing", "//internal/descriptor", "//internal/generator", "//utilities", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/pluginpb", ], ) go_test( name = "gengateway_test", size = "small", srcs = [ "generator_test.go", "template_test.go", ], embed = [":gengateway"], deps = [ "//internal/descriptor", "//internal/httprule", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/descriptorpb", ], ) alias( name = "go_default_library", actual = ":gengateway", visibility = ["//protoc-gen-grpc-gateway:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengateway/doc.go000066400000000000000000000001331465037340600333710ustar00rootroot00000000000000// Package gengateway provides a code generator for grpc gateway files. package gengateway generator.go000066400000000000000000000103371465037340600345420ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengatewaypackage gengateway import ( "errors" "fmt" "go/format" "path" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" ) var errNoTargetService = errors.New("no target service defined in the file") type generator struct { reg *descriptor.Registry baseImports []descriptor.GoPackage useRequestContext bool registerFuncSuffix string allowPatchFeature bool standalone bool } // New returns a new generator which generates grpc gateway files. func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix string, allowPatchFeature, standalone bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ "context", "io", "net/http", "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", "google.golang.org/protobuf/proto", "google.golang.org/grpc", "google.golang.org/grpc/codes", "google.golang.org/grpc/grpclog", "google.golang.org/grpc/metadata", "google.golang.org/grpc/status", } { pkg := descriptor.GoPackage{ Path: pkgpath, Name: path.Base(pkgpath), } if err := reg.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { for i := 0; ; i++ { alias := fmt.Sprintf("%s_%d", pkg.Name, i) if err := reg.ReserveGoPackageAlias(alias, pkg.Path); err != nil { continue } pkg.Alias = alias break } } imports = append(imports, pkg) } return &generator{ reg: reg, baseImports: imports, useRequestContext: useRequestContext, registerFuncSuffix: registerFuncSuffix, allowPatchFeature: allowPatchFeature, standalone: standalone, } } func (g *generator) Generate(targets []*descriptor.File) ([]*descriptor.ResponseFile, error) { var files []*descriptor.ResponseFile for _, file := range targets { if grpclog.V(1) { grpclog.Infof("Processing %s", file.GetName()) } code, err := g.generate(file) if errors.Is(err, errNoTargetService) { if grpclog.V(1) { grpclog.Infof("%s: %v", file.GetName(), err) } continue } if err != nil { return nil, err } formatted, err := format.Source([]byte(code)) if err != nil { grpclog.Errorf("%v: %s", err, code) return nil, err } files = append(files, &descriptor.ResponseFile{ GoPkg: file.GoPkg, CodeGeneratorResponse_File: &pluginpb.CodeGeneratorResponse_File{ Name: proto.String(file.GeneratedFilenamePrefix + ".pb.gw.go"), Content: proto.String(string(formatted)), }, }) } return files, nil } func (g *generator) generate(file *descriptor.File) (string, error) { pkgSeen := make(map[string]bool) var imports []descriptor.GoPackage for _, pkg := range g.baseImports { pkgSeen[pkg.Path] = true imports = append(imports, pkg) } if g.standalone { imports = append(imports, file.GoPkg) } for _, svc := range file.Services { for _, m := range svc.Methods { imports = append(imports, g.addEnumPathParamImports(file, m, pkgSeen)...) pkg := m.RequestType.File.GoPkg if len(m.Bindings) == 0 || pkg == file.GoPkg || pkgSeen[pkg.Path] { continue } pkgSeen[pkg.Path] = true imports = append(imports, pkg) } } params := param{ File: file, Imports: imports, UseRequestContext: g.useRequestContext, RegisterFuncSuffix: g.registerFuncSuffix, AllowPatchFeature: g.allowPatchFeature, } if g.reg != nil { params.OmitPackageDoc = g.reg.GetOmitPackageDoc() } return applyTemplate(params, g.reg) } // addEnumPathParamImports handles adding import of enum path parameter go packages func (g *generator) addEnumPathParamImports(file *descriptor.File, m *descriptor.Method, pkgSeen map[string]bool) []descriptor.GoPackage { var imports []descriptor.GoPackage for _, b := range m.Bindings { for _, p := range b.PathParams { e, err := g.reg.LookupEnum("", p.Target.GetTypeName()) if err != nil { continue } pkg := e.File.GoPkg if pkg == file.GoPkg || pkgSeen[pkg.Path] { continue } pkgSeen[pkg.Path] = true imports = append(imports, pkg) } } return imports } generator_test.go000066400000000000000000000054331465037340600356020ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengatewaypackage gengateway import ( "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) func newExampleFileDescriptorWithGoPkg(gp *descriptor.GoPackage, filenamePrefix string) *descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } msg := &descriptor.Message{ DescriptorProto: msgdesc, } msg1 := &descriptor.Message{ DescriptorProto: msgdesc, File: &descriptor.File{ GoPkg: descriptor.GoPackage{ Path: "github.com/golang/protobuf/ptypes/empty", Name: "emptypb", }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("ExampleWithoutBindings"), InputType: proto.String("empty.Empty"), OutputType: proto.String("empty.Empty"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth, meth1}, } return &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: *gp, GeneratedFilenamePrefix: filenamePrefix, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, }, }, }, { MethodDescriptorProto: meth1, RequestType: msg1, ResponseType: msg1, }, }, }, }, } } func TestGenerator_Generate(t *testing.T) { g := new(generator) g.reg = descriptor.NewRegistry() result, err := g.Generate([]*descriptor.File{ crossLinkFixture(newExampleFileDescriptorWithGoPkg(&descriptor.GoPackage{ Path: "example.com/path/to/example", Name: "example_pb", }, "path/to/example")), }) if err != nil { t.Fatalf("failed to generate stubs: %v", err) } if len(result) != 1 { t.Fatalf("expected to generate one file, got: %d", len(result)) } expectedName := "path/to/example.pb.gw.go" gotName := result[0].GetName() if gotName != expectedName { t.Fatalf("invalid name %q, expected %q", gotName, expectedName) } } template.go000066400000000000000000000726161465037340600343770ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengatewaypackage gengateway import ( "bytes" "errors" "fmt" "strings" "text/template" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc/grpclog" ) type param struct { *descriptor.File Imports []descriptor.GoPackage UseRequestContext bool RegisterFuncSuffix string AllowPatchFeature bool OmitPackageDoc bool } type binding struct { *descriptor.Binding Registry *descriptor.Registry AllowPatchFeature bool } // GetBodyFieldPath returns the binding body's field path. func (b binding) GetBodyFieldPath() string { if b.Body != nil && len(b.Body.FieldPath) != 0 { return b.Body.FieldPath.String() } return "*" } // GetBodyFieldStructName returns the binding body's struct field name. func (b binding) GetBodyFieldStructName() (string, error) { if b.Body != nil && len(b.Body.FieldPath) != 0 { return casing.Camel(b.Body.FieldPath.String()), nil } return "", errors.New("no body field found") } // HasQueryParam determines if the binding needs parameters in query string. // // It sometimes returns true even though actually the binding does not need. // But it is not serious because it just results in a small amount of extra codes generated. func (b binding) HasQueryParam() bool { if b.Body != nil && len(b.Body.FieldPath) == 0 { return false } fields := make(map[string]bool) for _, f := range b.Method.RequestType.Fields { fields[f.GetName()] = true } if b.Body != nil { delete(fields, b.Body.FieldPath.String()) } for _, p := range b.PathParams { delete(fields, p.FieldPath.String()) } return len(fields) > 0 } func (b binding) QueryParamFilter() queryParamFilter { var seqs [][]string if b.Body != nil { seqs = append(seqs, strings.Split(b.Body.FieldPath.String(), ".")) } for _, p := range b.PathParams { seqs = append(seqs, strings.Split(p.FieldPath.String(), ".")) } return queryParamFilter{utilities.NewDoubleArray(seqs)} } // HasEnumPathParam returns true if the path parameter slice contains a parameter // that maps to an enum proto field that is not repeated, if not false is returned. func (b binding) HasEnumPathParam() bool { return b.hasEnumPathParam(false) } // HasRepeatedEnumPathParam returns true if the path parameter slice contains a parameter // that maps to a repeated enum proto field, if not false is returned. func (b binding) HasRepeatedEnumPathParam() bool { return b.hasEnumPathParam(true) } // hasEnumPathParam returns true if the path parameter slice contains a parameter // that maps to a enum proto field and that the enum proto field is or isn't repeated // based on the provided 'repeated' parameter. func (b binding) hasEnumPathParam(repeated bool) bool { for _, p := range b.PathParams { if p.IsEnum() && p.IsRepeated() == repeated { return true } } return false } // LookupEnum looks up a enum type by path parameter. func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum { e, err := b.Registry.LookupEnum("", p.Target.GetTypeName()) if err != nil { return nil } return e } // FieldMaskField returns the golang-style name of the variable for a FieldMask, if there is exactly one of that type in // the message. Otherwise, it returns an empty string. func (b binding) FieldMaskField() string { var fieldMaskField *descriptor.Field for _, f := range b.Method.RequestType.Fields { if f.GetTypeName() == ".google.protobuf.FieldMask" { // if there is more than 1 FieldMask for this request, then return none if fieldMaskField != nil { return "" } fieldMaskField = f } } if fieldMaskField != nil { return casing.Camel(fieldMaskField.GetName()) } return "" } // queryParamFilter is a wrapper of utilities.DoubleArray which provides String() to output DoubleArray.Encoding in a stable and predictable format. type queryParamFilter struct { *utilities.DoubleArray } func (f queryParamFilter) String() string { encodings := make([]string, len(f.Encoding)) for str, enc := range f.Encoding { encodings[enc] = fmt.Sprintf("%q: %d", str, enc) } e := strings.Join(encodings, ", ") return fmt.Sprintf("&utilities.DoubleArray{Encoding: map[string]int{%s}, Base: %#v, Check: %#v}", e, f.Base, f.Check) } type trailerParams struct { Services []*descriptor.Service UseRequestContext bool RegisterFuncSuffix string } func applyTemplate(p param, reg *descriptor.Registry) (string, error) { w := bytes.NewBuffer(nil) if err := headerTemplate.Execute(w, p); err != nil { return "", err } var targetServices []*descriptor.Service for _, msg := range p.Messages { msgName := casing.Camel(*msg.Name) msg.Name = &msgName } for _, svc := range p.Services { var methodWithBindingsSeen bool svcName := casing.Camel(*svc.Name) svc.Name = &svcName for _, meth := range svc.Methods { if grpclog.V(2) { grpclog.Infof("Processing %s.%s", svc.GetName(), meth.GetName()) } methName := casing.Camel(*meth.Name) meth.Name = &methName for _, b := range meth.Bindings { if err := reg.CheckDuplicateAnnotation(b.HTTPMethod, b.PathTmpl.Template, svc); err != nil { return "", err } methodWithBindingsSeen = true if err := handlerTemplate.Execute(w, binding{ Binding: b, Registry: reg, AllowPatchFeature: p.AllowPatchFeature, }); err != nil { return "", err } // Local if err := localHandlerTemplate.Execute(w, binding{ Binding: b, Registry: reg, AllowPatchFeature: p.AllowPatchFeature, }); err != nil { return "", err } } } if methodWithBindingsSeen { targetServices = append(targetServices, svc) } } if len(targetServices) == 0 { return "", errNoTargetService } tp := trailerParams{ Services: targetServices, UseRequestContext: p.UseRequestContext, RegisterFuncSuffix: p.RegisterFuncSuffix, } // Local if err := localTrailerTemplate.Execute(w, tp); err != nil { return "", err } if err := trailerTemplate.Execute(w, tp); err != nil { return "", err } return w.String(), nil } var ( headerTemplate = template.Must(template.New("header").Parse(` // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: {{.GetName}} {{if not .OmitPackageDoc}}/* Package {{.GoPkg.Name}} is a reverse proxy. It translates gRPC into RESTful JSON APIs. */{{end}} package {{.GoPkg.Name}} import ( {{range $i := .Imports}}{{if $i.Standard}}{{$i | printf "%s\n"}}{{end}}{{end}} {{range $i := .Imports}}{{if not $i.Standard}}{{$i | printf "%s\n"}}{{end}}{{end}} ) // Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join `)) handlerTemplate = template.Must(template.New("handler").Parse(` {{if and .Method.GetClientStreaming .Method.GetServerStreaming}} {{template "bidi-streaming-request-func" .}} {{else if .Method.GetClientStreaming}} {{template "client-streaming-request-func" .}} {{else}} {{template "client-rpc-request-func" .}} {{end}} `)) _ = template.Must(handlerTemplate.New("request-func-signature").Parse(strings.ReplaceAll(` {{if .Method.GetServerStreaming}} func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.InstanceName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.InstanceName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) {{else}} func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.InstanceName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {{end}}`, "\n", ""))) _ = template.Must(handlerTemplate.New("client-streaming-request-func").Parse(` {{template "request-func-signature" .}} { var metadata runtime.ServerMetadata stream, err := client.{{.Method.GetName}}(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) for { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) if err == io.EOF { break } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { if err == io.EOF { break } grpclog.Errorf("Failed to send request: %v", err) return nil, metadata, err } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) return nil, metadata, err } header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header {{if .Method.GetServerStreaming}} return stream, metadata, nil {{else}} msg, err := stream.CloseAndRecv() metadata.TrailerMD = stream.Trailer() return msg, metadata, err {{end}} } `)) funcMap template.FuncMap = map[string]interface{}{ "camelIdentifier": casing.CamelIdentifier, } _ = template.Must(handlerTemplate.New("client-rpc-request-func").Funcs(funcMap).Parse(` {{$AllowPatchFeature := .AllowPatchFeature}} {{if .HasQueryParam}} var ( filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}} = {{.QueryParamFilter}} ) {{end}} {{template "request-func-signature" .}} { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} var metadata runtime.ServerMetadata {{if .Body}} {{- $isFieldMask := and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} {{- if $isFieldMask }} newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } {{- end}} {{- $protoReq := .Body.AssignableExprPrep "protoReq" .Method.Service.File.GoPkg.Path -}} {{- if ne "" $protoReq }} {{printf "%s" $protoReq }} {{- end}} {{- if not $isFieldMask }} if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.AssignableExpr "protoReq" .Method.Service.File.GoPkg.Path}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{- if $isFieldMask }} if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq" .Method.Service.File.GoPkg.Path}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.{{.GetBodyFieldStructName}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask } } {{end}} {{end}} {{if .PathParams}} var ( val string {{- if .HasEnumPathParam}} e int32 {{- end}} {{- if .HasRepeatedEnumPathParam}} es []int32 {{- end}} ok bool err error _ = err ) {{$binding := .}} {{range $param := .PathParams}} {{$enum := $binding.LookupEnum $param}} val, ok = pathParams[{{$param | printf "%q"}}] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) } {{if $param.IsNestedProto3}} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{end}} {{else if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{else}} {{- $protoReq := $param.AssignableExprPrep "protoReq" $binding.Method.Service.File.GoPkg.Path -}} {{- if ne "" $protoReq }} {{printf "%s" $protoReq }} {{- end}} {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{end}} {{if and $enum $param.IsRepeated}} s := make([]{{$enum.GoType $param.Method.Service.File.GoPkg.Path}}, len(es)) for i, v := range es { s[i] = {{$enum.GoType $param.Method.Service.File.GoPkg.Path}}(v) } {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}} = s {{else if $enum}} {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}} = {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}(e) {{end}} {{end}} {{end}} {{if .HasQueryParam}} if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{if .Method.GetServerStreaming}} stream, err := client.{{.Method.GetName}}(ctx, &protoReq) if err != nil { return nil, metadata, err } header, err := stream.Header() if err != nil { return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil {{else}} msg, err := client.{{.Method.GetName}}(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err {{end}} }`)) _ = template.Must(handlerTemplate.New("bidi-streaming-request-func").Parse(` {{template "request-func-signature" .}} { var metadata runtime.ServerMetadata stream, err := client.{{.Method.GetName}}(ctx) if err != nil { grpclog.Errorf("Failed to start streaming: %v", err) return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err := dec.Decode(&protoReq) if err == io.EOF { return err } if err != nil { grpclog.Errorf("Failed to decode request: %v", err) return err } if err := stream.Send(&protoReq); err != nil { grpclog.Errorf("Failed to send request: %v", err) return err } return nil } go func() { for { if err := handleSend(); err != nil { break } } if err := stream.CloseSend(); err != nil { grpclog.Errorf("Failed to terminate client stream: %v", err) } }() header, err := stream.Header() if err != nil { grpclog.Errorf("Failed to get header from client: %v", err) return nil, metadata, err } metadata.HeaderMD = header return stream, metadata, nil } `)) localHandlerTemplate = template.Must(template.New("local-handler").Parse(` {{if and .Method.GetClientStreaming .Method.GetServerStreaming}} {{else if .Method.GetClientStreaming}} {{else if .Method.GetServerStreaming}} {{else}} {{template "local-client-rpc-request-func" .}} {{end}} `)) _ = template.Must(localHandlerTemplate.New("local-request-func-signature").Parse(strings.ReplaceAll(` {{if .Method.GetServerStreaming}} {{else}} func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, server {{.Method.Service.InstanceName}}Server, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {{end}}`, "\n", ""))) _ = template.Must(localHandlerTemplate.New("local-client-rpc-request-func").Funcs(funcMap).Parse(` {{$AllowPatchFeature := .AllowPatchFeature}} {{template "local-request-func-signature" .}} { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} var metadata runtime.ServerMetadata {{if .Body}} {{- $isFieldMask := and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} {{- if $isFieldMask }} newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } {{- end}} {{- $protoReq := .Body.AssignableExprPrep "protoReq" .Method.Service.File.GoPkg.Path -}} {{- if ne "" $protoReq }} {{printf "%s" $protoReq }} {{- end}} {{- if not $isFieldMask }} if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.AssignableExpr "protoReq" .Method.Service.File.GoPkg.Path}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{- if $isFieldMask }} if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq" .Method.Service.File.GoPkg.Path}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.{{.GetBodyFieldStructName}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask } } {{end}} {{end}} {{if .PathParams}} var ( val string {{- if .HasEnumPathParam}} e int32 {{- end}} {{- if .HasRepeatedEnumPathParam}} es []int32 {{- end}} ok bool err error _ = err ) {{$binding := .}} {{range $param := .PathParams}} {{$enum := $binding.LookupEnum $param}} val, ok = pathParams[{{$param | printf "%q"}}] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) } {{if $param.IsNestedProto3}} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "could not parse path as enum value, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{end}} {{else if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{else}} {{- $protoReq := $param.AssignableExprPrep "protoReq" $binding.Method.Service.File.GoPkg.Path -}} {{- if ne "" $protoReq }} {{printf "%s" $protoReq }} {{- end}} {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{end}} {{if and $enum $param.IsRepeated}} s := make([]{{$enum.GoType $param.Method.Service.File.GoPkg.Path}}, len(es)) for i, v := range es { s[i] = {{$enum.GoType $param.Method.Service.File.GoPkg.Path}}(v) } {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}} = s {{else if $enum}} {{$param.AssignableExpr "protoReq" $binding.Method.Service.File.GoPkg.Path}} = {{$enum.GoType $param.Method.Service.File.GoPkg.Path | camelIdentifier}}(e) {{end}} {{end}} {{end}} {{if .HasQueryParam}} if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{if .Method.GetServerStreaming}} // TODO {{else}} msg, err := server.{{.Method.GetName}}(ctx, &protoReq) return msg, metadata, err {{end}} }`)) localTrailerTemplate = template.Must(template.New("local-trailer").Parse(` {{$UseRequestContext := .UseRequestContext}} {{range $svc := .Services}} // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux". // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint instead. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.InstanceName}}Server) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return }) {{else}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { {{- if $UseRequestContext }} ctx, cancel := context.WithCancel(req.Context()) {{- else -}} ctx, cancel := context.WithCancel(ctx) {{- end }} defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context {{- if $b.PathTmpl }} annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/{{$svc.File.GetPackage}}.{{$svc.GetName}}/{{$m.GetName}}", runtime.WithHTTPPathPattern("{{$b.PathTmpl.Template}}")) {{- else -}} annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/{{$svc.File.GetPackage}}.{{$svc.GetName}}/{{$m.GetName}}") {{- end }} if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } {{ if $b.ResponseBody }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) {{ else }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} }) {{end}} {{end}} {{end}} return nil } {{end}}`)) trailerTemplate = template.Must(template.New("trailer").Parse(` {{$UseRequestContext := .UseRequestContext}} {{range $svc := .Services}} // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint is same as Register{{$svc.GetName}}{{$.RegisterFuncSuffix}} but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() return Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}(ctx, mux, conn) } // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}} registers the http handlers for service {{$svc.GetName}} to "mux". // The handlers forward requests to the grpc endpoint over "conn". func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx, mux, {{$svc.ClientConstructorName}}(conn)) } // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client registers the http handlers for service {{$svc.GetName}} // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "{{$svc.InstanceName}}Client". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "{{$svc.InstanceName}}Client" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "{{$svc.InstanceName}}Client" to call the correct interceptors. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx context.Context, mux *runtime.ServeMux, client {{$svc.InstanceName}}Client) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { {{- if $UseRequestContext }} ctx, cancel := context.WithCancel(req.Context()) {{- else -}} ctx, cancel := context.WithCancel(ctx) {{- end }} defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context {{- if $b.PathTmpl }} annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/{{$svc.File.GetPackage}}.{{$svc.GetName}}/{{$m.GetName}}", runtime.WithHTTPPathPattern("{{$b.PathTmpl.Template}}")) {{- else -}} annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/{{$svc.File.GetPackage}}.{{$svc.GetName}}/{{$m.GetName}}") {{- end }} if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } {{if $m.GetServerStreaming}} {{ if $b.ResponseBody }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { res, err := resp.Recv() return response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{res}, err }, mux.GetForwardResponseOptions()...) {{ else }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) {{end}} {{else}} {{ if $b.ResponseBody }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) {{ else }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} {{end}} }) {{end}} {{end}} return nil } {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if $b.ResponseBody}} type response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} struct { proto.Message } func (m response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}) XXX_ResponseBody() interface{} { response := m.Message.(*{{$m.ResponseType.GoType $m.Service.File.GoPkg.Path}}) return {{$b.ResponseBody.AssignableExpr "response" $m.Service.File.GoPkg.Path}} } {{end}} {{end}} {{end}} var ( {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = runtime.MustPattern(runtime.NewPattern({{$b.PathTmpl.Version}}, {{$b.PathTmpl.OpCodes | printf "%#v"}}, {{$b.PathTmpl.Pool | printf "%#v"}}, {{$b.PathTmpl.Verb | printf "%q"}})) {{end}} {{end}} ) var ( {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = {{if $m.GetServerStreaming}}runtime.ForwardResponseStream{{else}}runtime.ForwardResponseMessage{{end}} {{end}} {{end}} ) {{end}}`)) ) template_test.go000066400000000000000000000745521465037340600354370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/internal/gengatewaypackage gengateway import ( "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { for _, m := range f.Messages { m.File = f } for _, svc := range f.Services { svc.File = f for _, m := range svc.Methods { m.Service = svc for _, b := range m.Bindings { b.Method = m for _, param := range b.PathParams { param.Method = m } } } } return f } func compilePath(t *testing.T, path string) httprule.Template { parsed, err := httprule.Parse(path) if err != nil { t.Fatalf("httprule.Parse(%q) failed with %v; want success", path, err) } return parsed.Compile() } func TestApplyTemplateHeader(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, }, }, }, }, }, }, } got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want := "package example_pb\n"; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(false), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } for _, spec := range []struct { serverStreaming bool sigWant string }{ { serverStreaming: false, sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, }, { serverStreaming: true, sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, }, } { meth.ServerStreaming = proto.Bool(spec.serverStreaming) msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } boolField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[1], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "bool", Target: boolField, }, }), }, }, }, }, }, }, }, } got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `marshaler.NewDecoder(req.Body).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `val, ok = pathParams["nested.int32"]`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `protoReq.GetNested().Int32, err = runtime.Int32P(val)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/example.ExampleService/Echo", runtime.WithHTTPPathPattern("/v1"))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } } func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(true), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } for _, spec := range []struct { serverStreaming bool sigWant string }{ { serverStreaming: false, sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, }, { serverStreaming: true, sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, }, } { meth.ServerStreaming = proto.Bool(spec.serverStreaming) msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } boolField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[1], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "bool", Target: boolField, }, }), }, }, }, }, }, }, }, } got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } } func TestApplyTemplateInProcess(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(true), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } for _, spec := range []struct { clientStreaming bool serverStreaming bool sigWant []string }{ { clientStreaming: false, serverStreaming: false, sigWant: []string{ `func local_request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server ExampleServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, `resp, md, err := local_request_ExampleService_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams)`, }, }, { clientStreaming: true, serverStreaming: true, sigWant: []string{ `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, }, }, { clientStreaming: true, serverStreaming: false, sigWant: []string{ `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, }, }, { clientStreaming: false, serverStreaming: true, sigWant: []string{ `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, }, }, } { meth.ClientStreaming = proto.Bool(spec.clientStreaming) meth.ServerStreaming = proto.Bool(spec.serverStreaming) msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } boolField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[1], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "bool", Target: boolField, }, }), }, }, }, }, }, }, }, } got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } for _, want := range spec.sigWant { if !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } } func TestAllowPatchFeature(t *testing.T) { updateMaskDesc := &descriptorpb.FieldDescriptorProto{ Name: proto.String("UpdateMask"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".google.protobuf.FieldMask"), Number: proto.Int32(1), } msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{updateMaskDesc}, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } updateMaskField := &descriptor.Field{ Message: msg, FieldDescriptorProto: updateMaskDesc, } msg.Fields = append(msg.Fields, updateMaskField) file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "PATCH", Body: &descriptor.Body{FieldPath: descriptor.FieldPath{descriptor.FieldPathComponent{ Name: "abe", Target: msg.Fields[0], }}}, }, }, }, }, }, }, } want := "if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {\n" for _, allowPatchFeature := range []bool{true, false} { got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if allowPatchFeature { if want := `marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } else { if strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to _not_ contain %s", file, got, want) } } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } } func TestIdentifierCapitalization(t *testing.T) { msgdesc1 := &descriptorpb.DescriptorProto{ Name: proto.String("Exam_pleRequest"), } msgdesc2 := &descriptorpb.DescriptorProto{ Name: proto.String("example_response"), } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("ExampleGe2t"), InputType: proto.String("Exam_pleRequest"), OutputType: proto.String("example_response"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Exampl_ePost"), InputType: proto.String("Exam_pleRequest"), OutputType: proto.String("example_response"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Example"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } msg1 := &descriptor.Message{ DescriptorProto: msgdesc1, } msg2 := &descriptor.Message{ DescriptorProto: msgdesc2, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, MessageType: []*descriptorpb.DescriptorProto{msgdesc1, msgdesc2}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg1, msg2}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: msg1, ResponseType: msg1, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, }, }, }, }, }, { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth2, RequestType: msg2, ResponseType: msg2, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", Body: &descriptor.Body{FieldPath: nil}, }, }, }, }, }, }, } got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `msg, err := client.ExamplEPost(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `var protoReq ExamPleRequest`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `var protoReq ExampleResponse`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `grpclog.Errorf("Failed`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } func TestDuplicatePathsInSameService(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), TypeName: proto.String(".google.protobuf.StringValue"), Number: proto.Int32(1), }, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo2"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } binding := &descriptor.Binding{ Index: 1, PathTmpl: compilePath(t, "/v1/example/echo"), HTTPMethod: "GET", PathParams: nil, Body: nil, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{binding}, }, { MethodDescriptorProto: meth2, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{binding}, }, }, }, }, } _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err == nil { t.Errorf("applyTemplate(%#v) succeeded; want an error", file) return } } func TestDuplicatePathsInDifferentService(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), TypeName: proto.String(".google.protobuf.StringValue"), Number: proto.Int32(1), }, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo2"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleServiceNumberOne"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } svc2 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleServiceNumberTwo"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } binding := &descriptor.Binding{ Index: 1, PathTmpl: compilePath(t, "/v1/example/echo"), HTTPMethod: "GET", PathParams: nil, Body: nil, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1, svc2}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{binding}, }, }, }, { ServiceDescriptorProto: svc2, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth2, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{binding}, }, }, }, }, } _, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed; want success", file) return } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-grpc-gateway/main.go000066400000000000000000000120771465037340600276130ustar00rootroot00000000000000// Command protoc-gen-grpc-gateway is a plugin for Google protocol buffer // compiler to generate a reverse-proxy, which converts incoming RESTful // HTTP/1 requests gRPC invocation. // You rarely need to run this program directly. Instead, put this program // into your $PATH with a name "protoc-gen-grpc-gateway" and run // // protoc --grpc-gateway_out=output_directory path/to/input.proto // // See README.md for more details. package main import ( "flag" "fmt" "os" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/compiler/protogen" ) var ( registerFuncSuffix = flag.String("register_func_suffix", "Handler", "used to construct names of generated Register* methods.") useRequestContext = flag.Bool("request_context", true, "determine whether to use http.Request's context or not") allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") grpcAPIConfiguration = flag.String("grpc_api_configuration", "", "path to gRPC API Configuration in YAML format") _ = flag.Bool("allow_repeated_fields_in_body", true, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option. DEPRECATED: the value is ignored and always behaves as `true`.") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") allowPatchFeature = flag.Bool("allow_patch_feature", true, "determines whether to use PATCH feature involving update masks (using google.protobuf.FieldMask).") omitPackageDoc = flag.Bool("omit_package_doc", false, "if true, no package comment will be included in the generated code") standalone = flag.Bool("standalone", false, "generates a standalone gateway package, which imports the target service package") versionFlag = flag.Bool("version", false, "print the current version") warnOnUnboundMethods = flag.Bool("warn_on_unbound_methods", false, "emit a warning message if an RPC method has no HttpRule annotation") generateUnboundMethods = flag.Bool("generate_unbound_methods", false, "generate proxy methods even for RPC methods that have no HttpRule annotation") _ = flag.Bool("logtostderr", false, "Legacy glog compatibility. This flag is a no-op, you can safely remove it") ) // Variables set by goreleaser at build time var ( version = "dev" commit = "unknown" date = "unknown" ) func main() { flag.Parse() if *versionFlag { fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) os.Exit(0) } protogen.Options{ ParamFunc: flag.CommandLine.Set, }.Run(func(gen *protogen.Plugin) error { reg := descriptor.NewRegistry() if err := applyFlags(reg); err != nil { return err } codegenerator.SetSupportedFeaturesOnPluginGen(gen) generator := gengateway.New(reg, *useRequestContext, *registerFuncSuffix, *allowPatchFeature, *standalone) if grpclog.V(1) { grpclog.Infof("Parsing code generator request") } if err := reg.LoadFromPlugin(gen); err != nil { return err } unboundHTTPRules := reg.UnboundExternalHTTPRules() if len(unboundHTTPRules) != 0 { return fmt.Errorf("HTTP rules without a matching selector: %s", strings.Join(unboundHTTPRules, ", ")) } targets := make([]*descriptor.File, 0, len(gen.Request.FileToGenerate)) for _, target := range gen.Request.FileToGenerate { f, err := reg.LookupFile(target) if err != nil { return err } targets = append(targets, f) } files, err := generator.Generate(targets) for _, f := range files { if grpclog.V(1) { grpclog.Infof("NewGeneratedFile %q in %s", f.GetName(), f.GoPkg) } genFile := gen.NewGeneratedFile(f.GetName(), protogen.GoImportPath(f.GoPkg.Path)) if _, err := genFile.Write([]byte(f.GetContent())); err != nil { return err } } if grpclog.V(1) { grpclog.Info("Processed code generator request") } return err }) } func applyFlags(reg *descriptor.Registry) error { if *grpcAPIConfiguration != "" { if err := reg.LoadGrpcAPIServiceFromYAML(*grpcAPIConfiguration); err != nil { return err } } if *warnOnUnboundMethods && *generateUnboundMethods { grpclog.Warningf("Option warn_on_unbound_methods has no effect when generate_unbound_methods is used.") } reg.SetStandalone(*standalone) reg.SetAllowDeleteBody(*allowDeleteBody) flag.Visit(func(f *flag.Flag) { if f.Name == "allow_repeated_fields_in_body" { grpclog.Warning("The `allow_repeated_fields_in_body` flag is deprecated and will always behave as `true`.") } }) reg.SetOmitPackageDoc(*omitPackageDoc) reg.SetWarnOnUnboundMethods(*warnOnUnboundMethods) reg.SetGenerateUnboundMethods(*generateUnboundMethods) return reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/000077500000000000000000000000001465037340600256425ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/BUILD.bazel000066400000000000000000000015631465037340600275250ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") package(default_visibility = ["//visibility:private"]) go_library( name = "protoc-gen-openapiv2_lib", srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2", deps = [ "//internal/codegenerator", "//internal/descriptor", "//protoc-gen-openapiv2/internal/genopenapi", "//utilities", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//types/pluginpb", ], ) go_binary( name = "protoc-gen-openapiv2", embed = [":protoc-gen-openapiv2_lib"], visibility = ["//visibility:public"], ) go_test( name = "protoc-gen-openapiv2_test", size = "small", srcs = ["main_test.go"], embed = [":protoc-gen-openapiv2_lib"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/defs.bzl000066400000000000000000000423641465037340600273050ustar00rootroot00000000000000"""Generated an open-api spec for a grpc api spec. Reads the api spec in protobuf format and generate an open-api spec. Optionally applies settings from the grpc-service configuration. """ load("@rules_proto//proto:defs.bzl", "ProtoInfo") # TODO(yannic): Replace with |proto_common.direct_source_infos| when # https://github.com/bazelbuild/rules_proto/pull/22 lands. def _direct_source_infos(proto_info, provided_sources = []): """Returns sequence of `ProtoFileInfo` for `proto_info`'s direct sources. Files that are both in `proto_info`'s direct sources and in `provided_sources` are skipped. This is useful, e.g., for well-known protos that are already provided by the Protobuf runtime. Args: proto_info: An instance of `ProtoInfo`. provided_sources: Optional. A sequence of files to ignore. Usually, these files are already provided by the Protocol Buffer runtime (e.g. Well-Known protos). Returns: A sequence of `ProtoFileInfo` containing information about `proto_info`'s direct sources. """ source_root = proto_info.proto_source_root if "." == source_root: return [struct(file = src, import_path = src.path) for src in proto_info.check_deps_sources.to_list()] offset = len(source_root) + 1 # + '/'. infos = [] for src in proto_info.check_deps_sources.to_list(): # TODO(yannic): Remove this hack when we drop support for Bazel < 1.0. local_offset = offset if src.root.path and not source_root.startswith(src.root.path): # Before Bazel 1.0, `proto_source_root` wasn't guaranteed to be a # prefix of `src.path`. This could happened, e.g., if `file` was # generated (https://github.com/bazelbuild/bazel/issues/9215). local_offset += len(src.root.path) + 1 # + '/'. infos.append(struct(file = src, import_path = src.path[local_offset:])) return infos def _run_proto_gen_openapi( actions, proto_info, target_name, transitive_proto_srcs, protoc, protoc_gen_openapiv2, single_output, allow_delete_body, grpc_api_configuration, json_names_for_fields, repeated_path_param_separator, include_package_in_tags, fqn_for_openapi_name, openapi_naming_strategy, use_go_templates, go_template_args, ignore_comments, remove_internal_comments, disable_default_errors, disable_service_tags, enums_as_ints, omit_enum_default_value, output_format, simple_operation_ids, proto3_optional_nullable, openapi_configuration, generate_unbound_methods, visibility_restriction_selectors, use_allof_for_refs, disable_default_responses): args = actions.args() args.add("--plugin", "protoc-gen-openapiv2=%s" % protoc_gen_openapiv2.path) extra_inputs = [] if grpc_api_configuration: extra_inputs.append(grpc_api_configuration) args.add("--openapiv2_opt", "grpc_api_configuration=%s" % grpc_api_configuration.path) if openapi_configuration: extra_inputs.append(openapi_configuration) args.add("--openapiv2_opt", "openapi_configuration=%s" % openapi_configuration.path) if not json_names_for_fields: args.add("--openapiv2_opt", "json_names_for_fields=false") if fqn_for_openapi_name: args.add("--openapiv2_opt", "fqn_for_openapi_name=true") if openapi_naming_strategy: args.add("--openapiv2_opt", "openapi_naming_strategy=%s" % openapi_naming_strategy) if generate_unbound_methods: args.add("--openapiv2_opt", "generate_unbound_methods=true") if simple_operation_ids: args.add("--openapiv2_opt", "simple_operation_ids=true") if allow_delete_body: args.add("--openapiv2_opt", "allow_delete_body=true") if include_package_in_tags: args.add("--openapiv2_opt", "include_package_in_tags=true") if use_go_templates: args.add("--openapiv2_opt", "use_go_templates=true") for go_template_arg in go_template_args: args.add("--openapiv2_opt", "go_template_args=%s" % go_template_arg) if ignore_comments: args.add("--openapiv2_opt", "ignore_comments=true") if remove_internal_comments: args.add("--openapiv2_opt", "remove_internal_comments=true") if disable_default_errors: args.add("--openapiv2_opt", "disable_default_errors=true") if disable_service_tags: args.add("--openapiv2_opt", "disable_service_tags=true") if enums_as_ints: args.add("--openapiv2_opt", "enums_as_ints=true") if omit_enum_default_value: args.add("--openapiv2_opt", "omit_enum_default_value=true") if output_format: args.add("--openapiv2_opt", "output_format=%s" % output_format) if proto3_optional_nullable: args.add("--openapiv2_opt", "proto3_optional_nullable=true") for visibility_restriction_selector in visibility_restriction_selectors: args.add("--openapiv2_opt", "visibility_restriction_selectors=%s" % visibility_restriction_selector) if use_allof_for_refs: args.add("--openapiv2_opt", "use_allof_for_refs=true") if disable_default_responses: args.add("--openapiv2_opt", "disable_default_responses=true") args.add("--openapiv2_opt", "repeated_path_param_separator=%s" % repeated_path_param_separator) proto_file_infos = _direct_source_infos(proto_info) # TODO(yannic): Use |proto_info.transitive_descriptor_sets| when # https://github.com/bazelbuild/bazel/issues/9337 is fixed. args.add_all(proto_info.transitive_proto_path, format_each = "--proto_path=%s") if single_output: args.add("--openapiv2_opt", "allow_merge=true") args.add("--openapiv2_opt", "merge_file_name=%s" % target_name) openapi_file = actions.declare_file("%s.swagger.json" % target_name) args.add("--openapiv2_out", openapi_file.dirname) args.add_all([f.import_path for f in proto_file_infos]) actions.run( executable = protoc, tools = [protoc_gen_openapiv2], inputs = depset( direct = extra_inputs, transitive = [transitive_proto_srcs], ), outputs = [openapi_file], arguments = [args], ) return [openapi_file] # TODO(yannic): We may be able to generate all files in a single action, # but that will change at least the semantics of `use_go_template.proto`. openapi_files = [] for proto_file_info in proto_file_infos: # TODO(yannic): This probably doesn't work as expected: we only add this # option after we have seen it, so `.proto` sources that happen to be # in the list of `.proto` files before `use_go_template.proto` will be # compiled without this option, and all sources that get compiled after # `use_go_template.proto` will have this option on. if proto_file_info.file.basename == "use_go_template.proto": args.add("--openapiv2_opt", "use_go_templates=true") file_name = "%s.swagger.json" % proto_file_info.import_path[:-len(".proto")] openapi_file = actions.declare_file( "_virtual_imports/%s/%s" % (target_name, file_name), ) file_args = actions.args() offset = len(file_name) + 1 # + '/'. file_args.add("--openapiv2_out", openapi_file.path[:-offset]) file_args.add(proto_file_info.import_path) actions.run( executable = protoc, tools = [protoc_gen_openapiv2], inputs = depset( direct = extra_inputs, transitive = [transitive_proto_srcs], ), outputs = [openapi_file], arguments = [args, file_args], ) openapi_files.append(openapi_file) return openapi_files def _proto_gen_openapi_impl(ctx): proto = ctx.attr.proto[ProtoInfo] return [ DefaultInfo( files = depset( _run_proto_gen_openapi( actions = ctx.actions, proto_info = proto, target_name = ctx.attr.name, transitive_proto_srcs = depset( direct = ctx.files._well_known_protos, transitive = [proto.transitive_sources], ), protoc = ctx.executable._protoc, protoc_gen_openapiv2 = ctx.executable._protoc_gen_openapi, single_output = ctx.attr.single_output, allow_delete_body = ctx.attr.allow_delete_body, grpc_api_configuration = ctx.file.grpc_api_configuration, json_names_for_fields = ctx.attr.json_names_for_fields, repeated_path_param_separator = ctx.attr.repeated_path_param_separator, include_package_in_tags = ctx.attr.include_package_in_tags, fqn_for_openapi_name = ctx.attr.fqn_for_openapi_name, openapi_naming_strategy = ctx.attr.openapi_naming_strategy, use_go_templates = ctx.attr.use_go_templates, go_template_args = ctx.attr.go_template_args, ignore_comments = ctx.attr.ignore_comments, remove_internal_comments = ctx.attr.remove_internal_comments, disable_default_errors = ctx.attr.disable_default_errors, disable_service_tags = ctx.attr.disable_service_tags, enums_as_ints = ctx.attr.enums_as_ints, omit_enum_default_value = ctx.attr.omit_enum_default_value, output_format = ctx.attr.output_format, simple_operation_ids = ctx.attr.simple_operation_ids, proto3_optional_nullable = ctx.attr.proto3_optional_nullable, openapi_configuration = ctx.file.openapi_configuration, generate_unbound_methods = ctx.attr.generate_unbound_methods, visibility_restriction_selectors = ctx.attr.visibility_restriction_selectors, use_allof_for_refs = ctx.attr.use_allof_for_refs, disable_default_responses = ctx.attr.disable_default_responses, ), ), ), ] protoc_gen_openapiv2 = rule( attrs = { "proto": attr.label( mandatory = True, providers = [ProtoInfo], ), "single_output": attr.bool( default = False, mandatory = False, doc = "if set, the rule will generate a single OpenAPI file", ), "allow_delete_body": attr.bool( default = False, mandatory = False, doc = "unless set, HTTP DELETE methods may not have a body", ), "grpc_api_configuration": attr.label( allow_single_file = True, mandatory = False, doc = "path to file which describes the gRPC API Configuration in YAML format", ), "json_names_for_fields": attr.bool( default = True, mandatory = False, doc = "if disabled, the original proto name will be used for generating OpenAPI definitions", ), "repeated_path_param_separator": attr.string( default = "csv", mandatory = False, values = ["csv", "pipes", "ssv", "tsv"], doc = "configures how repeated fields should be split." + " Allowed values are `csv`, `pipes`, `ssv` and `tsv`", ), "include_package_in_tags": attr.bool( default = False, mandatory = False, doc = "if unset, the gRPC service name is added to the `Tags`" + " field of each operation. If set and the `package` directive" + " is shown in the proto file, the package name will be " + " prepended to the service name", ), "fqn_for_openapi_name": attr.bool( default = False, mandatory = False, doc = "if set, the object's OpenAPI names will use the fully" + " qualified names from the proto definition" + " (ie my.package.MyMessage.MyInnerMessage", ), "openapi_naming_strategy": attr.string( default = "", mandatory = False, values = ["", "simple", "legacy", "fqn"], doc = "configures how OpenAPI names are determined." + " Allowed values are `` (empty), `simple`, `legacy` and `fqn`." + " If unset, either `legacy` or `fqn` are selected, depending" + " on the value of the `fqn_for_openapi_name` setting", ), "use_go_templates": attr.bool( default = False, mandatory = False, doc = "if set, you can use Go templates in protofile comments", ), "go_template_args": attr.string_list( mandatory = False, doc = "specify a key value pair as inputs to the Go template of the protofile" + " comments. Repeat this option to specify multiple template arguments." + " Requires the `use_go_templates` option to be set.", ), "ignore_comments": attr.bool( default = False, mandatory = False, doc = "if set, all protofile comments are excluded from output", ), "remove_internal_comments": attr.bool( default = False, mandatory = False, doc = "if set, removes all substrings in comments that start with " + "`(--` and end with `--)` as specified in " + "https://google.aip.dev/192#internal-comments", ), "disable_default_errors": attr.bool( default = False, mandatory = False, doc = "if set, disables generation of default errors." + " This is useful if you have defined custom error handling", ), "disable_service_tags": attr.bool( default = False, mandatory = False, doc = "if set, disables generation of service tags." + " This is useful if you do not want to expose the names of your backend grpc services.", ), "enums_as_ints": attr.bool( default = False, mandatory = False, doc = "whether to render enum values as integers, as opposed to string values", ), "omit_enum_default_value": attr.bool( default = False, mandatory = False, doc = "if set, omit default enum value", ), "output_format": attr.string( default = "json", mandatory = False, values = ["json", "yaml"], doc = "output content format. Allowed values are: `json`, `yaml`", ), "simple_operation_ids": attr.bool( default = False, mandatory = False, doc = "whether to remove the service prefix in the operationID" + " generation. Can introduce duplicate operationIDs, use with caution.", ), "proto3_optional_nullable": attr.bool( default = False, mandatory = False, doc = "whether Proto3 Optional fields should be marked as x-nullable", ), "openapi_configuration": attr.label( allow_single_file = True, mandatory = False, doc = "path to file which describes the OpenAPI Configuration in YAML format", ), "generate_unbound_methods": attr.bool( default = False, mandatory = False, doc = "generate swagger metadata even for RPC methods that have" + " no HttpRule annotation", ), "visibility_restriction_selectors": attr.string_list( mandatory = False, doc = "list of `google.api.VisibilityRule` visibility labels to include" + " in the generated output when a visibility annotation is defined." + " Repeat this option to supply multiple values. Elements without" + " visibility annotations are unaffected by this setting.", ), "use_allof_for_refs": attr.bool( default = False, mandatory = False, doc = "if set, will use allOf as container for $ref to preserve" + " same-level properties.", ), "disable_default_responses": attr.bool( default = False, mandatory = False, doc = "if set, disables generation of default responses. Useful" + " if you have to support custom response codes that are" + " not 200.", ), "_protoc": attr.label( default = "@com_google_protobuf//:protoc", executable = True, cfg = "exec", ), "_well_known_protos": attr.label( default = "@com_google_protobuf//:well_known_type_protos", allow_files = True, ), "_protoc_gen_openapi": attr.label( default = Label("//protoc-gen-openapiv2:protoc-gen-openapiv2"), executable = True, cfg = "exec", ), }, implementation = _proto_gen_openapi_impl, ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/000077500000000000000000000000001465037340600274565ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/000077500000000000000000000000001465037340600316035ustar00rootroot00000000000000BUILD.bazel000066400000000000000000000061611465037340600334060ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapiload("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//protoc-gen-openapiv2:__subpackages__"]) go_library( name = "genopenapi", srcs = [ "doc.go", "format.go", "generator.go", "helpers.go", "helpers_go111_old.go", "naming.go", "template.go", "types.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi", deps = [ "//internal/casing", "//internal/descriptor", "//internal/generator", "//protoc-gen-openapiv2/options", "@in_gopkg_yaml_v3//:yaml_v3", "@org_golang_google_genproto_googleapis_api//annotations", "@org_golang_google_genproto_googleapis_api//visibility", "@org_golang_google_genproto_googleapis_rpc//status", "@org_golang_google_grpc//grpclog", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protodesc", "@org_golang_google_protobuf//types/descriptorpb", "@org_golang_google_protobuf//types/known/anypb", "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/pluginpb", "@org_golang_x_text//cases", "@org_golang_x_text//language", ], ) go_test( name = "genopenapi_test", size = "small", srcs = [ "cycle_test.go", "format_test.go", "generator_test.go", "helpers_test.go", "naming_test.go", "template_fuzz_test.go", "template_test.go", "types_test.go", ], data = glob(["testdata/**"]), embed = [":genopenapi"], deps = [ "//internal/descriptor", "//internal/descriptor/openapiconfig", "//internal/httprule", "//protoc-gen-openapiv2/options", "//runtime", "@com_github_google_go_cmp//cmp", "@in_gopkg_yaml_v3//:yaml_v3", "@org_golang_google_genproto_googleapis_api//annotations", "@org_golang_google_genproto_googleapis_api//visibility", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//encoding/prototext", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protodesc", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//reflect/protoregistry", "@org_golang_google_protobuf//types/descriptorpb", "@org_golang_google_protobuf//types/known/anypb", "@org_golang_google_protobuf//types/known/durationpb", "@org_golang_google_protobuf//types/known/emptypb", "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/known/timestamppb", "@org_golang_google_protobuf//types/known/wrapperspb", "@org_golang_google_protobuf//types/pluginpb", ], ) alias( name = "go_default_library", actual = ":genopenapi", visibility = ["//protoc-gen-openapiv2:__subpackages__"], ) cycle_test.go000066400000000000000000000010071465037340600342070ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "testing" ) func TestCycle(t *testing.T) { for _, tt := range []struct { max int attempt int e bool }{ { max: 3, attempt: 3, e: true, }, { max: 5, attempt: 6, }, { max: 1000, attempt: 1001, }, } { c := newCycleChecker(tt.max) var final bool for i := 0; i < tt.attempt; i++ { final = c.Check("a") if !final { break } } if final != tt.e { t.Errorf("got: %t wanted: %t", final, tt.e) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/doc.go000066400000000000000000000001231465037340600326730ustar00rootroot00000000000000// Package genopenapi provides a code generator for OpenAPI v2. package genopenapi golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/format.go000066400000000000000000000013261465037340600334240ustar00rootroot00000000000000package genopenapi import ( "encoding/json" "errors" "io" "gopkg.in/yaml.v3" ) type Format string const ( FormatJSON Format = "json" FormatYAML Format = "yaml" ) type ContentEncoder interface { Encode(v interface{}) (err error) } func (f Format) Validate() error { switch f { case FormatJSON, FormatYAML: return nil default: return errors.New("unknown format: " + string(f)) } } func (f Format) NewEncoder(w io.Writer) (ContentEncoder, error) { switch f { case FormatYAML: enc := yaml.NewEncoder(w) enc.SetIndent(2) return enc, nil case FormatJSON: enc := json.NewEncoder(w) enc.SetIndent("", " ") return enc, nil default: return nil, errors.New("unknown format: " + string(f)) } } format_test.go000066400000000000000000000040641465037340600344060ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi_test import ( "bytes" "encoding/json" "io" "reflect" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi" "gopkg.in/yaml.v3" ) func TestFormatValidate(t *testing.T) { t.Parallel() testCases := [...]struct { Format genopenapi.Format Valid bool }{{ Format: genopenapi.FormatJSON, Valid: true, }, { Format: genopenapi.FormatYAML, Valid: true, }, { Format: genopenapi.Format("unknown"), Valid: false, }, { Format: genopenapi.Format(""), Valid: false, }} for _, tc := range testCases { tc := tc t.Run(string(tc.Format), func(t *testing.T) { t.Parallel() err := tc.Format.Validate() switch { case tc.Valid && err != nil: t.Fatalf("expect no validation error, got: %s", err) case !tc.Valid && err == nil: t.Fatal("expect validation error, got nil") } }) } } func TestFormatEncode(t *testing.T) { t.Parallel() type contentDecoder interface { Decode(v interface{}) error } testCases := [...]struct { Format genopenapi.Format NewDecoder func(r io.Reader) contentDecoder }{{ Format: genopenapi.FormatJSON, NewDecoder: func(r io.Reader) contentDecoder { return json.NewDecoder(r) }, }, { Format: genopenapi.FormatYAML, NewDecoder: func(r io.Reader) contentDecoder { return yaml.NewDecoder(r) }, }} for _, tc := range testCases { tc := tc t.Run(string(tc.Format), func(t *testing.T) { t.Parallel() expParams := map[string]string{ "hello": "world", } var buf bytes.Buffer enc, err := tc.Format.NewEncoder(&buf) if err != nil { t.Fatalf("expect no encoder creating error, got: %s", err) } err = enc.Encode(expParams) if err != nil { t.Fatalf("expect no encoding error, got: %s", err) } gotParams := make(map[string]string) err = tc.NewDecoder(&buf).Decode(&gotParams) if err != nil { t.Fatalf("expect no decoding error, got: %s", err) } if !reflect.DeepEqual(expParams, gotParams) { t.Fatalf("expected: %+v, actual: %+v", expParams, gotParams) } }) } } generator.go000066400000000000000000000317301465037340600340450ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "bytes" "encoding/json" "errors" "fmt" "path/filepath" "reflect" "sort" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" openapioptions "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/pluginpb" "gopkg.in/yaml.v3" ) var errNoTargetService = errors.New("no target service defined in the file") type generator struct { reg *descriptor.Registry format Format } type wrapper struct { fileName string swagger *openapiSwaggerObject } type GeneratorOptions struct { Registry *descriptor.Registry RecursiveDepth int } // New returns a new generator which generates grpc gateway files. func New(reg *descriptor.Registry, format Format) gen.Generator { return &generator{ reg: reg, format: format, } } // Merge a lot of OpenAPI file (wrapper) to single one OpenAPI file func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { var mergedTarget *wrapper for _, f := range targets { if mergedTarget == nil { mergedTarget = &wrapper{ fileName: mergeFileName, swagger: f.swagger, } } else { for k, v := range f.swagger.Definitions { mergedTarget.swagger.Definitions[k] = v } for k, v := range f.swagger.SecurityDefinitions { mergedTarget.swagger.SecurityDefinitions[k] = v } copy(mergedTarget.swagger.Paths, f.swagger.Paths) mergedTarget.swagger.Security = append(mergedTarget.swagger.Security, f.swagger.Security...) } } return mergedTarget } // Q: What's up with the alias types here? // A: We don't want to completely override how these structs are marshaled into // JSON, we only want to add fields (see below, extensionMarshalJSON). // An infinite recursion would happen if we'd call json.Marshal on the struct // that has swaggerObject as an embedded field. To avoid that, we'll create // type aliases, and those don't have the custom MarshalJSON methods defined // on them. See http://choly.ca/post/go-json-marshalling/ (or, if it ever // goes away, use // https://web.archive.org/web/20190806073003/http://choly.ca/post/go-json-marshalling/. func (so openapiSwaggerObject) MarshalJSON() ([]byte, error) { type alias openapiSwaggerObject return extensionMarshalJSON(alias(so), so.extensions) } // MarshalYAML implements yaml.Marshaler interface. // // It is required in order to pass extensions inline. // // Example: // // extensions: {x-key: x-value} // type: string // // It will be rendered as: // // x-key: x-value // type: string // // Use generics when the project will be upgraded to go 1.18+. func (so openapiSwaggerObject) MarshalYAML() (interface{}, error) { type Alias openapiSwaggerObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } // Custom json marshaller for openapiPathsObject. Ensures // openapiPathsObject is marshalled into expected format in generated // swagger.json. func (po openapiPathsObject) MarshalJSON() ([]byte, error) { var buf bytes.Buffer buf.WriteString("{") for i, pd := range po { if i != 0 { buf.WriteString(",") } // marshal key key, err := json.Marshal(pd.Path) if err != nil { return nil, err } buf.Write(key) buf.WriteString(":") // marshal value val, err := json.Marshal(pd.PathItemObject) if err != nil { return nil, err } buf.Write(val) } buf.WriteString("}") return buf.Bytes(), nil } // Custom yaml marshaller for openapiPathsObject. Ensures // openapiPathsObject is marshalled into expected format in generated // swagger.yaml. func (po openapiPathsObject) MarshalYAML() (interface{}, error) { var pathObjectNode yaml.Node pathObjectNode.Kind = yaml.MappingNode for _, pathData := range po { var pathNode yaml.Node pathNode.SetString(pathData.Path) pathItemObjectNode, err := pathData.PathItemObject.toYAMLNode() if err != nil { return nil, err } pathObjectNode.Content = append(pathObjectNode.Content, &pathNode, pathItemObjectNode) } return pathObjectNode, nil } // We can simplify this implementation once the go-yaml bug is resolved. See: https://github.com/go-yaml/yaml/issues/643. // // func (pio *openapiPathItemObject) toYAMLNode() (*yaml.Node, error) { // var node yaml.Node // if err := node.Encode(pio); err != nil { // return nil, err // } // return &node, nil // } func (pio *openapiPathItemObject) toYAMLNode() (*yaml.Node, error) { var doc yaml.Node var buf bytes.Buffer ec := yaml.NewEncoder(&buf) ec.SetIndent(2) if err := ec.Encode(pio); err != nil { return nil, err } if err := yaml.Unmarshal(buf.Bytes(), &doc); err != nil { return nil, err } if len(doc.Content) == 0 { return nil, errors.New("unexpected number of yaml nodes") } return doc.Content[0], nil } func (so openapiInfoObject) MarshalJSON() ([]byte, error) { type alias openapiInfoObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiInfoObject) MarshalYAML() (interface{}, error) { type Alias openapiInfoObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiSecuritySchemeObject) MarshalJSON() ([]byte, error) { type alias openapiSecuritySchemeObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiSecuritySchemeObject) MarshalYAML() (interface{}, error) { type Alias openapiSecuritySchemeObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiOperationObject) MarshalJSON() ([]byte, error) { type alias openapiOperationObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiOperationObject) MarshalYAML() (interface{}, error) { type Alias openapiOperationObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiResponseObject) MarshalJSON() ([]byte, error) { type alias openapiResponseObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiResponseObject) MarshalYAML() (interface{}, error) { type Alias openapiResponseObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiSchemaObject) MarshalJSON() ([]byte, error) { type alias openapiSchemaObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiSchemaObject) MarshalYAML() (interface{}, error) { type Alias openapiSchemaObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiParameterObject) MarshalJSON() ([]byte, error) { type alias openapiParameterObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiParameterObject) MarshalYAML() (interface{}, error) { type Alias openapiParameterObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func (so openapiTagObject) MarshalJSON() ([]byte, error) { type alias openapiTagObject return extensionMarshalJSON(alias(so), so.extensions) } func (so openapiTagObject) MarshalYAML() (interface{}, error) { type Alias openapiTagObject return struct { Extension map[string]interface{} `yaml:",inline"` Alias `yaml:",inline"` }{ Extension: extensionsToMap(so.extensions), Alias: Alias(so), }, nil } func extensionMarshalJSON(so interface{}, extensions []extension) ([]byte, error) { // To append arbitrary keys to the struct we'll render into json, // we're creating another struct that embeds the original one, and // its extra fields: // // The struct will look like // struct { // *openapiCore // XGrpcGatewayFoo json.RawMessage `json:"x-grpc-gateway-foo"` // XGrpcGatewayBar json.RawMessage `json:"x-grpc-gateway-bar"` // } // and thus render into what we want -- the JSON of openapiCore with the // extensions appended. fields := []reflect.StructField{ { // embedded Name: "Embedded", Type: reflect.TypeOf(so), Anonymous: true, }, } for _, ext := range extensions { fields = append(fields, reflect.StructField{ Name: fieldName(ext.key), Type: reflect.TypeOf(ext.value), Tag: reflect.StructTag(fmt.Sprintf("json:\"%s\"", ext.key)), }) } t := reflect.StructOf(fields) s := reflect.New(t).Elem() s.Field(0).Set(reflect.ValueOf(so)) for _, ext := range extensions { s.FieldByName(fieldName(ext.key)).Set(reflect.ValueOf(ext.value)) } return json.Marshal(s.Interface()) } // encodeOpenAPI converts OpenAPI file obj to pluginpb.CodeGeneratorResponse_File func encodeOpenAPI(file *wrapper, format Format) (*descriptor.ResponseFile, error) { var contentBuf bytes.Buffer enc, err := format.NewEncoder(&contentBuf) if err != nil { return nil, err } if err := enc.Encode(*file.swagger); err != nil { return nil, err } name := file.fileName ext := filepath.Ext(name) base := strings.TrimSuffix(name, ext) output := fmt.Sprintf("%s.swagger."+string(format), base) return &descriptor.ResponseFile{ CodeGeneratorResponse_File: &pluginpb.CodeGeneratorResponse_File{ Name: proto.String(output), Content: proto.String(contentBuf.String()), }, }, nil } func (g *generator) Generate(targets []*descriptor.File) ([]*descriptor.ResponseFile, error) { var files []*descriptor.ResponseFile if g.reg.IsAllowMerge() { var mergedTarget *descriptor.File // try to find proto leader for _, f := range targets { if proto.HasExtension(f.Options, openapioptions.E_Openapiv2Swagger) { mergedTarget = f break } } // merge protos to leader for _, f := range targets { if mergedTarget == nil { mergedTarget = f } else if mergedTarget != f { mergedTarget.Enums = append(mergedTarget.Enums, f.Enums...) mergedTarget.Messages = append(mergedTarget.Messages, f.Messages...) mergedTarget.Services = append(mergedTarget.Services, f.Services...) } } targets = nil targets = append(targets, mergedTarget) } var openapis []*wrapper for _, file := range targets { if grpclog.V(1) { grpclog.Infof("Processing %s", file.GetName()) } swagger, err := applyTemplate(param{File: file, reg: g.reg}) if errors.Is(err, errNoTargetService) { if grpclog.V(1) { grpclog.Infof("%s: %v", file.GetName(), err) } continue } if err != nil { return nil, err } openapis = append(openapis, &wrapper{ fileName: file.GetName(), swagger: swagger, }) } if g.reg.IsAllowMerge() { targetOpenAPI := mergeTargetFile(openapis, g.reg.GetMergeFileName()) if !g.reg.IsPreserveRPCOrder() { targetOpenAPI.swagger.sortPathsAlphabetically() } f, err := encodeOpenAPI(targetOpenAPI, g.format) if err != nil { return nil, fmt.Errorf("failed to encode OpenAPI for %s: %w", g.reg.GetMergeFileName(), err) } files = append(files, f) if grpclog.V(1) { grpclog.Infof("New OpenAPI file will emit") } } else { for _, file := range openapis { if !g.reg.IsPreserveRPCOrder() { file.swagger.sortPathsAlphabetically() } f, err := encodeOpenAPI(file, g.format) if err != nil { return nil, fmt.Errorf("failed to encode OpenAPI for %s: %w", file.fileName, err) } files = append(files, f) if grpclog.V(1) { grpclog.Infof("New OpenAPI file will emit") } } } return files, nil } func (so openapiSwaggerObject) sortPathsAlphabetically() { sort.Slice(so.Paths, func(i, j int) bool { return so.Paths[i].Path < so.Paths[j].Path }) } // AddErrorDefs Adds google.rpc.Status and google.protobuf.Any // to registry (used for error-related API responses) func AddErrorDefs(reg *descriptor.Registry) error { // load internal protos any := protodesc.ToFileDescriptorProto((&anypb.Any{}).ProtoReflect().Descriptor().ParentFile()) any.SourceCodeInfo = new(descriptorpb.SourceCodeInfo) status := protodesc.ToFileDescriptorProto((&statuspb.Status{}).ProtoReflect().Descriptor().ParentFile()) status.SourceCodeInfo = new(descriptorpb.SourceCodeInfo) return reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ any, status, }, }) } func extensionsToMap(extensions []extension) map[string]interface{} { m := make(map[string]interface{}, len(extensions)) for _, v := range extensions { m[v.key] = RawExample(v.value) } return m } generator_test.go000066400000000000000000001201551465037340600351040ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi_test import ( "os" "reflect" "sort" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi" "gopkg.in/yaml.v3" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) func TestGenerate_YAML(t *testing.T) { t.Parallel() req := &pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{{ Name: proto.String("file.proto"), Package: proto.String("example"), Options: &descriptorpb.FileOptions{ GoPackage: proto.String("goexample/v1;goexample"), }, }}, FileToGenerate: []string{ "file.proto", }, } resp := requireGenerate(t, req, genopenapi.FormatYAML, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } var p map[string]interface{} err := yaml.Unmarshal([]byte(resp[0].GetContent()), &p) if err != nil { t.Fatalf("failed to unmarshall yaml: %s", err) } } func TestGenerateExtension(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" options: { [grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field]: { description: "This is bar" extensions: { key: "x-go-default" value: { string_value: "0.5s" } } } } } } service: { name: "TestService" method: { name: "Test" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: {} } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) if !strings.Contains(content, "x-go-default") { t.Fatal("x-go-default not found in content message") } }) } } func TestGenerateYAML(t *testing.T) { t.Parallel() tests := []struct { name string inputProtoText string wantYAML string }{ { // It tests https://github.com/grpc-ecosystem/grpc-gateway/issues/3557. name: "path item object", inputProtoText: "testdata/generator/path_item_object.prototext", wantYAML: "testdata/generator/path_item_object.swagger.yaml", }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() b, err := os.ReadFile(tt.inputProtoText) if err != nil { t.Fatal(err) } var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal(b, &req); err != nil { t.Fatal(err) } resp := requireGenerate(t, &req, genopenapi.FormatYAML, false, true) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } got := resp[0].GetContent() want, err := os.ReadFile(tt.wantYAML) if err != nil { t.Fatal(err) } diff := cmp.Diff(string(want), got) if diff != "" { t.Fatalf("content not match\n%s", diff) } }) } } func requireGenerate( tb testing.TB, req *pluginpb.CodeGeneratorRequest, format genopenapi.Format, preserveRPCOrder bool, allowMerge bool, ) []*descriptor.ResponseFile { tb.Helper() reg := descriptor.NewRegistry() reg.SetPreserveRPCOrder(preserveRPCOrder) reg.SetAllowMerge(allowMerge) if err := reg.Load(req); err != nil { tb.Fatalf("failed to load request: %s", err) } var targets []*descriptor.File for _, target := range req.FileToGenerate { f, err := reg.LookupFile(target) if err != nil { tb.Fatalf("failed to lookup file: %s", err) } targets = append(targets, f) } g := genopenapi.New(reg, format) resp, err := g.Generate(targets) switch { case err != nil: tb.Fatalf("failed to generate targets: %s", err) case len(resp) != len(targets) && !allowMerge: tb.Fatalf("invalid count, expected: %d, actual: %d", len(targets), len(resp)) } return resp } func TestGeneratedYAMLIndent(t *testing.T) { // It tests https://github.com/grpc-ecosystem/grpc-gateway/issues/2745. const in = ` file_to_generate: "exampleproto/v1/exampleproto.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/exampleproto.proto" package: "repro" message_type: { name: "RollupRequest" field: { name: "type" number: 1 label: LABEL_OPTIONAL type: TYPE_ENUM type_name: ".repro.RollupType" json_name: "type" } } message_type: { name: "RollupResponse" } enum_type: { name: "RollupType" value: { name: "UNKNOWN_ROLLUP" number: 0 } value: { name: "APPLE" number: 1 } value: { name: "BANANA" number: 2 } value: { name: "CARROT" number: 3 } } service: { name: "Repro" method: { name: "GetRollup" input_type: ".repro.RollupRequest" output_type: ".repro.RollupResponse" options: { [google.api.http]: { get: "/rollup" } } } } options: { go_package: "repro/foobar" } source_code_info: { location: { path: 5 path: 0 path: 2 path: 1 span: 24 span: 4 span: 14 leading_comments: " Apples are good\n" } location: { path: 5 path: 0 path: 2 path: 3 span: 28 span: 4 span: 15 leading_comments: " Carrots are mediocre\n" } } syntax: "proto3" } ` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } resp := requireGenerate(t, &req, genopenapi.FormatYAML, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() err := yaml.Unmarshal([]byte(content), map[string]interface{}{}) if err != nil { t.Log(content) t.Fatalf("got invalid yaml: %s", err) } } func TestGenerateRPCOrderPreserved(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, true, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/b/first", "/a/second", "/c/third"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderNotPreserved(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/a/second", "/b/first", "/c/third"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderPreservedMultipleServices(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestServiceOne" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/d/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/e/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } service: { name: "TestServiceTwo" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/g/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, true, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/d/first", "/e/second", "/c/third", "/b/first", "/a/second", "/g/third"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderNotPreservedMultipleServices(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestServiceOne" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/d/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/e/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } service: { name: "TestServiceTwo" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/g/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/d/first", "/e/second", "/c/third", "/b/first", "/a/second", "/g/third"} sort.Strings(expectedPaths) foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderPreservedMergeFiles(t *testing.T) { t.Parallel() const in1 = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/cpath" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/bpath" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/apath" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` const in2 = ` file_to_generate: "exampleproto/v2/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v2/example.proto" package: "example.v2" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/f/fpath" } } } method: { name: "Test2" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/e/epath" } } } method: { name: "Test3" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/d/dpath" } } } } options: { go_package: "exampleproto/v2;exampleproto" } }` var req1, req2 pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in1), &req1); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } if err := prototext.Unmarshal([]byte(in2), &req2); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } req1.ProtoFile = append(req1.ProtoFile, req2.ProtoFile...) req1.FileToGenerate = append(req1.FileToGenerate, req2.FileToGenerate...) formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req1, format, true, true) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/c/cpath", "/b/bpath", "/a/apath", "/f/fpath", "/e/epath", "/d/dpath"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderNotPreservedMergeFiles(t *testing.T) { t.Parallel() const in1 = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/cpath" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/bpath" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/apath" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` const in2 = ` file_to_generate: "exampleproto/v2/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v2/example.proto" package: "example.v2" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/f/fpath" } } } method: { name: "Test2" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/e/epath" } } } method: { name: "Test3" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/d/dpath" } } } } options: { go_package: "exampleproto/v2;exampleproto" } }` var req1, req2 pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in1), &req1); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } if err := prototext.Unmarshal([]byte(in2), &req2); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } req1.ProtoFile = append(req1.ProtoFile, req2.ProtoFile...) req1.FileToGenerate = append(req1.FileToGenerate, req2.FileToGenerate...) formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req1, format, false, true) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/c/cpath", "/b/bpath", "/a/apath", "/f/fpath", "/e/epath", "/d/dpath"} sort.Strings(expectedPaths) foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderPreservedAdditionalBindings(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" additional_bindings { get: "/a/additional" } } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" additional_bindings { get: "/z/zAdditional" } } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" additional_bindings { get: "/b/bAdditional" } } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, true, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/b/first", "/a/additional", "/a/second", "/z/zAdditional", "/c/third", "/b/bAdditional"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOneOfFieldBodyAdditionalBindings(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" oneof_decl: { name: "foo" } field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" oneof_index: 0 } field: { name: "baz" number: 2 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" oneof_index: 0 } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { post: "/b/foo" body: "*" additional_bindings { post: "/b/foo/bar" body: "bar" } additional_bindings { post: "/b/foo/baz" body: "baz" } } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, true, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/b/foo", "/b/foo/bar", "/b/foo/baz"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } // The input message only contains oneof fields, so no other fields should be mapped to the query. if strings.Contains(content, "query") { t.Fatalf("Found query in content, expected not to find any") } }) } } func TestGenerateRPCOrderNotPreservedAdditionalBindings(t *testing.T) { t.Parallel() const in = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" additional_bindings { get: "/a/additional" } } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" additional_bindings { get: "/z/zAdditional" } } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" additional_bindings { get: "/b/bAdditional" } } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` var req pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in), &req); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req, format, false, false) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/b/first", "/a/additional", "/a/second", "/z/zAdditional", "/c/third", "/b/bAdditional"} sort.Strings(expectedPaths) foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderPreservedMergeFilesAdditionalBindingsMultipleServices(t *testing.T) { t.Parallel() const in1 = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestServiceOne" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/d/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/e/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } service: { name: "TestServiceTwo" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/g/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` const in2 = ` file_to_generate: "exampleproto/v2/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v2/example.proto" package: "example.v2" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/b/bpath" additional_bindings { get: "/a/additional" } } } } method: { name: "Test2" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/a/apath" additional_bindings { get: "/z/zAdditional" } } } } method: { name: "Test3" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/c/cpath" additional_bindings { get: "/b/bAdditional" } } } } } options: { go_package: "exampleproto/v2;exampleproto" } }` var req1, req2 pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in1), &req1); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } if err := prototext.Unmarshal([]byte(in2), &req2); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } req1.ProtoFile = append(req1.ProtoFile, req2.ProtoFile...) req1.FileToGenerate = append(req1.FileToGenerate, req2.FileToGenerate...) formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req1, format, true, true) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/d/first", "/e/second", "/c/third", "/b/first", "/a/second", "/g/third", "/b/bpath", "/a/additional", "/a/apath", "/z/zAdditional", "/c/cpath", "/b/bAdditional"} foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } func TestGenerateRPCOrderNotPreservedMergeFilesAdditionalBindingsMultipleServices(t *testing.T) { t.Parallel() const in1 = ` file_to_generate: "exampleproto/v1/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v1/example.proto" package: "example.v1" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestServiceOne" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/d/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/e/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/c/third" } } } } service: { name: "TestServiceTwo" method: { name: "Test1" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/b/first" } } } method: { name: "Test2" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/a/second" } } } method: { name: "Test3" input_type: ".example.v1.Foo" output_type: ".example.v1.Foo" options: { [google.api.http]: { get: "/g/third" } } } } options: { go_package: "exampleproto/v1;exampleproto" } }` const in2 = ` file_to_generate: "exampleproto/v2/example.proto" parameter: "output_format=yaml,allow_delete_body=true" proto_file: { name: "exampleproto/v2/example.proto" package: "example.v2" message_type: { name: "Foo" field: { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "bar" } } service: { name: "TestService" method: { name: "Test1" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/b/bpath" additional_bindings { get: "/a/additional" } } } } method: { name: "Test2" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/a/apath" additional_bindings { get: "/z/zAdditional" } } } } method: { name: "Test3" input_type: ".example.v2.Foo" output_type: ".example.v2.Foo" options: { [google.api.http]: { get: "/c/cpath" additional_bindings { get: "/b/bAdditional" } } } } } options: { go_package: "exampleproto/v2;exampleproto" } }` var req1, req2 pluginpb.CodeGeneratorRequest if err := prototext.Unmarshal([]byte(in1), &req1); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } if err := prototext.Unmarshal([]byte(in2), &req2); err != nil { t.Fatalf("failed to marshall yaml: %s", err) } req1.ProtoFile = append(req1.ProtoFile, req2.ProtoFile...) req1.FileToGenerate = append(req1.FileToGenerate, req2.FileToGenerate...) formats := [...]genopenapi.Format{ genopenapi.FormatJSON, genopenapi.FormatYAML, } for _, format := range formats { format := format t.Run(string(format), func(t *testing.T) { t.Parallel() resp := requireGenerate(t, &req1, format, false, true) if len(resp) != 1 { t.Fatalf("invalid count, expected: 1, actual: %d", len(resp)) } content := resp[0].GetContent() t.Log(content) contentsSlice := strings.Fields(content) expectedPaths := []string{"/d/first", "/e/second", "/c/third", "/b/first", "/a/second", "/g/third", "/b/bpath", "/a/additional", "/a/apath", "/z/zAdditional", "/c/cpath", "/b/bAdditional"} sort.Strings(expectedPaths) foundPaths := []string{} for _, contentValue := range contentsSlice { findExpectedPaths(&foundPaths, expectedPaths, contentValue) } if allPresent := reflect.DeepEqual(foundPaths, expectedPaths); !allPresent { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, expectedPaths) } }) } } // Tries to find expected paths from a provided substring and store them in the foundPaths // slice. func findExpectedPaths(foundPaths *[]string, expectedPaths []string, potentialPath string) { seenPaths := map[string]struct{}{} // foundPaths may not be empty when this function is called multiple times, // so we add them to seenPaths map to avoid duplicates. for _, path := range *foundPaths { seenPaths[path] = struct{}{} } for _, path := range expectedPaths { _, pathAlreadySeen := seenPaths[path] if strings.Contains(potentialPath, path) && !pathAlreadySeen { *foundPaths = append(*foundPaths, path) seenPaths[path] = struct{}{} } } } func TestFindExpectedPaths(t *testing.T) { t.Parallel() testCases := [...]struct { testName string requiredPaths []string potentialPath string expectedPathsFound []string }{ { testName: "One potential path present", requiredPaths: []string{"/d/first", "/e/second", "/c/third", "/b/first"}, potentialPath: "[{\"path: \"/d/first\"", expectedPathsFound: []string{"/d/first"}, }, { testName: "No potential Paths present", requiredPaths: []string{"/d/first", "/e/second", "/c/third", "/b/first"}, potentialPath: "[{\"path: \"/z/zpath\"", expectedPathsFound: []string{}, }, { testName: "Multiple potential paths present", requiredPaths: []string{"/d/first", "/e/second", "/c/third", "/b/first", "/d/first"}, potentialPath: "[{\"path: \"/d/first\"someData\"/c/third\"someData\"/b/third\"", expectedPathsFound: []string{"/d/first", "/c/third"}, }, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { t.Parallel() foundPaths := []string{} findExpectedPaths(&foundPaths, tc.requiredPaths, tc.potentialPath) if correctPathsFound := reflect.DeepEqual(foundPaths, tc.expectedPathsFound); !correctPathsFound { t.Fatalf("Found paths differed from expected paths. Got: %#v, want %#v", foundPaths, tc.expectedPathsFound) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/helpers.go000066400000000000000000000013731465037340600336000ustar00rootroot00000000000000//go:build go1.12 // +build go1.12 package genopenapi import ( "strings" "golang.org/x/text/cases" "golang.org/x/text/language" ) func fieldName(k string) string { return strings.ReplaceAll(cases.Title(language.AmericanEnglish).String(k), "-", "_") } // this method will filter the same fields and return the unique one func getUniqueFields(schemaFieldsRequired []string, fieldsRequired []string) []string { var unique []string var index *int for j, schemaFieldRequired := range schemaFieldsRequired { index = nil for i, fieldRequired := range fieldsRequired { i := i if schemaFieldRequired == fieldRequired { index = &i break } } if index == nil { unique = append(unique, schemaFieldsRequired[j]) } } return unique } helpers_go111_old.go000066400000000000000000000002501465037340600352600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi//go:build !go1.12 // +build !go1.12 package genopenapi import "strings" func fieldName(k string) string { return strings.Replace(strings.Title(k), "-", "_", -1) } helpers_test.go000066400000000000000000000031331465037340600345540ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "reflect" "testing" ) func Test_getUniqueFields(t *testing.T) { type args struct { schemaFieldsRequired []string fieldsRequired []string } var tests = []struct { name string args args want []string }{ { name: "test_1", args: args{ schemaFieldsRequired: []string{"Field_1", "Field_2", "Field_3"}, fieldsRequired: []string{"Field_2"}, }, want: []string{"Field_1", "Field_3"}, }, { name: "test_2", args: args{ schemaFieldsRequired: []string{"Field_1", "Field_2", "Field_3"}, fieldsRequired: []string{"Field_3"}, }, want: []string{"Field_1", "Field_2"}, }, { name: "test_3", args: args{ schemaFieldsRequired: []string{"Field_1", "Field_2", "Field_3"}, fieldsRequired: []string{"Field_4"}, }, want: []string{"Field_1", "Field_2", "Field_3"}, }, { name: "test_4", args: args{ schemaFieldsRequired: []string{"Field_1", "Field_2", "Field_3", "Field_4", "Field_5", "Field_6"}, fieldsRequired: []string{"Field_6", "Field_4", "Field_1"}, }, want: []string{"Field_2", "Field_3", "Field_5"}, }, { name: "test_5", args: args{ schemaFieldsRequired: []string{"Field_1", "Field_2", "Field_3"}, fieldsRequired: []string{}, }, want: []string{"Field_1", "Field_2", "Field_3"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := getUniqueFields(tt.args.schemaFieldsRequired, tt.args.fieldsRequired); !reflect.DeepEqual(got, tt.want) { t.Errorf("getUniqueFields() = %v, want %v", got, tt.want) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/naming.go000066400000000000000000000100011465037340600333730ustar00rootroot00000000000000package genopenapi import ( "reflect" "strings" ) // LookupNamingStrategy looks up the given naming strategy and returns the naming // strategy function for it. The naming strategy function takes in the list of all // fully-qualified proto message names, and returns a mapping from fully-qualified // name to OpenAPI name. func LookupNamingStrategy(strategyName string) func([]string) map[string]string { switch strings.ToLower(strategyName) { case "fqn": return resolveNamesFQN case "legacy": return resolveNamesLegacy case "simple": return resolveNamesSimple } return nil } // resolveNamesFQN uses the fully-qualified proto message name as the // OpenAPI name, stripping the leading dot. func resolveNamesFQN(messages []string) map[string]string { uniqueNames := make(map[string]string, len(messages)) for _, p := range messages { // strip leading dot from proto fqn uniqueNames[p] = p[1:] } return uniqueNames } // resolveNamesLegacy takes the names of all proto messages and generates unique references by // applying the legacy heuristics for deriving unique names: starting from the bottom of the name hierarchy, it // determines the minimum number of components necessary to yield a unique name, adds one // to that number, and then concatenates those last components with no separator in between // to form a unique name. // // E.g., if the fully qualified name is `.a.b.C.D`, and there are other messages with fully // qualified names ending in `.D` but not in `.C.D`, it assigns the unique name `bCD`. func resolveNamesLegacy(messages []string) map[string]string { return resolveNamesUniqueWithContext(messages, 1, "") } // resolveNamesSimple takes the names of all proto messages and generates unique references by using a simple // heuristic: starting from the bottom of the name hierarchy, it determines the minimum // number of components necessary to yield a unique name, and then concatenates those last // components with a "." separator in between to form a unique name. // // E.g., if the fully qualified name is `.a.b.C.D`, and there are other messages with // fully qualified names ending in `.D` but not in `.C.D`, it assigns the unique name `C.D`. func resolveNamesSimple(messages []string) map[string]string { return resolveNamesUniqueWithContext(messages, 0, ".") } // Take the names of every proto message and generates a unique reference by: // first, separating each message name into its components by splitting at dots. Then, // take the shortest suffix slice from each components slice that is unique among all // messages, and convert it into a component name by taking extraContext additional // components into consideration and joining all components with componentSeparator. func resolveNamesUniqueWithContext(messages []string, extraContext int, componentSeparator string) map[string]string { packagesByDepth := make(map[int][][]string) uniqueNames := make(map[string]string) hierarchy := func(pkg string) []string { return strings.Split(pkg, ".") } for _, p := range messages { h := hierarchy(p) for depth := range h { if _, ok := packagesByDepth[depth]; !ok { packagesByDepth[depth] = make([][]string, 0) } packagesByDepth[depth] = append(packagesByDepth[depth], h[len(h)-depth:]) } } count := func(list [][]string, item []string) int { i := 0 for _, element := range list { if reflect.DeepEqual(element, item) { i++ } } return i } for _, p := range messages { h := hierarchy(p) depth := 0 for ; depth < len(h); depth++ { // depth + extraContext > 0 ensures that we only break for values of depth when the // resulting slice of name components is non-empty. Otherwise, we would return the // empty string as the concise unique name is len(messages) == 1 (which is // technically correct). if depth+extraContext > 0 && count(packagesByDepth[depth], h[len(h)-depth:]) == 1 { break } } start := len(h) - depth - extraContext if start < 0 { start = 0 } uniqueNames[p] = strings.Join(h[start:], componentSeparator) } return uniqueNames } naming_test.go000066400000000000000000000031131465037340600343610ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import "testing" func TestNaming(t *testing.T) { type expectedNames struct { fqn, legacy, simple string } messageNameToExpected := map[string]expectedNames{ ".A": {"A", "A", "A"}, ".a.B.C": {"a.B.C", "aBC", "B.C"}, ".a.D.C": {"a.D.C", "aDC", "D.C"}, ".a.E.F": {"a.E.F", "aEF", "a.E.F"}, ".b.E.F": {"b.E.F", "bEF", "b.E.F"}, ".c.G.H": {"c.G.H", "GH", "H"}, } allMessageNames := make([]string, 0, len(messageNameToExpected)) for msgName := range messageNameToExpected { allMessageNames = append(allMessageNames, msgName) } t.Run("fqn", func(t *testing.T) { uniqueNames := resolveNamesFQN(allMessageNames) for _, msgName := range allMessageNames { expected := messageNameToExpected[msgName].fqn actual := uniqueNames[msgName] if expected != actual { t.Errorf("fqn unique name %q does not match expected name %q", actual, expected) } } }) t.Run("legacy", func(t *testing.T) { uniqueNames := resolveNamesLegacy(allMessageNames) for _, msgName := range allMessageNames { expected := messageNameToExpected[msgName].legacy actual := uniqueNames[msgName] if expected != actual { t.Errorf("legacy unique name %q does not match expected name %q", actual, expected) } } }) t.Run("simple", func(t *testing.T) { uniqueNames := resolveNamesSimple(allMessageNames) for _, msgName := range allMessageNames { expected := messageNameToExpected[msgName].simple actual := uniqueNames[msgName] if expected != actual { t.Errorf("simple unique name %q does not match expected name %q", actual, expected) } } }) } template.go000066400000000000000000003202611465037340600336720ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "bytes" "errors" "fmt" "math" "net/textproto" "os" "reflect" "regexp" "sort" "strconv" "strings" "sync" "text/template" "time" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" openapi_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/genproto/googleapis/api/visibility" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/known/structpb" ) // The OpenAPI specification does not allow for more than one endpoint with the same HTTP method and path. // This prevents multiple gRPC service methods from sharing the same stripped version of the path and method. // For example: `GET /v1/{name=organizations/*}/roles` and `GET /v1/{name=users/*}/roles` both get stripped to `GET /v1/{name}/roles`. // We must make the URL unique by adding a suffix and an incrementing index to each path parameter // to differentiate the endpoints. // Since path parameter names do not affect the request contents (i.e. they're replaced in the path) // this will be hidden from the real grpc gateway consumer. const pathParamUniqueSuffixDeliminator = "_" const paragraphDeliminator = "\n\n" // wktSchemas are the schemas of well-known-types. // The schemas must match with the behavior of the JSON unmarshaler in // https://github.com/protocolbuffers/protobuf-go/blob/v1.25.0/encoding/protojson/well_known_types.go var wktSchemas = map[string]schemaCore{ ".google.protobuf.FieldMask": { Type: "string", }, ".google.protobuf.Timestamp": { Type: "string", Format: "date-time", }, ".google.protobuf.Duration": { Type: "string", }, ".google.protobuf.StringValue": { Type: "string", }, ".google.protobuf.BytesValue": { Type: "string", Format: "byte", }, ".google.protobuf.Int32Value": { Type: "integer", Format: "int32", }, ".google.protobuf.UInt32Value": { Type: "integer", Format: "int64", }, ".google.protobuf.Int64Value": { Type: "string", Format: "int64", }, ".google.protobuf.UInt64Value": { Type: "string", Format: "uint64", }, ".google.protobuf.FloatValue": { Type: "number", Format: "float", }, ".google.protobuf.DoubleValue": { Type: "number", Format: "double", }, ".google.protobuf.BoolValue": { Type: "boolean", }, ".google.protobuf.Empty": { Type: "object", }, ".google.protobuf.Struct": { Type: "object", }, ".google.protobuf.Value": {}, ".google.protobuf.ListValue": { Type: "array", Items: (*openapiItemsObject)(&openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }}), }, ".google.protobuf.NullValue": { Type: "string", }, } func listEnumNames(reg *descriptor.Registry, enum *descriptor.Enum) interface{} { var names []string for _, value := range enum.GetValue() { if !isVisible(getEnumValueVisibilityOption(value), reg) { continue } if reg.GetOmitEnumDefaultValue() && value.GetNumber() == 0 { continue } names = append(names, value.GetName()) } if len(names) > 0 { return names } return nil } func listEnumNumbers(reg *descriptor.Registry, enum *descriptor.Enum) interface{} { var numbers []int for _, value := range enum.GetValue() { if reg.GetOmitEnumDefaultValue() && value.GetNumber() == 0 { continue } if !isVisible(getEnumValueVisibilityOption(value), reg) { continue } numbers = append(numbers, int(value.GetNumber())) } if len(numbers) > 0 { return numbers } return nil } func getEnumDefault(reg *descriptor.Registry, enum *descriptor.Enum) interface{} { if !reg.GetOmitEnumDefaultValue() { for _, value := range enum.GetValue() { if value.GetNumber() == 0 { return value.GetName() } } } return nil } func getEnumDefaultNumber(reg *descriptor.Registry, enum *descriptor.Enum) interface{} { if !reg.GetOmitEnumDefaultValue() { for _, value := range enum.GetValue() { if value.GetNumber() == 0 { return int(value.GetNumber()) } } } return nil } // messageToQueryParameters converts a message to a list of OpenAPI query parameters. func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter, body *descriptor.Body, httpMethod string) (params []openapiParameterObject, err error) { for _, field := range message.Fields { // When body is set to oneof field, we want to skip other fields in the oneof group. if isBodySameOneOf(body, field) { continue } if !isVisible(getFieldVisibilityOption(field), reg) { continue } if reg.GetAllowPatchFeature() && field.GetTypeName() == ".google.protobuf.FieldMask" && field.GetName() == "update_mask" && httpMethod == "PATCH" && len(body.FieldPath) != 0 { continue } p, err := queryParams(message, field, "", reg, pathParams, body, reg.GetRecursiveDepth()) if err != nil { return nil, err } params = append(params, p...) } return params, nil } func isBodySameOneOf(body *descriptor.Body, field *descriptor.Field) bool { if field.OneofIndex == nil { return false } if body == nil || len(body.FieldPath) == 0 { return false } if body.FieldPath[0].Target.OneofIndex == nil { return false } return *body.FieldPath[0].Target.OneofIndex == *field.OneofIndex } // queryParams converts a field to a list of OpenAPI query parameters recursively through the use of nestedQueryParams. func queryParams(message *descriptor.Message, field *descriptor.Field, prefix string, reg *descriptor.Registry, pathParams []descriptor.Parameter, body *descriptor.Body, recursiveCount int) (params []openapiParameterObject, err error) { return nestedQueryParams(message, field, prefix, reg, pathParams, body, newCycleChecker(recursiveCount)) } type cycleChecker struct { m map[string]int count int } func newCycleChecker(recursive int) *cycleChecker { return &cycleChecker{ m: make(map[string]int), count: recursive, } } // Check returns whether name is still within recursion // toleration func (c *cycleChecker) Check(name string) bool { count, ok := c.m[name] count += 1 isCycle := count > c.count if isCycle { return false } // provision map entry if not available if !ok { c.m[name] = 1 return true } c.m[name] = count return true } func (c *cycleChecker) Branch() *cycleChecker { copy := &cycleChecker{ count: c.count, m: make(map[string]int, len(c.m)), } for k, v := range c.m { copy.m[k] = v } return copy } // nestedQueryParams converts a field to a list of OpenAPI query parameters recursively. // This function is a helper function for queryParams, that keeps track of cyclical message references // through the use of // // touched map[string]int // // If a cycle is discovered, an error is returned, as cyclical data structures are dangerous // in query parameters. func nestedQueryParams(message *descriptor.Message, field *descriptor.Field, prefix string, reg *descriptor.Registry, pathParams []descriptor.Parameter, body *descriptor.Body, cycle *cycleChecker) (params []openapiParameterObject, err error) { // make sure the parameter is not already listed as a path parameter for _, pathParam := range pathParams { if pathParam.Target == field { return nil, nil } } // make sure the parameter is not already listed as a body parameter if body != nil { if body.FieldPath == nil { return nil, nil } for _, fieldPath := range body.FieldPath { if fieldPath.Target == field { return nil, nil } } } schema := schemaOfField(field, reg, nil) fieldType := field.GetTypeName() if message.File != nil { comments := fieldProtoComments(reg, message, field) if err := updateOpenAPIDataFromComments(reg, &schema, message, comments, false); err != nil { return nil, err } } isEnum := field.GetType() == descriptorpb.FieldDescriptorProto_TYPE_ENUM items := schema.Items if schema.Type != "" || isEnum { if schema.Type == "object" { location := "" if ix := strings.LastIndex(field.Message.FQMN(), "."); ix > 0 { location = field.Message.FQMN()[0:ix] } if m, err := reg.LookupMsg(location, field.GetTypeName()); err == nil { if opt := m.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { k := m.GetField()[0] kType, err := getMapParamKey(k.GetType()) if err != nil { return nil, err } // This will generate a query in the format map_name[key_type] fName := fmt.Sprintf("%s[%s]", *field.Name, kType) field.Name = proto.String(fName) schema.Type = schema.AdditionalProperties.schemaCore.Type schema.Description = `This is a request variable of the map type. The query format is "map_name[key]=value", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age["bob"]=18` } } } if items != nil && (items.Type == "" || items.Type == "object") && !isEnum { return nil, nil // TODO: currently, mapping object in query parameter is not supported } desc := mergeDescription(schema) // verify if the field is required required := false for _, fieldName := range schema.Required { if fieldName == reg.FieldName(field) { required = true break } } // verify if the field is required in message options if messageSchema, err := extractSchemaOptionFromMessageDescriptor(message.DescriptorProto); err == nil { for _, fieldName := range messageSchema.GetJsonSchema().GetRequired() { // Required fields can be field names or json_name values if fieldName == field.GetJsonName() || fieldName == field.GetName() { required = true break } } } param := openapiParameterObject{ Description: desc, In: "query", Default: schema.Default, Type: schema.Type, Items: schema.Items, Format: schema.Format, Pattern: schema.Pattern, Required: required, extensions: schema.extensions, Enum: schema.Enum, } if param.Type == "array" { param.CollectionFormat = "multi" } param.Name = prefix + reg.FieldName(field) if isEnum { enum, err := reg.LookupEnum("", fieldType) if err != nil { return nil, fmt.Errorf("unknown enum type %s", fieldType) } if items != nil { // array param.Items = &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", Enum: listEnumNames(reg, enum), }, } if reg.GetEnumsAsInts() { param.Items.Type = "integer" param.Items.Enum = listEnumNumbers(reg, enum) } } else { param.Type = "string" param.Enum = listEnumNames(reg, enum) param.Default = getEnumDefault(reg, enum) if reg.GetEnumsAsInts() { param.Type = "integer" param.Enum = listEnumNumbers(reg, enum) param.Default = getEnumDefaultNumber(reg, enum) } } valueComments := enumValueProtoComments(reg, enum) if valueComments != "" { param.Description = strings.TrimLeft(param.Description+"\n\n "+valueComments, "\n") } } return []openapiParameterObject{param}, nil } // nested type, recurse msg, err := reg.LookupMsg("", fieldType) if err != nil { return nil, fmt.Errorf("unknown message type %s", fieldType) } // Check for cyclical message reference: if ok := cycle.Check(*msg.Name); !ok { return nil, fmt.Errorf("exceeded recursive count (%d) for query parameter %q", cycle.count, fieldType) } // Construct a new map with the message name so a cycle further down the recursive path can be detected. // Do not keep anything in the original touched reference and do not pass that reference along. This will // prevent clobbering adjacent records while recursing. touchedOut := cycle.Branch() for _, nestedField := range msg.Fields { if !isVisible(getFieldVisibilityOption(nestedField), reg) { continue } fieldName := reg.FieldName(field) p, err := nestedQueryParams(msg, nestedField, prefix+fieldName+".", reg, pathParams, body, touchedOut) if err != nil { return nil, err } params = append(params, p...) } return params, nil } func getMapParamKey(t descriptorpb.FieldDescriptorProto_Type) (string, error) { tType, f, ok := primitiveSchema(t) if !ok || f == "byte" || f == "float" || f == "double" { return "", fmt.Errorf("unsupported type: %q", f) } return tType, nil } // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, ms messageMap, e enumMap, refs refMap) { for _, svc := range s { if !isVisible(getServiceVisibilityOption(svc), reg) { continue } for _, meth := range svc.Methods { // Request may be fully included in query { if !isVisible(getMethodVisibilityOption(meth), reg) { continue } swgReqName, ok := fullyQualifiedNameToOpenAPIName(meth.RequestType.FQMN(), reg) if !ok { grpclog.Errorf("couldn't resolve OpenAPI name for FQMN %q", meth.RequestType.FQMN()) continue } if _, ok := refs[fmt.Sprintf("#/definitions/%s", swgReqName)]; ok { if !skipRenderingRef(meth.RequestType.FQMN()) { m[swgReqName] = meth.RequestType } } } swgRspName, ok := fullyQualifiedNameToOpenAPIName(meth.ResponseType.FQMN(), reg) if !ok && !skipRenderingRef(meth.ResponseType.FQMN()) { grpclog.Errorf("couldn't resolve OpenAPI name for FQMN %q", meth.ResponseType.FQMN()) continue } findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) if !skipRenderingRef(meth.ResponseType.FQMN()) { m[swgRspName] = meth.ResponseType } findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) } } } // findNestedMessagesAndEnumerations those can be generated by the services. func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descriptor.Registry, m messageMap, e enumMap) { // Iterate over all the fields that for _, t := range message.Fields { if !isVisible(getFieldVisibilityOption(t), reg) { continue } fieldType := t.GetTypeName() // If the type is an empty string then it is a proto primitive if fieldType != "" { if _, ok := m[fieldType]; !ok { msg, err := reg.LookupMsg("", fieldType) if err != nil { enum, err := reg.LookupEnum("", fieldType) if err != nil { panic(err) } e[fieldType] = enum continue } m[fieldType] = msg findNestedMessagesAndEnumerations(msg, reg, m, e) } } } } func skipRenderingRef(refName string) bool { _, ok := wktSchemas[refName] return ok } func renderMessageAsDefinition(msg *descriptor.Message, reg *descriptor.Registry, customRefs refMap, pathParams []descriptor.Parameter) (openapiSchemaObject, error) { schema := openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) if err := updateOpenAPIDataFromComments(reg, &schema, msg, msgComments, false); err != nil { return openapiSchemaObject{}, err } opts, err := getMessageOpenAPIOption(reg, msg) if err != nil { return openapiSchemaObject{}, err } if opts != nil { protoSchema := openapiSchemaFromProtoSchema(opts, reg, customRefs, msg) // Warning: Make sure not to overwrite any fields already set on the schema type. schema.ExternalDocs = protoSchema.ExternalDocs schema.ReadOnly = protoSchema.ReadOnly schema.MultipleOf = protoSchema.MultipleOf schema.Maximum = protoSchema.Maximum schema.ExclusiveMaximum = protoSchema.ExclusiveMaximum schema.Minimum = protoSchema.Minimum schema.ExclusiveMinimum = protoSchema.ExclusiveMinimum schema.MaxLength = protoSchema.MaxLength schema.MinLength = protoSchema.MinLength schema.Pattern = protoSchema.Pattern schema.Default = protoSchema.Default schema.MaxItems = protoSchema.MaxItems schema.MinItems = protoSchema.MinItems schema.UniqueItems = protoSchema.UniqueItems schema.MaxProperties = protoSchema.MaxProperties schema.MinProperties = protoSchema.MinProperties schema.Required = protoSchema.Required schema.XNullable = protoSchema.XNullable schema.extensions = protoSchema.extensions if protoSchema.schemaCore.Type != "" || protoSchema.schemaCore.Ref != "" { schema.schemaCore = protoSchema.schemaCore } if protoSchema.Title != "" { schema.Title = protoSchema.Title } if protoSchema.Description != "" { schema.Description = protoSchema.Description } if protoSchema.Example != nil { schema.Example = protoSchema.Example } } schema.Required = filterOutExcludedFields(schema.Required, pathParams) for _, f := range msg.Fields { if !isVisible(getFieldVisibilityOption(f), reg) { continue } if shouldExcludeField(f.GetName(), pathParams) { continue } subPathParams := subPathParams(f.GetName(), pathParams) fieldSchema, err := renderFieldAsDefinition(f, reg, customRefs, subPathParams) if err != nil { return openapiSchemaObject{}, err } comments := fieldProtoComments(reg, msg, f) if err := updateOpenAPIDataFromComments(reg, &fieldSchema, f, comments, false); err != nil { return openapiSchemaObject{}, err } if requiredIdx := find(schema.Required, *f.Name); requiredIdx != -1 && reg.GetUseJSONNamesForFields() { schema.Required[requiredIdx] = f.GetJsonName() } if fieldSchema.Required != nil { schema.Required = getUniqueFields(schema.Required, fieldSchema.Required) schema.Required = append(schema.Required, fieldSchema.Required...) // To avoid populating both the field schema require and message schema require, unset the field schema require. // See issue #2635. fieldSchema.Required = nil } if reg.GetUseAllOfForRefs() { if fieldSchema.Ref != "" { // Per the JSON Reference syntax: Any members other than "$ref" in a JSON Reference object SHALL be ignored. // https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3 // However, use allOf to specify Title/Description/Example/readOnly fields. if fieldSchema.Title != "" || fieldSchema.Description != "" || len(fieldSchema.Example) > 0 || fieldSchema.ReadOnly { fieldSchema = openapiSchemaObject{ Title: fieldSchema.Title, Description: fieldSchema.Description, schemaCore: schemaCore{ Example: fieldSchema.Example, }, ReadOnly: fieldSchema.ReadOnly, AllOf: []allOfEntry{{Ref: fieldSchema.Ref}}, } } else { fieldSchema = openapiSchemaObject{schemaCore: schemaCore{Ref: fieldSchema.Ref}} } } } kv := keyVal{Value: fieldSchema} kv.Key = reg.FieldName(f) if schema.Properties == nil { schema.Properties = &openapiSchemaObjectProperties{} } *schema.Properties = append(*schema.Properties, kv) } if msg.FQMN() == ".google.protobuf.Any" { transformAnyForJSON(&schema, reg.GetUseJSONNamesForFields()) } return schema, nil } func renderFieldAsDefinition(f *descriptor.Field, reg *descriptor.Registry, refs refMap, pathParams []descriptor.Parameter) (openapiSchemaObject, error) { if len(pathParams) == 0 { return schemaOfField(f, reg, refs), nil } location := "" if ix := strings.LastIndex(f.Message.FQMN(), "."); ix > 0 { location = f.Message.FQMN()[0:ix] } msg, err := reg.LookupMsg(location, f.GetTypeName()) if err != nil { return openapiSchemaObject{}, err } schema, err := renderMessageAsDefinition(msg, reg, refs, pathParams) if err != nil { return openapiSchemaObject{}, err } comments := fieldProtoComments(reg, f.Message, f) if len(comments) > 0 { // Use title and description from field instead of nested message if present. paragraphs := strings.Split(comments, paragraphDeliminator) schema.Title = strings.TrimSpace(paragraphs[0]) schema.Description = strings.TrimSpace(strings.Join(paragraphs[1:], paragraphDeliminator)) } return schema, nil } // transformAnyForJSON should be called when the schema object represents a google.protobuf.Any, and will replace the // Properties slice with a single value for '@type'. We mutate the incorrectly named field so that we inherit the same // documentation as specified on the original field in the protobuf descriptors. func transformAnyForJSON(schema *openapiSchemaObject, useJSONNames bool) { var typeFieldName string if useJSONNames { typeFieldName = "typeUrl" } else { typeFieldName = "type_url" } for _, property := range *schema.Properties { if property.Key == typeFieldName { schema.AdditionalProperties = &openapiSchemaObject{} schema.Properties = &openapiSchemaObjectProperties{keyVal{ Key: "@type", Value: property.Value, }} break } } } func renderMessagesAsDefinition(messages messageMap, d openapiDefinitionsObject, reg *descriptor.Registry, customRefs refMap, pathParams []descriptor.Parameter) error { for name, msg := range messages { swgName, ok := fullyQualifiedNameToOpenAPIName(msg.FQMN(), reg) if !ok { return fmt.Errorf("can't resolve OpenAPI name from %q", msg.FQMN()) } if skipRenderingRef(name) { continue } if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue } var err error d[swgName], err = renderMessageAsDefinition(msg, reg, customRefs, pathParams) if err != nil { return err } } return nil } // isVisible checks if a field/RPC is visible based on the visibility restriction // combined with the `visibility_restriction_selectors`. // Elements with an overlap on `visibility_restriction_selectors` are visible, those without are not visible. // Elements without `google.api.VisibilityRule` annotations entirely are always visible. func isVisible(r *visibility.VisibilityRule, reg *descriptor.Registry) bool { if r == nil { return true } restrictions := strings.Split(strings.TrimSpace(r.Restriction), ",") // No restrictions results in the element always being visible if len(restrictions) == 0 { return true } for _, restriction := range restrictions { if reg.GetVisibilityRestrictionSelectors()[strings.TrimSpace(restriction)] { return true } } return false } func shouldExcludeField(name string, excluded []descriptor.Parameter) bool { for _, p := range excluded { if len(p.FieldPath) == 1 && name == p.FieldPath[0].Name { return true } } return false } func filterOutExcludedFields(fields []string, excluded []descriptor.Parameter) []string { var filtered []string for _, f := range fields { if !shouldExcludeField(f, excluded) { filtered = append(filtered, f) } } return filtered } // schemaOfField returns a OpenAPI Schema Object for a protobuf field. func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) openapiSchemaObject { const ( singular = 0 array = 1 object = 2 ) var ( core schemaCore aggregate int ) fd := f.FieldDescriptorProto location := "" if ix := strings.LastIndex(f.Message.FQMN(), "."); ix > 0 { location = f.Message.FQMN()[0:ix] } if m, err := reg.LookupMsg(location, f.GetTypeName()); err == nil { if opt := m.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { fd = m.GetField()[1] aggregate = object } } if fd.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REPEATED { aggregate = array } var props *openapiSchemaObjectProperties switch ft := fd.GetType(); ft { case descriptorpb.FieldDescriptorProto_TYPE_ENUM, descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, descriptorpb.FieldDescriptorProto_TYPE_GROUP: if wktSchema, ok := wktSchemas[fd.GetTypeName()]; ok { core = wktSchema if fd.GetTypeName() == ".google.protobuf.Empty" { props = &openapiSchemaObjectProperties{} } } else { swgRef, ok := fullyQualifiedNameToOpenAPIName(fd.GetTypeName(), reg) if !ok { panic(fmt.Sprintf("can't resolve OpenAPI ref from typename %q", fd.GetTypeName())) } core = schemaCore{ Ref: "#/definitions/" + swgRef, } if refs != nil { refs[fd.GetTypeName()] = struct{}{} } } default: ftype, format, ok := primitiveSchema(ft) if ok { core = schemaCore{Type: ftype, Format: format} } else { core = schemaCore{Type: ft.String(), Format: "UNKNOWN"} } } ret := openapiSchemaObject{} switch aggregate { case array: if _, ok := wktSchemas[fd.GetTypeName()]; !ok && fd.GetType() == descriptorpb.FieldDescriptorProto_TYPE_MESSAGE { core.Type = "object" } ret = openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: (*openapiItemsObject)(&openapiSchemaObject{schemaCore: core}), }, } case object: ret = openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, AdditionalProperties: &openapiSchemaObject{Properties: props, schemaCore: core}, } default: ret = openapiSchemaObject{ schemaCore: core, Properties: props, } } if j, err := getFieldOpenAPIOption(reg, f); err == nil { updateswaggerObjectFromJSONSchema(&ret, j, reg, f) } if j, err := getFieldBehaviorOption(reg, f); err == nil { updateSwaggerObjectFromFieldBehavior(&ret, j, reg, f) } for i, required := range ret.Required { if required == f.GetName() { ret.Required[i] = reg.FieldName(f) } } if reg.GetProto3OptionalNullable() && f.GetProto3Optional() { ret.XNullable = true } return ret } // primitiveSchema returns a pair of "Type" and "Format" in JSON Schema for // the given primitive field type. // The last return parameter is true iff the field type is actually primitive. func primitiveSchema(t descriptorpb.FieldDescriptorProto_Type) (ftype, format string, ok bool) { switch t { case descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: return "number", "double", true case descriptorpb.FieldDescriptorProto_TYPE_FLOAT: return "number", "float", true case descriptorpb.FieldDescriptorProto_TYPE_INT64: return "string", "int64", true case descriptorpb.FieldDescriptorProto_TYPE_UINT64: // 64bit integer types are marshaled as string in the default JSONPb marshaler. // TODO(yugui) Add an option to declare 64bit integers as int64. // // NOTE: uint64 is not a predefined format of integer type in OpenAPI spec. // So we cannot expect that uint64 is commonly supported by OpenAPI processor. return "string", "uint64", true case descriptorpb.FieldDescriptorProto_TYPE_INT32: return "integer", "int32", true case descriptorpb.FieldDescriptorProto_TYPE_FIXED64: // Ditto. return "string", "uint64", true case descriptorpb.FieldDescriptorProto_TYPE_FIXED32: // Ditto. return "integer", "int64", true case descriptorpb.FieldDescriptorProto_TYPE_BOOL: // NOTE: in OpenAPI specification, format should be empty on boolean type return "boolean", "", true case descriptorpb.FieldDescriptorProto_TYPE_STRING: // NOTE: in OpenAPI specification, can be empty on string type // see: https://swagger.io/specification/v2/#data-types return "string", "", true case descriptorpb.FieldDescriptorProto_TYPE_BYTES: return "string", "byte", true case descriptorpb.FieldDescriptorProto_TYPE_UINT32: // Ditto. return "integer", "int64", true case descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: return "integer", "int32", true case descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: return "string", "int64", true case descriptorpb.FieldDescriptorProto_TYPE_SINT32: return "integer", "int32", true case descriptorpb.FieldDescriptorProto_TYPE_SINT64: return "string", "int64", true default: return "", "", false } } // renderEnumerationsAsDefinition inserts enums into the definitions object. func renderEnumerationsAsDefinition(enums enumMap, d openapiDefinitionsObject, reg *descriptor.Registry) { for _, enum := range enums { swgName, ok := fullyQualifiedNameToOpenAPIName(enum.FQEN(), reg) if !ok { panic(fmt.Sprintf("can't resolve OpenAPI name from FQEN %q", enum.FQEN())) } enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) // it may be necessary to sort the result of the GetValue function. enumNames := listEnumNames(reg, enum) defaultValue := getEnumDefault(reg, enum) valueComments := enumValueProtoComments(reg, enum) if valueComments != "" { enumComments = strings.TrimLeft(enumComments+"\n\n "+valueComments, "\n") } enumSchemaObject := openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Enum: enumNames, Default: defaultValue, }, } if reg.GetEnumsAsInts() { enumSchemaObject.Type = "integer" enumSchemaObject.Format = "int32" enumSchemaObject.Default = getEnumDefaultNumber(reg, enum) enumSchemaObject.Enum = listEnumNumbers(reg, enum) } if err := updateOpenAPIDataFromComments(reg, &enumSchemaObject, enum, enumComments, false); err != nil { panic(err) } d[swgName] = enumSchemaObject } } // Take in a FQMN or FQEN and return a OpenAPI safe version of the FQMN and // a boolean indicating if FQMN was properly resolved. func fullyQualifiedNameToOpenAPIName(fqn string, reg *descriptor.Registry) (string, bool) { registriesSeenMutex.Lock() defer registriesSeenMutex.Unlock() if mapping, present := registriesSeen[reg]; present { ret, ok := mapping[fqn] return ret, ok } mapping := resolveFullyQualifiedNameToOpenAPINames(append(reg.GetAllFQMNs(), append(reg.GetAllFQENs(), reg.GetAllFQMethNs()...)...), reg.GetOpenAPINamingStrategy()) registriesSeen[reg] = mapping ret, ok := mapping[fqn] return ret, ok } // Lookup message type by location.name and return a openapiv2-safe version // of its FQMN. func lookupMsgAndOpenAPIName(location, name string, reg *descriptor.Registry) (*descriptor.Message, string, error) { msg, err := reg.LookupMsg(location, name) if err != nil { return nil, "", err } swgName, ok := fullyQualifiedNameToOpenAPIName(msg.FQMN(), reg) if !ok { return nil, "", fmt.Errorf("can't map OpenAPI name from FQMN %q", msg.FQMN()) } return msg, swgName, nil } // registriesSeen is used to memoise calls to resolveFullyQualifiedNameToOpenAPINames so // we don't repeat it unnecessarily, since it can take some time. var registriesSeen = map[*descriptor.Registry]map[string]string{} var registriesSeenMutex sync.Mutex // Take the names of every proto message and generate a unique reference for each, according to the given strategy. func resolveFullyQualifiedNameToOpenAPINames(messages []string, namingStrategy string) map[string]string { strategyFn := LookupNamingStrategy(namingStrategy) if strategyFn == nil { return nil } return strategyFn(messages) } var canRegexp = regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*)([^}]*)}") // templateToParts will split a URL template as defined by https://github.com/googleapis/googleapis/blob/master/google/api/http.proto // into a string slice with each part as an element of the slice for use by `partsToOpenAPIPath` and `partsToRegexpMap`. func templateToParts(path string, reg *descriptor.Registry, fields []*descriptor.Field, msgs []*descriptor.Message) []string { // It seems like the right thing to do here is to just use // strings.Split(path, "/") but that breaks badly when you hit a url like // /{my_field=prefix/*}/ and end up with 2 sections representing my_field. // Instead do the right thing and write a small pushdown (counter) automata // for it. var parts []string depth := 0 buffer := "" jsonBuffer := "" pathLoop: for i, char := range path { switch char { case '{': // Push on the stack depth++ buffer += string(char) jsonBuffer = "" jsonBuffer += string(char) case '}': if depth == 0 { panic("Encountered } without matching { before it.") } // Pop from the stack depth-- buffer += string(char) if reg.GetUseJSONNamesForFields() && len(jsonBuffer) > 1 { jsonSnakeCaseName := jsonBuffer[1:] jsonCamelCaseName := lowerCamelCase(jsonSnakeCaseName, fields, msgs) prev := buffer[:len(buffer)-len(jsonSnakeCaseName)-2] buffer = strings.Join([]string{prev, "{", jsonCamelCaseName, "}"}, "") jsonBuffer = "" } case '/': if depth == 0 { parts = append(parts, buffer) buffer = "" // Since the stack was empty when we hit the '/' we are done with this // section. continue } buffer += string(char) jsonBuffer += string(char) case ':': if depth == 0 { // As soon as we find a ":" outside a variable, // everything following is a verb parts = append(parts, buffer) buffer = path[i:] break pathLoop } buffer += string(char) jsonBuffer += string(char) default: buffer += string(char) jsonBuffer += string(char) } } // Now append the last element to parts parts = append(parts, buffer) return parts } // partsToOpenAPIPath converts each path part of the form /path/{string_value=strprefix/*} which is defined in // https://github.com/googleapis/googleapis/blob/master/google/api/http.proto to the OpenAPI expected form /path/{string_value}. // For example this would replace the path segment of "{foo=bar/*}" with "{foo}" or "prefix{bang=bash/**}" with "prefix{bang}". // OpenAPI 2 only allows simple path parameters with the constraints on that parameter specified in the OpenAPI // schema's "pattern" instead of in the path parameter itself. func partsToOpenAPIPath(parts []string, overrides map[string]string) string { for index, part := range parts { part = canRegexp.ReplaceAllString(part, "{$1}") if override, ok := overrides[part]; ok { part = override } parts[index] = part } if last := len(parts) - 1; strings.HasPrefix(parts[last], ":") { // Last item is a verb (":" LITERAL). return strings.Join(parts[:last], "/") + parts[last] } return strings.Join(parts, "/") } // partsToRegexpMap returns a map of parameter name to ECMA 262 patterns // which is what the "pattern" field on an OpenAPI parameter expects. // See https://swagger.io/specification/v2/ (Parameter Object) and // https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. // The expression is generated based on expressions defined by https://github.com/googleapis/googleapis/blob/master/google/api/http.proto // "Path Template Syntax" section which allow for a "param_name=foobar/*/bang/**" style expressions inside // the path parameter placeholders that indicate constraints on the values of those parameters. // This function will scan the split parts of a path template for parameters and // outputs a map of the name of the parameter to a ECMA regular expression. See the http.proto file for descriptions // of the supported syntax. This function will ignore any path parameters that don't contain a "=" after the // parameter name. For supported parameters, we assume "*" represent all characters except "/" as it's // intended to match a single path element and we assume "**" matches any character as it's intended to match multiple // path elements. // For example "{name=organizations/*/roles/*}" would produce the regular expression for the "name" parameter of // "organizations/[^/]+/roles/[^/]+" or "{bar=bing/*/bang/**}" would produce the regular expression for the "bar" // parameter of "bing/[^/]+/bang/.+". // // Note that OpenAPI does not actually support path parameters with "/", see https://github.com/OAI/OpenAPI-Specification/issues/892 func partsToRegexpMap(parts []string) map[string]string { regExps := make(map[string]string) for _, part := range parts { if strings.Contains(part, "/") { grpclog.Warningf("Path parameter %q contains '/', which is not supported in OpenAPI", part) } if submatch := canRegexp.FindStringSubmatch(part); len(submatch) > 2 { if strings.HasPrefix(submatch[2], "=") { // this part matches the standard and should be made into a regular expression // assume the string's characters other than "**" and "*" are literals (not necessarily a good assumption 100% of the times, but it will support most use cases) regex := submatch[2][1:] regex = strings.ReplaceAll(regex, "**", ".+") // ** implies any character including "/" regex = strings.ReplaceAll(regex, "*", "[^/]+") // * implies any character except "/" regExps[submatch[1]] = regex } } } return regExps } func renderServiceTags(services []*descriptor.Service, reg *descriptor.Registry) []openapiTagObject { var tags []openapiTagObject for _, svc := range services { if !isVisible(getServiceVisibilityOption(svc), reg) { continue } tagName := svc.GetName() if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tagName = pkg + "." + tagName } tag := openapiTagObject{ Name: tagName, } opts, err := getServiceOpenAPIOption(reg, svc) if err != nil { grpclog.Error(err) return nil } if opts != nil { tag.Description = opts.Description if reg.GetUseGoTemplate() { tag.Description = goTemplateComments(tag.Description, svc, reg) } if opts.ExternalDocs != nil { tag.ExternalDocs = &openapiExternalDocumentationObject{ Description: opts.ExternalDocs.Description, URL: opts.ExternalDocs.Url, } if reg.GetUseGoTemplate() { tag.ExternalDocs.Description = goTemplateComments(opts.ExternalDocs.Description, svc, reg) } } if opts.GetName() != "" { tag.Name = opts.GetName() } } tags = append(tags, tag) } return tags } func renderServices(services []*descriptor.Service, paths *openapiPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap, msgs []*descriptor.Message, defs openapiDefinitionsObject) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. svcBaseIdx := 0 var lastFile *descriptor.File = nil for svcIdx, svc := range services { if svc.File != lastFile { lastFile = svc.File svcBaseIdx = svcIdx } if !isVisible(getServiceVisibilityOption(svc), reg) { continue } for methIdx, meth := range svc.Methods { if !isVisible(getMethodVisibilityOption(meth), reg) { continue } for bIdx, b := range meth.Bindings { operationFunc := operationForMethod(b.HTTPMethod) // Iterate over all the OpenAPI parameters parameters := openapiParametersObject{} // split the path template into its parts parts := templateToParts(b.PathTmpl.Template, reg, meth.RequestType.Fields, msgs) // extract any constraints specified in the path placeholders into ECMA regular expressions pathParamRegexpMap := partsToRegexpMap(parts) // Keep track of path parameter overrides var pathParamNames = make(map[string]string) for _, parameter := range b.PathParams { var paramType, paramFormat, desc, collectionFormat string var defaultValue interface{} var enumNames interface{} var items *openapiItemsObject var minItems *int var extensions []extension switch pt := parameter.Target.GetType(); pt { case descriptorpb.FieldDescriptorProto_TYPE_GROUP, descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: if descriptor.IsWellKnownType(parameter.Target.GetTypeName()) { if parameter.IsRepeated() { return errors.New("only primitive and enum types are allowed in repeated path parameters") } schema := schemaOfField(parameter.Target, reg, customRefs) paramType = schema.Type paramFormat = schema.Format desc = schema.Description defaultValue = schema.Default extensions = schema.extensions } else { return errors.New("only primitive and well-known types are allowed in path parameters") } case descriptorpb.FieldDescriptorProto_TYPE_ENUM: enum, err := reg.LookupEnum("", parameter.Target.GetTypeName()) if err != nil { return err } paramType = "string" paramFormat = "" enumNames = listEnumNames(reg, enum) if reg.GetEnumsAsInts() { paramType = "integer" paramFormat = "" enumNames = listEnumNumbers(reg, enum) } schema := schemaOfField(parameter.Target, reg, customRefs) desc = schema.Description defaultValue = schema.Default extensions = schema.extensions default: var ok bool paramType, paramFormat, ok = primitiveSchema(pt) if !ok { return fmt.Errorf("unknown field type %v", pt) } schema := schemaOfField(parameter.Target, reg, customRefs) desc = schema.Description defaultValue = schema.Default extensions = schema.extensions // If there is no mandatory format based on the field, // allow it to be overridden by the user if paramFormat == "" { paramFormat = schema.Format } } if parameter.IsRepeated() { core := schemaCore{Type: paramType, Format: paramFormat} if parameter.IsEnum() { core.Enum = enumNames enumNames = nil } items = (*openapiItemsObject)(&openapiSchemaObject{schemaCore: core}) paramType = "array" paramFormat = "" collectionFormat = reg.GetRepeatedPathParamSeparatorName() minItems = new(int) *minItems = 1 } if desc == "" { desc = fieldProtoComments(reg, parameter.Target.Message, parameter.Target) } parameterString := parameter.String() if reg.GetUseJSONNamesForFields() { parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields, msgs) } var pattern string if regExp, ok := pathParamRegexpMap[parameterString]; ok { pattern = regExp } if fc := getFieldConfiguration(reg, parameter.Target); fc != nil { pathParamName := fc.GetPathParamName() if pathParamName != "" && pathParamName != parameterString { pathParamNames["{"+parameterString+"}"] = "{" + pathParamName + "}" parameterString, _, _ = strings.Cut(pathParamName, "=") } } parameters = append(parameters, openapiParameterObject{ Name: parameterString, Description: desc, In: "path", Required: true, Default: defaultValue, // Parameters in gRPC-Gateway can only be strings? Type: paramType, Format: paramFormat, Enum: enumNames, Items: items, CollectionFormat: collectionFormat, MinItems: minItems, Pattern: pattern, extensions: extensions, }) } // Now check if there is a body parameter if b.Body != nil { // Recursively render fields as definitions as long as they contain path parameters. // Special case for top level body if we don't have a body field. var schema openapiSchemaObject desc := "" var bodyFieldName string schema = openapiSchemaObject{ schemaCore: schemaCore{}, } if len(b.Body.FieldPath) == 0 { // No field for body, use type. bodyFieldName = "body" wknSchemaCore, isWkn := wktSchemas[meth.RequestType.FQMN()] if isWkn { schema.schemaCore = wknSchemaCore // Special workaround for Empty: it's well-known type but wknSchemas only returns schema.schemaCore; but we need to set schema.Properties which is a level higher. if meth.RequestType.FQMN() == ".google.protobuf.Empty" { schema.Properties = &openapiSchemaObjectProperties{} } } else { messageSchema, err := renderMessageAsDefinition(meth.RequestType, reg, customRefs, b.PathParams) if err != nil { return err } if len(b.PathParams) == 0 { if err := schema.setRefFromFQN(meth.RequestType.FQMN(), reg); err != nil { return err } desc = messageSchema.Description } else { if meth.Name != nil { methFQN, ok := fullyQualifiedNameToOpenAPIName(meth.FQMN(), reg) if !ok { panic(fmt.Errorf("failed to resolve method FQN: '%s'", meth.FQMN())) } defName := methFQN + "Body" schema.Ref = fmt.Sprintf("#/definitions/%s", defName) defs[defName] = messageSchema } else { schema = messageSchema if schema.Properties == nil || len(*schema.Properties) == 0 { grpclog.Warningf("created a body with 0 properties in the message, this might be unintended: %s", *meth.RequestType) } } } } } else { // Body field path is limited to one path component. From google.api.HttpRule.body: // "NOTE: the referred field must be present at the top-level of the request message type." // Ref: https://github.com/googleapis/googleapis/blob/b3397f5febbf21dfc69b875ddabaf76bee765058/google/api/http.proto#L350-L352 if len(b.Body.FieldPath) > 1 { return fmt.Errorf("body of request %q is not a top level field: '%v'", meth.Service.GetName(), b.Body.FieldPath) } bodyField := b.Body.FieldPath[0] if reg.GetUseJSONNamesForFields() { bodyFieldName = lowerCamelCase(bodyField.Name, meth.RequestType.Fields, msgs) } else { bodyFieldName = bodyField.Name } // Align pathParams with body field path. pathParams := subPathParams(bodyField.Name, b.PathParams) var err error schema, err = renderFieldAsDefinition(bodyField.Target, reg, customRefs, pathParams) if err != nil { return err } if schema.Title != "" { desc = mergeDescription(schema) } else { desc = fieldProtoComments(reg, bodyField.Target.Message, bodyField.Target) } } if meth.GetClientStreaming() { desc += " (streaming inputs)" } parameters = append(parameters, openapiParameterObject{ Name: bodyFieldName, Description: desc, In: "body", Required: true, Schema: &schema, }) } // add the parameters to the query string queryParams, err := messageToQueryParameters(meth.RequestType, reg, b.PathParams, b.Body, b.HTTPMethod) if err != nil { return err } parameters = append(parameters, queryParams...) path := partsToOpenAPIPath(parts, pathParamNames) pathItemObject, ok := getPathItemObject(*paths, path) if !ok { pathItemObject = openapiPathItemObject{} } else { // handle case where we have an existing mapping for the same path and method existingOperationObject := operationFunc(&pathItemObject) if existingOperationObject != nil { var firstPathParameter *openapiParameterObject var firstParamIndex int for index, param := range parameters { param := param if param.In == "path" { firstPathParameter = ¶m firstParamIndex = index break } } if firstPathParameter == nil { // Without a path parameter, there is nothing to vary to support multiple mappings of the same path/method. // Previously this did not log an error and only overwrote the mapping, we now log the error but // still overwrite the mapping grpclog.Errorf("Duplicate mapping for path %s %s", b.HTTPMethod, path) } else { newPathCount := 0 var newPath string var newPathElement string // Iterate until there is not an existing operation that matches the same escaped path. // Most of the time this will only be a single iteration, but a large API could technically have // a pretty large amount of these if it used similar patterns for all its functions. for existingOperationObject != nil { newPathCount += 1 newPathElement = firstPathParameter.Name + pathParamUniqueSuffixDeliminator + strconv.Itoa(newPathCount) newPath = strings.ReplaceAll(path, "{"+firstPathParameter.Name+"}", "{"+newPathElement+"}") if newPathItemObject, ok := getPathItemObject(*paths, newPath); ok { existingOperationObject = operationFunc(&newPathItemObject) } else { existingOperationObject = nil } } // update the pathItemObject we are adding to with the new path pathItemObject, _ = getPathItemObject(*paths, newPath) firstPathParameter.Name = newPathElement path = newPath parameters[firstParamIndex] = *firstPathParameter } } } methProtoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.ServiceDescriptorProto)(nil)), "Method") desc := "A successful response." var responseSchema openapiSchemaObject if b.ResponseBody == nil || len(b.ResponseBody.FieldPath) == 0 { responseSchema = openapiSchemaObject{ schemaCore: schemaCore{}, } // Don't link to a full definition for // empty; it's overly verbose. // schema.Properties{} renders it as // well, without a definition wknSchemaCore, isWkn := wktSchemas[meth.ResponseType.FQMN()] if !isWkn { if err := responseSchema.setRefFromFQN(meth.ResponseType.FQMN(), reg); err != nil { return err } } else { responseSchema.schemaCore = wknSchemaCore // Special workaround for Empty: it's well-known type but wknSchemas only returns schema.schemaCore; but we need to set schema.Properties which is a level higher. if meth.ResponseType.FQMN() == ".google.protobuf.Empty" { responseSchema.Properties = &openapiSchemaObjectProperties{} } } } else { // This is resolving the value of response_body in the google.api.HttpRule lastField := b.ResponseBody.FieldPath[len(b.ResponseBody.FieldPath)-1] responseSchema = schemaOfField(lastField.Target, reg, customRefs) if responseSchema.Description != "" { desc = responseSchema.Description } else { desc = fieldProtoComments(reg, lastField.Target.Message, lastField.Target) } } if meth.GetServerStreaming() { desc += "(streaming responses)" responseSchema.Type = "object" swgRef, _ := fullyQualifiedNameToOpenAPIName(meth.ResponseType.FQMN(), reg) responseSchema.Title = "Stream result of " + swgRef props := openapiSchemaObjectProperties{ keyVal{ Key: "result", Value: openapiSchemaObject{ schemaCore: schemaCore{ Ref: responseSchema.Ref, }, }, }, } if !reg.GetDisableDefaultErrors() { statusDef, hasStatus := fullyQualifiedNameToOpenAPIName(".google.rpc.Status", reg) if hasStatus { props = append(props, keyVal{ Key: "error", Value: openapiSchemaObject{ schemaCore: schemaCore{ Ref: fmt.Sprintf("#/definitions/%s", statusDef)}, }, }) } } // Special case HttpBody responses, they will be unformatted bytes if meth.ResponseType.FQMN() == ".google.api.HttpBody" { responseSchema.Type = "string" responseSchema.Format = "binary" responseSchema.Title = "Free form byte stream" // The error response is still JSON, but technically the full response // is still unformatted, so don't include the error response structure. props = nil } responseSchema.Properties = &props responseSchema.Ref = "" } operationObject := &openapiOperationObject{ Parameters: parameters, Responses: openapiResponsesObject{}, } if !reg.GetDisableDefaultResponses() { operationObject.Responses["200"] = openapiResponseObject{ Description: desc, Schema: responseSchema, Headers: openapiHeadersObject{}, } } if !reg.GetDisableServiceTags() { tag := svc.GetName() if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tag = pkg + "." + tag } operationObject.Tags = []string{tag} } if !reg.GetDisableDefaultErrors() { errDef, hasErrDef := fullyQualifiedNameToOpenAPIName(".google.rpc.Status", reg) if hasErrDef { // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object operationObject.Responses["default"] = openapiResponseObject{ Description: "An unexpected error response.", Schema: openapiSchemaObject{ schemaCore: schemaCore{ Ref: fmt.Sprintf("#/definitions/%s", errDef), }, }, } } } operationObject.OperationID = fmt.Sprintf("%s_%s", svc.GetName(), meth.GetName()) if reg.GetSimpleOperationIDs() { operationObject.OperationID = meth.GetName() } if bIdx != 0 { // OperationID must be unique in an OpenAPI v2 definition. operationObject.OperationID += strconv.Itoa(bIdx + 1) } // Fill reference map with referenced request messages for _, param := range operationObject.Parameters { if param.Schema != nil && param.Schema.Ref != "" { requestResponseRefs[param.Schema.Ref] = struct{}{} } } methComments := protoComments(reg, svc.File, nil, "Service", int32(svcIdx-svcBaseIdx), methProtoPath, int32(methIdx)) if err := updateOpenAPIDataFromComments(reg, operationObject, meth, methComments, false); err != nil { panic(err) } svcOpts, err := getServiceOpenAPIOption(reg, svc) if err != nil { grpclog.Error(err) return err } opts, err := getMethodOpenAPIOption(reg, meth) if opts != nil { if err != nil { panic(err) } operationObject.ExternalDocs = protoExternalDocumentationToOpenAPIExternalDocumentation(opts.ExternalDocs, reg, meth) // TODO(ivucica): this would be better supported by looking whether the method is deprecated in the proto file operationObject.Deprecated = opts.Deprecated if opts.Summary != "" { operationObject.Summary = opts.Summary } if opts.Description != "" { operationObject.Description = opts.Description } if len(opts.Tags) > 0 { operationObject.Tags = make([]string, len(opts.Tags)) copy(operationObject.Tags, opts.Tags) } else if svcOpts.GetName() != "" { operationObject.Tags = []string{svcOpts.GetName()} } if opts.OperationId != "" { operationObject.OperationID = opts.OperationId } if opts.Security != nil { newSecurity := []openapiSecurityRequirementObject{} if operationObject.Security != nil { newSecurity = *operationObject.Security } for _, secReq := range opts.Security { newSecReq := openapiSecurityRequirementObject{} for secReqKey, secReqValue := range secReq.SecurityRequirement { if secReqValue == nil { continue } newSecReqValue := make([]string, len(secReqValue.Scope)) copy(newSecReqValue, secReqValue.Scope) newSecReq[secReqKey] = newSecReqValue } if len(newSecReq) > 0 { newSecurity = append(newSecurity, newSecReq) } } operationObject.Security = &newSecurity } if opts.Responses != nil { for name, resp := range opts.Responses { // Merge response data into default response if available. respObj := operationObject.Responses[name] if resp.Description != "" { respObj.Description = resp.Description } if resp.Schema != nil { respObj.Schema = openapiSchemaFromProtoSchema(resp.Schema, reg, customRefs, meth) } if resp.Examples != nil { respObj.Examples = openapiExamplesFromProtoExamples(resp.Examples) } if resp.Headers != nil { hdrs, err := processHeaders(resp.Headers) if err != nil { return err } respObj.Headers = hdrs } if resp.Extensions != nil { exts, err := processExtensions(resp.Extensions) if err != nil { return err } respObj.extensions = exts } operationObject.Responses[name] = respObj } } if opts.Extensions != nil { exts, err := processExtensions(opts.Extensions) if err != nil { return err } operationObject.extensions = exts } if len(opts.Consumes) > 0 { operationObject.Consumes = make([]string, len(opts.Consumes)) copy(operationObject.Consumes, opts.Consumes) } if len(opts.Produces) > 0 { operationObject.Produces = make([]string, len(opts.Produces)) copy(operationObject.Produces, opts.Produces) } if params := opts.Parameters; params != nil && len(params.Headers) > 0 { for _, header := range params.Headers { param := openapiParameterObject{ In: "header", Name: header.Name, Description: header.Description, Required: header.Required, Format: header.Format, } switch header.Type { case openapi_options.HeaderParameter_STRING: param.Type = "string" case openapi_options.HeaderParameter_NUMBER: param.Type = "number" case openapi_options.HeaderParameter_INTEGER: param.Type = "integer" case openapi_options.HeaderParameter_BOOLEAN: param.Type = "boolean" default: return fmt.Errorf("invalid header parameter type: %+v", header.Type) } operationObject.Parameters = append(operationObject.Parameters, param) } } // TODO(ivucica): add remaining fields of operation object } switch b.HTTPMethod { case "DELETE": pathItemObject.Delete = operationObject case "GET": pathItemObject.Get = operationObject case "POST": pathItemObject.Post = operationObject case "PUT": pathItemObject.Put = operationObject case "PATCH": pathItemObject.Patch = operationObject case "HEAD": pathItemObject.Head = operationObject case "OPTIONS": pathItemObject.Options = operationObject } updatePaths(paths, path, pathItemObject) } } } // Success! return nil on the error object return nil } // Returns the openapiPathItemObject associated with a path. If path is not present, returns // empty openapiPathItemObject and false. func getPathItemObject(paths openapiPathsObject, path string) (openapiPathItemObject, bool) { for _, pathData := range paths { if pathData.Path == path { return pathData.PathItemObject, true } } return openapiPathItemObject{}, false } // If a path already exists in openapiPathsObject, updates that path's openapiPathItemObject. If not, // appends a new path and openapiPathItemObject to the openapiPathsObject. func updatePaths(paths *openapiPathsObject, path string, pathItemObject openapiPathItemObject) { for i, p := range *paths { if p.Path == path { (*paths)[i].PathItemObject = pathItemObject return } } *paths = append(*paths, pathData{ Path: path, PathItemObject: pathItemObject, }) } func mergeDescription(schema openapiSchemaObject) string { desc := schema.Description if schema.Title != "" { // join title because title of parameter object will be ignored desc = strings.TrimSpace(schema.Title + paragraphDeliminator + schema.Description) } return desc } func operationForMethod(httpMethod string) func(*openapiPathItemObject) *openapiOperationObject { switch httpMethod { case "GET": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Get } case "POST": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Post } case "PUT": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Put } case "DELETE": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Delete } case "PATCH": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Patch } case "HEAD": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Head } case "OPTIONS": return func(obj *openapiPathItemObject) *openapiOperationObject { return obj.Options } default: return func(obj *openapiPathItemObject) *openapiOperationObject { return nil } } } // This function is called with a param which contains the entire definition of a method. func applyTemplate(p param) (*openapiSwaggerObject, error) { // Create the basic template object. This is the object that everything is // defined off of. s := openapiSwaggerObject{ // OpenAPI 2.0 is the version of this document Swagger: "2.0", Consumes: []string{"application/json"}, Produces: []string{"application/json"}, Paths: openapiPathsObject{}, Definitions: make(openapiDefinitionsObject), Info: openapiInfoObject{ Title: *p.File.Name, Version: "version not set", }, } // Loops through all the services and their exposed GET/POST/PUT/DELETE definitions // and create entries for all of them. // Also adds custom user specified references to second map. requestResponseRefs, customRefs := refMap{}, refMap{} if err := renderServices(p.Services, &s.Paths, p.reg, requestResponseRefs, customRefs, p.Messages, s.Definitions); err != nil { panic(err) } messages := messageMap{} streamingMessages := messageMap{} enums := enumMap{} if !p.reg.GetDisableDefaultErrors() { // Add the error type to the message map runtimeError, swgRef, err := lookupMsgAndOpenAPIName("google.rpc", "Status", p.reg) if err == nil { messages[swgRef] = runtimeError } else { // just in case there is an error looking up runtimeError grpclog.Error(err) } } // Find all the service's messages and enumerations that are defined (recursively) // and write request, response and other custom (but referenced) types out as definition objects. findServicesMessagesAndEnumerations(p.Services, p.reg, messages, streamingMessages, enums, requestResponseRefs) if err := renderMessagesAsDefinition(messages, s.Definitions, p.reg, customRefs, nil); err != nil { return nil, err } renderEnumerationsAsDefinition(enums, s.Definitions, p.reg) // File itself might have some comments and metadata. packageProtoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.FileDescriptorProto)(nil)), "Package") packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) if err := updateOpenAPIDataFromComments(p.reg, &s, p, packageComments, true); err != nil { return nil, err } // There may be additional options in the OpenAPI option in the proto. spb, err := getFileOpenAPIOption(p.reg, p.File) if err != nil { return nil, err } if spb != nil { if spb.Swagger != "" { s.Swagger = spb.Swagger } if spb.Info != nil { if spb.Info.Title != "" { s.Info.Title = spb.Info.Title } if spb.Info.Description != "" { s.Info.Description = spb.Info.Description } if spb.Info.TermsOfService != "" { s.Info.TermsOfService = spb.Info.TermsOfService } if spb.Info.Version != "" { s.Info.Version = spb.Info.Version } if spb.Info.Contact != nil { if s.Info.Contact == nil { s.Info.Contact = &openapiContactObject{} } if spb.Info.Contact.Name != "" { s.Info.Contact.Name = spb.Info.Contact.Name } if spb.Info.Contact.Url != "" { s.Info.Contact.URL = spb.Info.Contact.Url } if spb.Info.Contact.Email != "" { s.Info.Contact.Email = spb.Info.Contact.Email } } if spb.Info.License != nil { if s.Info.License == nil { s.Info.License = &openapiLicenseObject{} } if spb.Info.License.Name != "" { s.Info.License.Name = spb.Info.License.Name } if spb.Info.License.Url != "" { s.Info.License.URL = spb.Info.License.Url } } if spb.Info.Extensions != nil { exts, err := processExtensions(spb.Info.Extensions) if err != nil { return nil, err } s.Info.extensions = exts } } if spb.Host != "" { s.Host = spb.Host } if spb.BasePath != "" { s.BasePath = spb.BasePath } if len(spb.Schemes) > 0 { s.Schemes = make([]string, len(spb.Schemes)) for i, scheme := range spb.Schemes { s.Schemes[i] = strings.ToLower(scheme.String()) } } if len(spb.Consumes) > 0 { s.Consumes = make([]string, len(spb.Consumes)) copy(s.Consumes, spb.Consumes) } if len(spb.Produces) > 0 { s.Produces = make([]string, len(spb.Produces)) copy(s.Produces, spb.Produces) } if spb.SecurityDefinitions != nil && spb.SecurityDefinitions.Security != nil { if s.SecurityDefinitions == nil { s.SecurityDefinitions = openapiSecurityDefinitionsObject{} } for secDefKey, secDefValue := range spb.SecurityDefinitions.Security { var newSecDefValue openapiSecuritySchemeObject if oldSecDefValue, ok := s.SecurityDefinitions[secDefKey]; !ok { newSecDefValue = openapiSecuritySchemeObject{} } else { newSecDefValue = oldSecDefValue } if secDefValue.Type != openapi_options.SecurityScheme_TYPE_INVALID { switch secDefValue.Type { case openapi_options.SecurityScheme_TYPE_BASIC: newSecDefValue.Type = "basic" case openapi_options.SecurityScheme_TYPE_API_KEY: newSecDefValue.Type = "apiKey" case openapi_options.SecurityScheme_TYPE_OAUTH2: newSecDefValue.Type = "oauth2" } } if secDefValue.Description != "" { newSecDefValue.Description = secDefValue.Description } if secDefValue.Name != "" { newSecDefValue.Name = secDefValue.Name } if secDefValue.In != openapi_options.SecurityScheme_IN_INVALID { switch secDefValue.In { case openapi_options.SecurityScheme_IN_QUERY: newSecDefValue.In = "query" case openapi_options.SecurityScheme_IN_HEADER: newSecDefValue.In = "header" } } if secDefValue.Flow != openapi_options.SecurityScheme_FLOW_INVALID { switch secDefValue.Flow { case openapi_options.SecurityScheme_FLOW_IMPLICIT: newSecDefValue.Flow = "implicit" case openapi_options.SecurityScheme_FLOW_PASSWORD: newSecDefValue.Flow = "password" case openapi_options.SecurityScheme_FLOW_APPLICATION: newSecDefValue.Flow = "application" case openapi_options.SecurityScheme_FLOW_ACCESS_CODE: newSecDefValue.Flow = "accessCode" } } if secDefValue.AuthorizationUrl != "" { newSecDefValue.AuthorizationURL = secDefValue.AuthorizationUrl } if secDefValue.TokenUrl != "" { newSecDefValue.TokenURL = secDefValue.TokenUrl } if secDefValue.Scopes != nil { if newSecDefValue.Scopes == nil { newSecDefValue.Scopes = openapiScopesObject{} } for scopeKey, scopeDesc := range secDefValue.Scopes.Scope { newSecDefValue.Scopes[scopeKey] = scopeDesc } } if secDefValue.Extensions != nil { exts, err := processExtensions(secDefValue.Extensions) if err != nil { return nil, err } newSecDefValue.extensions = exts } s.SecurityDefinitions[secDefKey] = newSecDefValue } } if spb.Security != nil { var newSecurity []openapiSecurityRequirementObject if s.Security != nil { newSecurity = s.Security } for _, secReq := range spb.Security { newSecReq := openapiSecurityRequirementObject{} for secReqKey, secReqValue := range secReq.SecurityRequirement { if secReqValue == nil { return nil, fmt.Errorf("malformed security requirement spec for key %q; value is required", secReqKey) } newSecReqValue := make([]string, len(secReqValue.Scope)) copy(newSecReqValue, secReqValue.Scope) newSecReq[secReqKey] = newSecReqValue } newSecurity = append(newSecurity, newSecReq) } s.Security = newSecurity } s.ExternalDocs = protoExternalDocumentationToOpenAPIExternalDocumentation(spb.ExternalDocs, p.reg, spb) // Populate all Paths with Responses set at top level, // preferring Responses already set over those at the top level. if spb.Responses != nil { for _, verbs := range s.Paths { var maps []openapiResponsesObject if verbs.PathItemObject.Delete != nil { maps = append(maps, verbs.PathItemObject.Delete.Responses) } if verbs.PathItemObject.Get != nil { maps = append(maps, verbs.PathItemObject.Get.Responses) } if verbs.PathItemObject.Post != nil { maps = append(maps, verbs.PathItemObject.Post.Responses) } if verbs.PathItemObject.Put != nil { maps = append(maps, verbs.PathItemObject.Put.Responses) } if verbs.PathItemObject.Patch != nil { maps = append(maps, verbs.PathItemObject.Patch.Responses) } for k, v := range spb.Responses { for _, respMap := range maps { if _, ok := respMap[k]; ok { // Don't overwrite already existing Responses continue } respMap[k] = openapiResponseObject{ Description: v.Description, Schema: openapiSchemaFromProtoSchema(v.Schema, p.reg, customRefs, nil), Examples: openapiExamplesFromProtoExamples(v.Examples), } } } } } if spb.Extensions != nil { exts, err := processExtensions(spb.Extensions) if err != nil { return nil, err } s.extensions = exts } if spb.Tags != nil { for _, v := range spb.Tags { newTag := openapiTagObject{} newTag.Name = v.Name newTag.Description = v.Description if p.reg.GetUseGoTemplate() { newTag.Description = goTemplateComments(newTag.Description, nil, p.reg) } if v.ExternalDocs != nil { newTag.ExternalDocs = &openapiExternalDocumentationObject{ Description: v.ExternalDocs.Description, URL: v.ExternalDocs.Url, } if p.reg.GetUseGoTemplate() { newTag.ExternalDocs.Description = goTemplateComments(v.ExternalDocs.Description, nil, p.reg) } } if v.Extensions != nil { exts, err := processExtensions(v.Extensions) if err != nil { return nil, err } newTag.extensions = exts } s.Tags = append(s.Tags, newTag) } } // Additional fields on the OpenAPI v2 spec's "OpenAPI" object // should be added here, once supported in the proto. } if !p.reg.GetDisableServiceTags() { s.Tags = mergeTags(s.Tags, renderServiceTags(p.Services, p.reg)) } // Finally add any references added by users that aren't // otherwise rendered. if err := addCustomRefs(s.Definitions, p.reg, customRefs); err != nil { return nil, err } return &s, nil } func mergeTags(existingTags []openapiTagObject, tags []openapiTagObject) []openapiTagObject { for _, tag := range tags { matched := false for i, existingTag := range existingTags { if existingTag.Name == tag.Name { if existingTag.Description == "" { existingTags[i].Description = tag.Description } if existingTag.ExternalDocs == nil { existingTags[i].ExternalDocs = tag.ExternalDocs } else if tag.ExternalDocs != nil { if existingTag.ExternalDocs.Description == "" { existingTags[i].ExternalDocs.Description = tag.ExternalDocs.Description } if existingTag.ExternalDocs.URL == "" { existingTags[i].ExternalDocs.URL = tag.ExternalDocs.URL } } if existingTag.extensions == nil { existingTags[i].extensions = tag.extensions } else if tag.extensions != nil { for _, ext := range tag.extensions { matchedExt := false for _, existingExt := range existingTag.extensions { if existingExt.key == ext.key { matchedExt = true break } } if !matchedExt { existingTags[i].extensions = append(existingTags[i].extensions, ext) } } } matched = true break } } if !matched { existingTags = append(existingTags, tag) } } return existingTags } func processExtensions(inputExts map[string]*structpb.Value) ([]extension, error) { exts := make([]extension, 0, len(inputExts)) for k, v := range inputExts { if !strings.HasPrefix(k, "x-") { return nil, fmt.Errorf("extension keys need to start with \"x-\": %q", k) } ext, err := (&protojson.MarshalOptions{Indent: " "}).Marshal(v) if err != nil { return nil, err } exts = append(exts, extension{key: k, value: ext}) } sort.Slice(exts, func(i, j int) bool { return exts[i].key < exts[j].key }) return exts, nil } func validateHeaderTypeAndFormat(headerType, format string) error { // The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array" // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject // Note: currently not implementing array as we are only implementing this in the operation response context switch headerType { // the format property is an open string-valued property, and can have any value to support documentation needs // primary check for format is to ensure that the number/integer formats are extensions of the specified type // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#dataTypeFormat case "string": return nil case "number": switch format { case "uint", "uint8", "uint16", "uint32", "uint64", "int", "int8", "int16", "int32", "int64", "float", "float32", "float64", "complex64", "complex128", "double", "byte", "rune", "uintptr", "": return nil default: return fmt.Errorf("the provided format %q is not a valid extension of the type %q", format, headerType) } case "integer": switch format { case "uint", "uint8", "uint16", "uint32", "uint64", "int", "int8", "int16", "int32", "int64", "": return nil default: return fmt.Errorf("the provided format %q is not a valid extension of the type %q", format, headerType) } case "boolean": return nil } return fmt.Errorf("the provided header type %q is not supported", headerType) } func validateDefaultValueTypeAndFormat(headerType string, defaultValue string, format string) error { switch headerType { case "string": if !isQuotedString(defaultValue) { return fmt.Errorf("the provided default value %q does not match provider type %q, or is not properly quoted with escaped quotations", defaultValue, headerType) } switch format { case "date-time": unquoteTime := strings.Trim(defaultValue, `"`) if _, err := time.Parse(time.RFC3339, unquoteTime); err != nil { return fmt.Errorf("the provided default value %q is not a valid RFC3339 date-time string", defaultValue) } case "date": const layoutRFC3339Date = "2006-01-02" unquoteDate := strings.Trim(defaultValue, `"`) if _, err := time.Parse(layoutRFC3339Date, unquoteDate); err != nil { return fmt.Errorf("the provided default value %q is not a valid RFC3339 date-time string", defaultValue) } } case "number": if err := isJSONNumber(defaultValue, headerType); err != nil { return err } case "integer": switch format { case "int32": if _, err := strconv.ParseInt(defaultValue, 0, 32); err != nil { return fmt.Errorf("the provided default value %q does not match provided format %q", defaultValue, format) } case "uint32": if _, err := strconv.ParseUint(defaultValue, 0, 32); err != nil { return fmt.Errorf("the provided default value %q does not match provided format %q", defaultValue, format) } case "int64": if _, err := strconv.ParseInt(defaultValue, 0, 64); err != nil { return fmt.Errorf("the provided default value %q does not match provided format %q", defaultValue, format) } case "uint64": if _, err := strconv.ParseUint(defaultValue, 0, 64); err != nil { return fmt.Errorf("the provided default value %q does not match provided format %q", defaultValue, format) } default: if _, err := strconv.ParseInt(defaultValue, 0, 64); err != nil { return fmt.Errorf("the provided default value %q does not match provided type %q", defaultValue, headerType) } } case "boolean": if !isBool(defaultValue) { return fmt.Errorf("the provided default value %q does not match provider type %q", defaultValue, headerType) } } return nil } func isQuotedString(s string) bool { return len(s) >= 2 && s[0] == '"' && s[len(s)-1] == '"' } func isJSONNumber(s string, t string) error { val, err := strconv.ParseFloat(s, 64) if err != nil { return fmt.Errorf("the provided default value %q does not match provider type %q", s, t) } // Floating point values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted. // See: https://tools.ietf.org/html/rfc4627#section-2.4 if math.IsInf(val, 0) || math.IsNaN(val) { return fmt.Errorf("the provided number %q is not a valid JSON number", s) } return nil } func isBool(s string) bool { // Unable to use strconv.ParseBool because it returns truthy values https://golang.org/pkg/strconv/#example_ParseBool // per https://swagger.io/specification/v2/#data-types // type: boolean represents two values: true and false. Note that truthy and falsy values such as "true", "", 0 or null are not considered boolean values. return s == "true" || s == "false" } func processHeaders(inputHdrs map[string]*openapi_options.Header) (openapiHeadersObject, error) { hdrs := make(map[string]openapiHeaderObject, len(inputHdrs)) for k, v := range inputHdrs { header := textproto.CanonicalMIMEHeaderKey(k) ret := openapiHeaderObject{ Description: v.Description, Format: v.Format, Pattern: v.Pattern, } if err := validateHeaderTypeAndFormat(v.Type, v.Format); err != nil { return nil, err } ret.Type = v.Type if v.Default != "" { if err := validateDefaultValueTypeAndFormat(v.Type, v.Default, v.Format); err != nil { return nil, err } ret.Default = RawExample(v.Default) } hdrs[header] = ret } return hdrs, nil } func removeInternalComments(comment string) string { c := []string{} for len(comment) > 0 { open := strings.SplitN(comment, "(--", 2) if len(open) == 1 { c = append(c, open[0]) break } ex := strings.TrimRight(open[0], " \t") // Trim only one line prior to all spaces switch { case strings.HasSuffix(ex, "\r\n"): ex = strings.TrimSuffix(ex, "\r\n") case strings.HasSuffix(ex, "\n"): ex = strings.TrimSuffix(ex, "\n") } if ex != "" { c = append(c, ex) } comment = open[1] close := strings.SplitN(comment, "--)", 2) if len(close) > 1 { comment = close[1] } else { break } } return strings.Join(c, "") } // updateOpenAPIDataFromComments updates a OpenAPI object based on a comment // from the proto file. // // First paragraph of a comment is used for summary. Remaining paragraphs of // a comment are used for description. If 'Summary' field is not present on // the passed swaggerObject, the summary and description are joined by \n\n. // // If there is a field named 'Info', its 'Summary' and 'Description' fields // will be updated instead. // // If there is no 'Summary', the same behavior will be attempted on 'Title', // but only if the last character is not a period. func updateOpenAPIDataFromComments(reg *descriptor.Registry, swaggerObject interface{}, data interface{}, comment string, isPackageObject bool) error { if len(comment) == 0 { return nil } // Checks whether the "ignore_comments" flag is set to true if reg.GetIgnoreComments() { return nil } // Checks whether the "remove_internal_comments" flag is set to true if reg.GetRemoveInternalComments() { comment = removeInternalComments(comment) } // Checks whether the "use_go_templates" flag is set to true if reg.GetUseGoTemplate() { comment = goTemplateComments(comment, data, reg) } // Figure out what to apply changes to. swaggerObjectValue := reflect.ValueOf(swaggerObject) infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") if !infoObjectValue.CanSet() { // No such field? Apply summary and description directly to // passed object. infoObjectValue = swaggerObjectValue.Elem() } // Figure out which properties to update. summaryValue := infoObjectValue.FieldByName("Summary") descriptionValue := infoObjectValue.FieldByName("Description") readOnlyValue := infoObjectValue.FieldByName("ReadOnly") if readOnlyValue.Kind() == reflect.Bool && readOnlyValue.CanSet() && strings.Contains(comment, "Output only.") { readOnlyValue.Set(reflect.ValueOf(true)) } usingTitle := false if !summaryValue.CanSet() { summaryValue = infoObjectValue.FieldByName("Title") usingTitle = true } paragraphs := strings.Split(comment, paragraphDeliminator) // If there is a summary (or summary-equivalent) and it's empty, use the first // paragraph as summary, and the rest as description. if summaryValue.CanSet() { summary := strings.TrimSpace(paragraphs[0]) description := strings.TrimSpace(strings.Join(paragraphs[1:], paragraphDeliminator)) if !usingTitle || (len(summary) > 0 && summary[len(summary)-1] != '.') { // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition if summaryValue.Len() == 0 || isPackageObject { summaryValue.Set(reflect.ValueOf(summary)) } if len(description) > 0 { if !descriptionValue.CanSet() { return errors.New("encountered object type with a summary, but no description") } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(description)) } } return nil } } // There was no summary field on the swaggerObject. Try to apply the // whole comment into description if the OpenAPI object description is empty. if descriptionValue.CanSet() { if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, paragraphDeliminator))) } return nil } return errors.New("no description nor summary property") } func fieldProtoComments(reg *descriptor.Registry, msg *descriptor.Message, field *descriptor.Field) string { protoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.DescriptorProto)(nil)), "Field") for i, f := range msg.Fields { if f == field { return protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), protoPath, int32(i)) } } return "" } func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) string { protoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.EnumDescriptorProto)(nil)), "Value") var comments []string for idx, value := range enum.GetValue() { if reg.GetOmitEnumDefaultValue() && value.GetNumber() == 0 { continue } if !isVisible(getEnumValueVisibilityOption(value), reg) { continue } name := value.GetName() if reg.GetEnumsAsInts() { name = strconv.Itoa(int(value.GetNumber())) } if str := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), protoPath, int32(idx)); str != "" { comments = append(comments, name+": "+str) } } if len(comments) > 0 { return "- " + strings.Join(comments, "\n - ") } return "" } func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { if file.SourceCodeInfo == nil { fmt.Fprintln(os.Stderr, file.GetName(), "descriptor.File should not contain nil SourceCodeInfo") return "" } outerPaths := make([]int32, len(outers)) for i := range outers { location := "" if file.Package != nil { location = file.GetPackage() } msg, err := reg.LookupMsg(location, strings.Join(outers[:i+1], ".")) if err != nil { panic(err) } outerPaths[i] = int32(msg.Index) } for _, loc := range file.SourceCodeInfo.Location { if !isProtoPathMatches(loc.Path, outerPaths, typeName, typeIndex, fieldPaths) { continue } comments := "" if loc.LeadingComments != nil { comments = strings.TrimRight(*loc.LeadingComments, "\n") comments = strings.TrimSpace(comments) // TODO(ivucica): this is a hack to fix "// " being interpreted as "//". // perhaps we should: // - split by \n // - determine if every (but first and last) line begins with " " // - trim every line only if that is the case // - join by \n comments = strings.ReplaceAll(comments, "\n ", "\n") comments = removeInternalComments(comments) } if loc.TrailingComments != nil { trailing := strings.TrimSpace(*loc.TrailingComments) if comments == "" { comments = trailing } else { comments += "\n\n" + trailing } } return comments } return "" } func goTemplateComments(comment string, data interface{}, reg *descriptor.Registry) string { var temp bytes.Buffer tpl, err := template.New("").Funcs(template.FuncMap{ // Allows importing documentation from a file "import": func(name string) string { file, err := os.ReadFile(name) if err != nil { return err.Error() } // Runs template over imported file return goTemplateComments(string(file), data, reg) }, // Grabs title and description from a field "fieldcomments": func(msg *descriptor.Message, field *descriptor.Field) string { return strings.ReplaceAll(fieldProtoComments(reg, msg, field), "\n", "
") }, "arg": func(name string) string { if v, f := reg.GetGoTemplateArgs()[name]; f { return v } return fmt.Sprintf("goTemplateArg %s not found", name) }, }).Parse(comment) if err != nil { // If there is an error parsing the templating insert the error as string in the comment // to make it easier to debug the template error return err.Error() } if err := tpl.Execute(&temp, data); err != nil { // If there is an error executing the templating insert the error as string in the comment // to make it easier to debug the error return err.Error() } return temp.String() } var messageProtoPath = protoPathIndex(reflect.TypeOf((*descriptorpb.FileDescriptorProto)(nil)), "MessageType") var nestedProtoPath = protoPathIndex(reflect.TypeOf((*descriptorpb.DescriptorProto)(nil)), "NestedType") var packageProtoPath = protoPathIndex(reflect.TypeOf((*descriptorpb.FileDescriptorProto)(nil)), "Package") var serviceProtoPath = protoPathIndex(reflect.TypeOf((*descriptorpb.FileDescriptorProto)(nil)), "Service") var methodProtoPath = protoPathIndex(reflect.TypeOf((*descriptorpb.ServiceDescriptorProto)(nil)), "Method") func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, typeIndex int32, fieldPaths []int32) bool { if typeName == "Package" && typeIndex == packageProtoPath { // path for package comments is just [2], and all the other processing // is too complex for it. if len(paths) == 0 || typeIndex != paths[0] { return false } return true } if len(paths) != len(outerPaths)*2+2+len(fieldPaths) { return false } if typeName == "Method" { if paths[0] != serviceProtoPath || paths[2] != methodProtoPath { return false } paths = paths[2:] } else { typeNameDescriptor := reflect.TypeOf((*descriptorpb.FileDescriptorProto)(nil)) if len(outerPaths) > 0 { if paths[0] != messageProtoPath || paths[1] != outerPaths[0] { return false } paths = paths[2:] outerPaths = outerPaths[1:] for i, v := range outerPaths { if paths[i*2] != nestedProtoPath || paths[i*2+1] != v { return false } } paths = paths[len(outerPaths)*2:] if typeName == "MessageType" { typeName = "NestedType" } typeNameDescriptor = reflect.TypeOf((*descriptorpb.DescriptorProto)(nil)) } if paths[0] != protoPathIndex(typeNameDescriptor, typeName) || paths[1] != typeIndex { return false } paths = paths[2:] } for i, v := range fieldPaths { if paths[i] != v { return false } } return true } // protoPathIndex returns a path component for google.protobuf.descriptor.SourceCode_Location. // // Specifically, it returns an id as generated from descriptor proto which // can be used to determine what type the id following it in the path is. // For example, if we are trying to locate comments related to a field named // `Address` in a message named `Person`, the path will be: // // [4, a, 2, b] // // While `a` gets determined by the order in which the messages appear in // the proto file, and `b` is the field index specified in the proto // file itself, the path actually needs to specify that `a` refers to a // message and not, say, a service; and that `b` refers to a field and not // an option. // // protoPathIndex figures out the values 4 and 2 in the above example. Because // messages are top level objects, the value of 4 comes from field id for // `MessageType` inside `google.protobuf.descriptor.FileDescriptor` message. // This field has a message type `google.protobuf.descriptor.DescriptorProto`. // And inside message `DescriptorProto`, there is a field named `Field` with id // 2. // // Some code generators seem to be hardcoding these values; this method instead // interprets them from `descriptor.proto`-derived Go source as necessary. func protoPathIndex(descriptorType reflect.Type, what string) int32 { field, ok := descriptorType.Elem().FieldByName(what) if !ok { panic(fmt.Errorf("could not find protobuf descriptor type id for %s", what)) } pbtag := field.Tag.Get("protobuf") if pbtag == "" { panic(fmt.Errorf("no Go tag 'protobuf' on protobuf descriptor for %s", what)) } path, err := strconv.ParseInt(strings.Split(pbtag, ",")[1], 10, 32) if err != nil { panic(fmt.Errorf("protobuf descriptor id for %s cannot be converted to a number: %s", what, err.Error())) } return int32(path) } // extractOperationOptionFromMethodDescriptor extracts the message of type // openapi_options.Operation from a given proto method's descriptor. func extractOperationOptionFromMethodDescriptor(meth *descriptorpb.MethodDescriptorProto) (*openapi_options.Operation, error) { if meth.Options == nil { return nil, nil } if !proto.HasExtension(meth.Options, openapi_options.E_Openapiv2Operation) { return nil, nil } ext := proto.GetExtension(meth.Options, openapi_options.E_Openapiv2Operation) opts, ok := ext.(*openapi_options.Operation) if !ok { return nil, fmt.Errorf("extension is %T; want an Operation", ext) } return opts, nil } // extractSchemaOptionFromMessageDescriptor extracts the message of type // openapi_options.Schema from a given proto message's descriptor. func extractSchemaOptionFromMessageDescriptor(msg *descriptorpb.DescriptorProto) (*openapi_options.Schema, error) { if msg.Options == nil { return nil, nil } if !proto.HasExtension(msg.Options, openapi_options.E_Openapiv2Schema) { return nil, nil } ext := proto.GetExtension(msg.Options, openapi_options.E_Openapiv2Schema) opts, ok := ext.(*openapi_options.Schema) if !ok { return nil, fmt.Errorf("extension is %T; want a Schema", ext) } return opts, nil } // extractTagOptionFromServiceDescriptor extracts the tag of type // openapi_options.Tag from a given proto service's descriptor. func extractTagOptionFromServiceDescriptor(svc *descriptorpb.ServiceDescriptorProto) (*openapi_options.Tag, error) { if svc.Options == nil { return nil, nil } if !proto.HasExtension(svc.Options, openapi_options.E_Openapiv2Tag) { return nil, nil } ext := proto.GetExtension(svc.Options, openapi_options.E_Openapiv2Tag) opts, ok := ext.(*openapi_options.Tag) if !ok { return nil, fmt.Errorf("extension is %T; want a Tag", ext) } return opts, nil } // extractOpenAPIOptionFromFileDescriptor extracts the message of type // openapi_options.OpenAPI from a given proto method's descriptor. func extractOpenAPIOptionFromFileDescriptor(file *descriptorpb.FileDescriptorProto) (*openapi_options.Swagger, error) { if file.Options == nil { return nil, nil } if !proto.HasExtension(file.Options, openapi_options.E_Openapiv2Swagger) { return nil, nil } ext := proto.GetExtension(file.Options, openapi_options.E_Openapiv2Swagger) opts, ok := ext.(*openapi_options.Swagger) if !ok { return nil, fmt.Errorf("extension is %T; want a OpenAPI object", ext) } return opts, nil } func extractJSONSchemaFromFieldDescriptor(fd *descriptorpb.FieldDescriptorProto) (*openapi_options.JSONSchema, error) { if fd.Options == nil { return nil, nil } if !proto.HasExtension(fd.Options, openapi_options.E_Openapiv2Field) { return nil, nil } ext := proto.GetExtension(fd.Options, openapi_options.E_Openapiv2Field) opts, ok := ext.(*openapi_options.JSONSchema) if !ok { return nil, fmt.Errorf("extension is %T; want a JSONSchema object", ext) } return opts, nil } func extractFieldBehaviorFromFieldDescriptor(fd *descriptorpb.FieldDescriptorProto) ([]annotations.FieldBehavior, error) { if fd.Options == nil { return nil, nil } if !proto.HasExtension(fd.Options, annotations.E_FieldBehavior) { return nil, nil } ext := proto.GetExtension(fd.Options, annotations.E_FieldBehavior) opts, ok := ext.([]annotations.FieldBehavior) if !ok { return nil, fmt.Errorf("extension is %T; want a []FieldBehavior object", ext) } return opts, nil } func getFieldVisibilityOption(fd *descriptor.Field) *visibility.VisibilityRule { if fd.Options == nil { return nil } if !proto.HasExtension(fd.Options, visibility.E_FieldVisibility) { return nil } ext := proto.GetExtension(fd.Options, visibility.E_FieldVisibility) opts, ok := ext.(*visibility.VisibilityRule) if !ok { return nil } return opts } func getServiceVisibilityOption(fd *descriptor.Service) *visibility.VisibilityRule { if fd.Options == nil { return nil } if !proto.HasExtension(fd.Options, visibility.E_ApiVisibility) { return nil } ext := proto.GetExtension(fd.Options, visibility.E_ApiVisibility) opts, ok := ext.(*visibility.VisibilityRule) if !ok { return nil } return opts } func getMethodVisibilityOption(fd *descriptor.Method) *visibility.VisibilityRule { if fd.Options == nil { return nil } if !proto.HasExtension(fd.Options, visibility.E_MethodVisibility) { return nil } ext := proto.GetExtension(fd.Options, visibility.E_MethodVisibility) opts, ok := ext.(*visibility.VisibilityRule) if !ok { return nil } return opts } func getEnumValueVisibilityOption(fd *descriptorpb.EnumValueDescriptorProto) *visibility.VisibilityRule { if fd.Options == nil { return nil } if !proto.HasExtension(fd.Options, visibility.E_ValueVisibility) { return nil } ext := proto.GetExtension(fd.Options, visibility.E_ValueVisibility) opts, ok := ext.(*visibility.VisibilityRule) if !ok { return nil } return opts } func getMethodOpenAPIOption(reg *descriptor.Registry, meth *descriptor.Method) (*openapi_options.Operation, error) { opts, err := extractOperationOptionFromMethodDescriptor(meth.MethodDescriptorProto) if err != nil { return nil, err } if opts != nil { return opts, nil } opts, ok := reg.GetOpenAPIMethodOption(meth.FQMN()) if !ok { return nil, nil } return opts, nil } func getMessageOpenAPIOption(reg *descriptor.Registry, msg *descriptor.Message) (*openapi_options.Schema, error) { opts, err := extractSchemaOptionFromMessageDescriptor(msg.DescriptorProto) if err != nil { return nil, err } if opts != nil { return opts, nil } opts, ok := reg.GetOpenAPIMessageOption(msg.FQMN()) if !ok { return nil, nil } return opts, nil } func getServiceOpenAPIOption(reg *descriptor.Registry, svc *descriptor.Service) (*openapi_options.Tag, error) { if opts, ok := reg.GetOpenAPIServiceOption(svc.FQSN()); ok { return opts, nil } opts, err := extractTagOptionFromServiceDescriptor(svc.ServiceDescriptorProto) if err != nil { return nil, err } return opts, nil } func getFileOpenAPIOption(reg *descriptor.Registry, file *descriptor.File) (*openapi_options.Swagger, error) { opts, err := extractOpenAPIOptionFromFileDescriptor(file.FileDescriptorProto) if err != nil { return nil, err } if opts != nil { return opts, nil } opts, ok := reg.GetOpenAPIFileOption(*file.Name) if !ok { return nil, nil } return opts, nil } func getFieldOpenAPIOption(reg *descriptor.Registry, fd *descriptor.Field) (*openapi_options.JSONSchema, error) { opts, err := extractJSONSchemaFromFieldDescriptor(fd.FieldDescriptorProto) if err != nil { return nil, err } if opts != nil { return opts, nil } opts, ok := reg.GetOpenAPIFieldOption(fd.FQFN()) if !ok { return nil, nil } return opts, nil } func getFieldBehaviorOption(reg *descriptor.Registry, fd *descriptor.Field) ([]annotations.FieldBehavior, error) { opts, err := extractFieldBehaviorFromFieldDescriptor(fd.FieldDescriptorProto) if err != nil { return nil, err } if opts != nil { return opts, nil } return opts, nil } func protoJSONSchemaToOpenAPISchemaCore(j *openapi_options.JSONSchema, reg *descriptor.Registry, refs refMap) schemaCore { ret := schemaCore{} if j.GetRef() != "" { openapiName, ok := fullyQualifiedNameToOpenAPIName(j.GetRef(), reg) if ok { ret.Ref = "#/definitions/" + openapiName if refs != nil { refs[j.GetRef()] = struct{}{} } } else { ret.Ref += j.GetRef() } } else { f, t := protoJSONSchemaTypeToFormat(j.GetType()) ret.Format = f ret.Type = t } return ret } func updateswaggerObjectFromJSONSchema(s *openapiSchemaObject, j *openapi_options.JSONSchema, reg *descriptor.Registry, data interface{}) { s.Title = j.GetTitle() s.Description = j.GetDescription() if reg.GetUseGoTemplate() { s.Title = goTemplateComments(s.Title, data, reg) s.Description = goTemplateComments(s.Description, data, reg) } if s.Type == "array" { s.Items.MaxLength = j.GetMaxLength() s.Items.MinLength = j.GetMinLength() s.Items.Pattern = j.GetPattern() s.Items.Default = j.GetDefault() s.Items.UniqueItems = j.GetUniqueItems() s.Items.MaxProperties = j.GetMaxProperties() s.Items.MinProperties = j.GetMinProperties() s.Items.Required = j.GetRequired() s.Items.Minimum = j.GetMinimum() s.Items.Maximum = j.GetMaximum() s.Items.ReadOnly = j.GetReadOnly() s.Items.MultipleOf = j.GetMultipleOf() s.Items.ExclusiveMaximum = j.GetExclusiveMaximum() s.Items.ExclusiveMinimum = j.GetExclusiveMinimum() s.Items.Enum = j.GetEnum() if j.GetDefault() == "" { s.Items.Default = nil } if len(j.GetEnum()) == 0 { s.Items.Enum = nil } if j.GetFormat() != "" { s.Items.Format = j.GetFormat() } } else { s.MaxLength = j.GetMaxLength() s.MinLength = j.GetMinLength() s.Pattern = j.GetPattern() s.Default = j.GetDefault() s.UniqueItems = j.GetUniqueItems() s.MaxProperties = j.GetMaxProperties() s.MinProperties = j.GetMinProperties() s.Required = j.GetRequired() s.Minimum = j.GetMinimum() s.Maximum = j.GetMaximum() s.ReadOnly = j.GetReadOnly() s.MultipleOf = j.GetMultipleOf() s.ExclusiveMaximum = j.GetExclusiveMaximum() s.ExclusiveMinimum = j.GetExclusiveMinimum() s.Enum = j.GetEnum() if j.GetDefault() == "" { s.Default = nil } if len(j.GetEnum()) == 0 { s.Enum = nil } if j.GetFormat() != "" { s.Format = j.GetFormat() } } s.MaxItems = j.GetMaxItems() s.MinItems = j.GetMinItems() if j.GetExtensions() != nil { exts, err := processExtensions(j.GetExtensions()) if err != nil { panic(err) } s.extensions = exts } if overrideType := j.GetType(); len(overrideType) > 0 { s.Type = strings.ToLower(overrideType[0].String()) } if j.GetExample() != "" { s.Example = RawExample(j.GetExample()) } } func updateSwaggerObjectFromFieldBehavior(s *openapiSchemaObject, j []annotations.FieldBehavior, reg *descriptor.Registry, field *descriptor.Field) { for _, fb := range j { switch fb { case annotations.FieldBehavior_REQUIRED: if reg.GetUseJSONNamesForFields() { s.Required = append(s.Required, *field.JsonName) } else { s.Required = append(s.Required, *field.Name) } case annotations.FieldBehavior_OUTPUT_ONLY: s.ReadOnly = true case annotations.FieldBehavior_FIELD_BEHAVIOR_UNSPECIFIED: case annotations.FieldBehavior_OPTIONAL: case annotations.FieldBehavior_INPUT_ONLY: // OpenAPI v3 supports a writeOnly property, but this is not supported in Open API v2 case annotations.FieldBehavior_IMMUTABLE: } } } func openapiSchemaFromProtoSchema(s *openapi_options.Schema, reg *descriptor.Registry, refs refMap, data interface{}) openapiSchemaObject { ret := openapiSchemaObject{ ExternalDocs: protoExternalDocumentationToOpenAPIExternalDocumentation(s.GetExternalDocs(), reg, data), } ret.schemaCore = protoJSONSchemaToOpenAPISchemaCore(s.GetJsonSchema(), reg, refs) updateswaggerObjectFromJSONSchema(&ret, s.GetJsonSchema(), reg, data) if s != nil && s.Example != "" { ret.Example = RawExample(s.Example) } return ret } func openapiExamplesFromProtoExamples(in map[string]string) map[string]interface{} { if len(in) == 0 { return nil } out := make(map[string]interface{}, len(in)) for mimeType, exampleStr := range in { switch mimeType { case "application/json": // JSON example objects are rendered raw. out[mimeType] = RawExample(exampleStr) default: // All other mimetype examples are rendered as strings. out[mimeType] = exampleStr } } return out } func protoJSONSchemaTypeToFormat(in []openapi_options.JSONSchema_JSONSchemaSimpleTypes) (string, string) { if len(in) == 0 { return "", "" } // Can't support more than 1 type, just return the first element. // This is due to an inconsistency in the design of the openapiv2 proto // and that used in schemaCore. schemaCore uses the v3 definition of types, // which only allows a single string, while the openapiv2 proto uses the OpenAPI v2 // definition, which defers to the JSON schema definition, which allows a string or an array. // Sources: // https://swagger.io/specification/#itemsObject // https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2 switch in[0] { case openapi_options.JSONSchema_UNKNOWN, openapi_options.JSONSchema_NULL: return "", "" case openapi_options.JSONSchema_OBJECT: return "object", "" case openapi_options.JSONSchema_ARRAY: return "array", "" case openapi_options.JSONSchema_BOOLEAN: // NOTE: in OpenAPI specification, format should be empty on boolean type return "boolean", "" case openapi_options.JSONSchema_INTEGER: return "integer", "int32" case openapi_options.JSONSchema_NUMBER: return "number", "double" case openapi_options.JSONSchema_STRING: // NOTE: in OpenAPI specification, format should be empty on string type return "string", "" default: // Maybe panic? return "", "" } } func protoExternalDocumentationToOpenAPIExternalDocumentation(in *openapi_options.ExternalDocumentation, reg *descriptor.Registry, data interface{}) *openapiExternalDocumentationObject { if in == nil { return nil } if reg.GetUseGoTemplate() { in.Description = goTemplateComments(in.Description, data, reg) } return &openapiExternalDocumentationObject{ Description: in.Description, URL: in.Url, } } func addCustomRefs(d openapiDefinitionsObject, reg *descriptor.Registry, refs refMap) error { if len(refs) == 0 { return nil } msgMap := make(messageMap) enumMap := make(enumMap) for ref := range refs { swgName, swgOk := fullyQualifiedNameToOpenAPIName(ref, reg) if !swgOk { grpclog.Errorf("can't resolve OpenAPI name from CustomRef %q", ref) continue } if _, ok := d[swgName]; ok { // Skip already existing definitions delete(refs, ref) continue } msg, err := reg.LookupMsg("", ref) if err == nil { msgMap[swgName] = msg continue } enum, err := reg.LookupEnum("", ref) if err == nil { enumMap[swgName] = enum continue } // ?? Should be either enum or msg } if err := renderMessagesAsDefinition(msgMap, d, reg, refs, nil); err != nil { return err } renderEnumerationsAsDefinition(enumMap, d, reg) // Run again in case any new refs were added return addCustomRefs(d, reg, refs) } func lowerCamelCase(fieldName string, fields []*descriptor.Field, msgs []*descriptor.Message) string { for _, oneField := range fields { if oneField.GetName() == fieldName { return oneField.GetJsonName() } } messageNameToFieldsToJSONName := make(map[string]map[string]string, len(msgs)) fieldNameToType := make(map[string]string) for _, msg := range msgs { fieldNameToJSONName := make(map[string]string) for _, oneField := range msg.GetField() { fieldNameToJSONName[oneField.GetName()] = oneField.GetJsonName() fieldNameToType[oneField.GetName()] = oneField.GetTypeName() } messageNameToFieldsToJSONName[msg.GetName()] = fieldNameToJSONName } if strings.Contains(fieldName, ".") { fieldNames := strings.Split(fieldName, ".") fieldNamesWithCamelCase := make([]string, 0) for i := 0; i < len(fieldNames)-1; i++ { fieldNamesWithCamelCase = append(fieldNamesWithCamelCase, casing.JSONCamelCase(fieldNames[i])) } prefix := strings.Join(fieldNamesWithCamelCase, ".") reservedJSONName := getReservedJSONName(fieldName, messageNameToFieldsToJSONName, fieldNameToType) if reservedJSONName != "" { return prefix + "." + reservedJSONName } } return casing.JSONCamelCase(fieldName) } func getReservedJSONName(fieldName string, messageNameToFieldsToJSONName map[string]map[string]string, fieldNameToType map[string]string) string { if len(strings.Split(fieldName, ".")) == 2 { fieldNames := strings.Split(fieldName, ".") firstVariable := fieldNames[0] firstType := fieldNameToType[firstVariable] firstTypeShortNames := strings.Split(firstType, ".") firstTypeShortName := firstTypeShortNames[len(firstTypeShortNames)-1] return messageNameToFieldsToJSONName[firstTypeShortName][fieldNames[1]] } fieldNames := strings.Split(fieldName, ".") return getReservedJSONName(strings.Join(fieldNames[1:], "."), messageNameToFieldsToJSONName, fieldNameToType) } func find(a []string, x string) int { // This is a linear search but we are dealing with a small number of fields for i, n := range a { if x == n { return i } } return -1 } // Make a deep copy of the outer parameters that has paramName as the first component, // but remove the first component of the field path. func subPathParams(paramName string, outerParams []descriptor.Parameter) []descriptor.Parameter { var innerParams []descriptor.Parameter for _, p := range outerParams { if len(p.FieldPath) > 1 && p.FieldPath[0].Name == paramName { subParam := descriptor.Parameter{ FieldPath: p.FieldPath[1:], Target: p.Target, Method: p.Method, } innerParams = append(innerParams, subParam) } } return innerParams } func getFieldConfiguration(reg *descriptor.Registry, fd *descriptor.Field) *openapi_options.JSONSchema_FieldConfiguration { if j, err := getFieldOpenAPIOption(reg, fd); err == nil { return j.GetFieldConfiguration() } return nil } template_fuzz_test.go000066400000000000000000000014331465037340600360040ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi//go:build go1.18 // +build go1.18 package genopenapi import ( "regexp" "testing" ) var replaceInternalCommentsRegex = regexp.MustCompile(`(?s)(\r?\n)?[ \t]*(\(--)((.*?--\))|.*$)?`) func FuzzRemoveInternalComments(f *testing.F) { f.Add("Text\n\n(-- Comment --)\n\nMore Text\n") f.Add("Text\n\n(-- Multi\nLine\n\nComment --)\n\nMore Text\n") f.Add("(-- Starting with comment --)\n\nMore Text\n") f.Add("\n\n(-- Starting with new line and comment --)\n\nMore Text\n") f.Add("Ending with\n\n(-- Comment --)") f.Fuzz(func(t *testing.T, s string) { s1 := removeInternalComments(s) s2 := replaceInternalCommentsRegex.ReplaceAllString(s, "") if s1 != s2 { t.Errorf("Unexpected comment removal difference: our function produced %q but regex produced %q on %q", s1, s2, s) } }) } template_test.go000066400000000000000000011740701465037340600347370ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "bytes" "encoding/json" "errors" "fmt" "math" "os" "reflect" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" openapi_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/genproto/googleapis/api/visibility" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/emptypb" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" "google.golang.org/protobuf/types/pluginpb" ) var marshaler = &runtime.JSONPb{} func TestOpenapiExamplesFromProtoExamples(t *testing.T) { examples := openapiExamplesFromProtoExamples(map[string]string{ "application/json": `{"Hello": "Worldr!"}`, "plain/text": "Hello, World!", }) testCases := map[Format]string{ FormatJSON: ` { "application/json": { "Hello": "Worldr!" }, "plain/text": "Hello, World!" } `, FormatYAML: ` application/json: Hello: Worldr! plain/text: Hello, World! `, } spaceRemover := strings.NewReplacer(" ", "", "\t", "", "\n", "") for format, expected := range testCases { t.Run(string(format), func(t *testing.T) { var buf bytes.Buffer encoder, err := format.NewEncoder(&buf) if err != nil { t.Fatalf("creating encoder: %s", err) } err = encoder.Encode(examples) if err != nil { t.Fatalf("encoding: %s", err) } actual := spaceRemover.Replace(buf.String()) expected = spaceRemover.Replace(expected) if expected != actual { t.Fatalf("expected:\n%s\nactual:\n%s", expected, actual) } }) } } func crossLinkFixture(f *descriptor.File) *descriptor.File { for _, m := range f.Messages { m.File = f } for _, svc := range f.Services { svc.File = f for _, m := range svc.Methods { m.Service = svc for _, b := range m.Bindings { b.Method = m for _, param := range b.PathParams { param.Method = m } } } } return f } func reqFromFile(f *descriptor.File) *pluginpb.CodeGeneratorRequest { return &pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ f.FileDescriptorProto, }, FileToGenerate: []string{f.GetName()}, } } func TestMessageToQueryParametersWithEnumAsInt(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Number: proto.Int32(3), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a", In: "query", Required: false, Type: "string", }, { Name: "b", In: "query", Required: false, Type: "number", Format: "double", }, { Name: "c", In: "query", Required: false, Type: "array", CollectionFormat: "multi", }, }, }, { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested"), Number: proto.Int32(1), }, }, }, { Name: proto.String("Nested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("deep"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested.DeepNested"), Number: proto.Int32(2), }, }, NestedType: []*descriptorpb.DescriptorProto{{ Name: proto.String("DeepNested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), Number: proto.Int32(2), }, }, EnumType: []*descriptorpb.EnumDescriptorProto{ { Name: proto.String("DeepEnum"), Value: []*descriptorpb.EnumValueDescriptorProto{ {Name: proto.String("FALSE"), Number: proto.Int32(0)}, {Name: proto.String("TRUE"), Number: proto.Int32(1)}, }, }, }, }}, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "nested.a", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.b", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.c", In: "query", Required: false, Type: "integer", Enum: []int{0, 1}, Default: 0, }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() reg.SetEnumsAsInts(true) var msgs []*descriptor.Message for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } // avoid checking Items for array types for i := range params { params[i].Items = nil } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } func TestMessageToQueryParametersWithOmitEnumDefaultValue(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Number: proto.Int32(3), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a", In: "query", Required: false, Type: "string", }, { Name: "b", In: "query", Required: false, Type: "number", Format: "double", }, { Name: "c", In: "query", Required: false, Type: "array", CollectionFormat: "multi", }, }, }, { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested"), Number: proto.Int32(1), }, }, }, { Name: proto.String("Nested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("deep"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested.DeepNested"), Number: proto.Int32(2), }, }, NestedType: []*descriptorpb.DescriptorProto{{ Name: proto.String("DeepNested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), Number: proto.Int32(2), }, }, EnumType: []*descriptorpb.EnumDescriptorProto{ { Name: proto.String("DeepEnum"), Value: []*descriptorpb.EnumValueDescriptorProto{ {Name: proto.String("FALSE"), Number: proto.Int32(0)}, {Name: proto.String("TRUE"), Number: proto.Int32(1)}, }, }, }, }}, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "nested.a", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.b", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.c", In: "query", Required: false, Type: "string", Enum: []string{"TRUE"}, }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() reg.SetOmitEnumDefaultValue(true) var msgs []*descriptor.Message for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } // avoid checking Items for array types for i := range params { params[i].Items = nil } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } func TestMessageToQueryParameters(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Number: proto.Int32(3), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a", In: "query", Required: false, Type: "string", }, { Name: "b", In: "query", Required: false, Type: "number", Format: "double", }, { Name: "c", In: "query", Required: false, Type: "array", CollectionFormat: "multi", }, }, }, { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested"), Number: proto.Int32(1), }, }, }, { Name: proto.String("Nested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("deep"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Nested.DeepNested"), Number: proto.Int32(2), }, }, NestedType: []*descriptorpb.DescriptorProto{{ Name: proto.String("DeepNested"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), Number: proto.Int32(2), }, }, EnumType: []*descriptorpb.EnumDescriptorProto{ { Name: proto.String("DeepEnum"), Value: []*descriptorpb.EnumValueDescriptorProto{ {Name: proto.String("FALSE"), Number: proto.Int32(0)}, {Name: proto.String("TRUE"), Number: proto.Int32(1)}, }, }, }, }}, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "nested.a", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.b", In: "query", Required: false, Type: "string", }, { Name: "nested.deep.c", In: "query", Required: false, Type: "string", Enum: []string{"FALSE", "TRUE"}, Default: "FALSE", }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } // avoid checking Items for array types for i := range params { params[i].Items = nil } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } // TestMessagetoQueryParametersNoRecursive, is a check that cyclical references between messages // are not falsely detected given previous known edge-cases. func TestMessageToQueryParametersNoRecursive(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string } tests := []test{ // First test: // Here is a message that has two of another message adjacent to one another in a nested message. // There is no loop but this was previouly falsely flagged as a cycle. // Example proto: // message NonRecursiveMessage { // string field = 1; // } // message BaseMessage { // NonRecursiveMessage first = 1; // NonRecursiveMessage second = 2; // } // message QueryMessage { // BaseMessage first = 1; // string second = 2; // } { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("QueryMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("first"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.BaseMessage"), Number: proto.Int32(1), }, { Name: proto.String("second"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, }, { Name: proto.String("BaseMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("first"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.NonRecursiveMessage"), Number: proto.Int32(1), }, { Name: proto.String("second"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.NonRecursiveMessage"), Number: proto.Int32(2), }, }, }, // Note there is no recursive nature to this message { Name: proto.String("NonRecursiveMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), // Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, }, }, Message: "QueryMessage", }, } for _, test := range tests { reg := descriptor.NewRegistry() msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } _, err = messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("No recursion error should be thrown: %s", err) } } } // TestMessagetoQueryParametersRecursive, is a check that cyclical references between messages // are handled gracefully. The goal is to insure that attempts to add messages with cyclical // references to query-parameters returns an error message. func TestMessageToQueryParametersRecursive(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string } tests := []test{ // First test: // Here we test that a message that references it self through a field will return an error. // Example proto: // message DirectRecursiveMessage { // DirectRecursiveMessage nested = 1; // } { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("DirectRecursiveMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.DirectRecursiveMessage"), Number: proto.Int32(1), }, }, }, }, Message: "DirectRecursiveMessage", }, // Second test: // Here we test that a cycle through multiple messages is detected and that an error is returned. // Sample: // message Root { NodeMessage nested = 1; } // message NodeMessage { CycleMessage nested = 1; } // message CycleMessage { Root nested = 1; } { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("RootMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.NodeMessage"), Number: proto.Int32(1), }, }, }, { Name: proto.String("NodeMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.CycleMessage"), Number: proto.Int32(1), }, }, }, { Name: proto.String("CycleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.RootMessage"), Number: proto.Int32(1), }, }, }, }, Message: "RootMessage", }, } for _, test := range tests { reg := descriptor.NewRegistry() msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } _, err = messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err == nil { t.Fatalf("It should not be allowed to have recursive query parameters") } } } func TestMessageToQueryParametersWithJsonName(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } var requiredField = []annotations.FieldBehavior{annotations.FieldBehavior_REQUIRED} var requiredFieldOptions = new(descriptorpb.FieldOptions) proto.SetExtension(requiredFieldOptions, annotations.E_FieldBehavior, requiredField) messageSchema := &openapi_options.Schema{ JsonSchema: &openapi_options.JSONSchema{ Required: []string{"test_field_b"}, }, } messageOption := &descriptorpb.MessageOptions{} proto.SetExtension(messageOption, openapi_options.E_Openapiv2Schema, messageSchema) tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("test_field_a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), JsonName: proto.String("testFieldA"), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "testFieldA", In: "query", Required: false, Type: "string", }, }, }, { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("SubMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("test_field_a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), JsonName: proto.String("testFieldA"), }, }, }, { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("sub_message"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.SubMessage"), Number: proto.Int32(1), JsonName: proto.String("subMessage"), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "subMessage.testFieldA", In: "query", Required: false, Type: "string", }, }, }, { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("test_field_a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), JsonName: proto.String("testFieldACustom"), Options: requiredFieldOptions, }, { Name: proto.String("test_field_b"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), JsonName: proto.String("testFieldBCustom"), }, }, Options: messageOption, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "testFieldACustom", In: "query", Required: true, Type: "string", }, { Name: "testFieldBCustom", In: "query", Required: true, Type: "string", }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %#v, got %#v", test.Params, params) } } } func TestMessageToQueryParametersWellKnownTypes(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto WellKnownMsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a_field_mask"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".google.protobuf.FieldMask"), Number: proto.Int32(1), }, { Name: proto.String("a_timestamp"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".google.protobuf.Timestamp"), Number: proto.Int32(2), }, }, }, }, WellKnownMsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("FieldMask"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("paths"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Number: proto.Int32(1), }, }, }, { Name: proto.String("Timestamp"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("seconds"), Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), Number: proto.Int32(1), }, { Name: proto.String("nanos"), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(2), }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a_field_mask", In: "query", Required: false, Type: "string", }, { Name: "a_timestamp", In: "query", Required: false, Type: "string", Format: "date-time", }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() reg.SetEnumsAsInts(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ { SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("google/well_known.proto"), Package: proto.String("google.protobuf"), Dependency: []string{}, MessageType: test.WellKnownMsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("google/well_known"), }, }, { SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("acme/example.proto"), Package: proto.String("example"), Dependency: []string{"google/well_known.proto"}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("acme/example"), }, }, }, }) if err != nil { t.Fatalf("failed to load CodeGeneratorRequest: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } func TestMessageToQueryParametersWithRequiredField(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } messageSchema := &openapi_options.Schema{ JsonSchema: &openapi_options.JSONSchema{ Required: []string{"a"}, }, } messageOption := &descriptorpb.MessageOptions{} proto.SetExtension(messageOption, openapi_options.E_Openapiv2Schema, messageSchema) fieldSchema := &openapi_options.JSONSchema{Required: []string{"b"}} fieldOption := &descriptorpb.FieldOptions{} proto.SetExtension(fieldOption, openapi_options.E_Openapiv2Field, fieldSchema) // TODO(makdon): is nested field's test case necessary here? tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), Options: fieldOption, }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Number: proto.Int32(3), }, }, Options: messageOption, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a", In: "query", Required: true, Type: "string", }, { Name: "b", In: "query", Required: true, Type: "number", Format: "double", }, { Name: "c", In: "query", Required: false, Type: "array", CollectionFormat: "multi", }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } // avoid checking Items for array types for i := range params { params[i].Items = nil } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } func TestMessageToQueryParametersWithEnumFieldOption(t *testing.T) { type test struct { MsgDescs []*descriptorpb.DescriptorProto Message string Params []openapiParameterObject } fieldSchema := &openapi_options.JSONSchema{Enum: []string{"enum1", "enum2"}} fieldOption := &descriptorpb.FieldOptions{} proto.SetExtension(fieldOption, openapi_options.E_Openapiv2Field, fieldSchema) tests := []test{ { MsgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("a"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), Options: fieldOption, }, { Name: proto.String("b"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, { Name: proto.String("c"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), TypeName: proto.String(".example.ExampleMessage.EnabledEnum"), Number: proto.Int32(3), }, { Name: proto.String("d"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), TypeName: proto.String(".example.ExampleMessage.EnabledEnum"), Number: proto.Int32(4), Options: fieldOption, }, }, EnumType: []*descriptorpb.EnumDescriptorProto{ { Name: proto.String("EnabledEnum"), Value: []*descriptorpb.EnumValueDescriptorProto{ {Name: proto.String("FALSE"), Number: proto.Int32(0)}, {Name: proto.String("TRUE"), Number: proto.Int32(1)}, }, }, }, }, }, Message: "ExampleMessage", Params: []openapiParameterObject{ { Name: "a", In: "query", Type: "string", Enum: []string{"enum1", "enum2"}, }, { Name: "b", In: "query", Type: "string", }, { Name: "c", In: "query", Type: "string", Enum: []string{"FALSE", "TRUE"}, Default: "FALSE", }, { Name: "d", In: "query", Type: "string", Enum: []string{"FALSE", "TRUE"}, Default: "FALSE", }, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() msgs := []*descriptor.Message{} for _, msgdesc := range test.MsgDescs { msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.MsgDescs, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } message, err := reg.LookupMsg("", ".example."+test.Message) if err != nil { t.Fatalf("failed to lookup message: %s", err) } params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil, "") if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } // avoid checking Items for array types for i := range params { params[i].Items = nil } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } } } func TestApplyTemplateSimple(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := "2.0", result.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := "", result.BasePath, "BasePath"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := ([]string)(nil), result.Schemes, "Schemes"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []string{"application/json"}, result.Consumes, "Consumes"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []string{"application/json"}, result.Produces, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateMultiService(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } // Create two services that have the same method name. We will test that the // operation IDs are different svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } svc2 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("OtherService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, }, }, }, }, }, { ServiceDescriptorProto: svc2, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/ping", }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } // Check that the two services have unique operation IDs even though they // have the same method name. if want, is := "ExampleService_Example", result.getPathItemObject("/v1/echo").Get.OperationID; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", file, is, want) } if want, is := "OtherService_Example", result.getPathItemObject("/v1/ping").Get.OperationID; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", file, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateOpenAPIConfigFromYAML(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } openapiOptions := &openapiconfig.OpenAPIOptions{ Service: []*openapiconfig.OpenAPIServiceOption{ { Service: "example.ExampleService", Option: &openapi_options.Tag{ Description: "ExampleService description", ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Find out more about ExampleService", }, }, }, }, } if err := reg.RegisterOpenAPIOptions(openapiOptions); err != nil { t.Errorf("reg.RegisterOpenAPIOptions for Service %#v failed with %v; want success", openapiOptions.Service, err) return } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := "ExampleService description", result.Tags[0].Description, "Tags[0].Description"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := "Find out more about ExampleService", result.Tags[0].ExternalDocs.Description, "Tags[0].ExternalDocs.Description"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } reg.SetDisableServiceTags(true) res, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if got, want := len(res.Tags), 0; got != want { t.Fatalf("len(applyTemplate(%#v).Tags) = %d want to be %d", file, got, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateOverrideWithOperation(t *testing.T) { newFile := func() *descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), Options: &descriptorpb.MethodOptions{}, } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } return &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } } verifyTemplateFromReq := func(t *testing.T, reg *descriptor.Registry, file *descriptor.File, opts *openapiconfig.OpenAPIOptions) { if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", *file, err) return } if opts != nil { if err := reg.RegisterOpenAPIOptions(opts); err != nil { t.Fatalf("failed to register OpenAPI options: %s", err) } } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", *file, err) return } if want, is := "MyExample", result.getPathItemObject("/v1/echo").Get.OperationID; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", *file, is, want) } if want, is := []string{"application/xml"}, result.getPathItemObject("/v1/echo").Get.Consumes; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.Consumes = %s want to be %s", *file, is, want) } if want, is := []string{"application/json", "application/xml"}, result.getPathItemObject("/v1/echo").Get.Produces; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.Produces = %s want to be %s", *file, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", *file) t.Errorf("got: %s", fmt.Sprint(result)) } } openapiOperation := openapi_options.Operation{ OperationId: "MyExample", Consumes: []string{"application/xml"}, Produces: []string{"application/json", "application/xml"}, } t.Run("verify override via method option", func(t *testing.T) { file := newFile() proto.SetExtension(proto.Message(file.Services[0].Methods[0].MethodDescriptorProto.Options), openapi_options.E_Openapiv2Operation, &openapiOperation) reg := descriptor.NewRegistry() verifyTemplateFromReq(t, reg, file, nil) }) t.Run("verify override options annotations", func(t *testing.T) { file := newFile() reg := descriptor.NewRegistry() opts := &openapiconfig.OpenAPIOptions{ Method: []*openapiconfig.OpenAPIMethodOption{ { Method: "example.ExampleService.Example", Option: &openapiOperation, }, }, } verifyTemplateFromReq(t, reg, file, opts) }) } func TestApplyTemplateExtensions(t *testing.T) { newFile := func() *descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), Options: &descriptorpb.MethodOptions{}, } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } return &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } } swagger := openapi_options.Swagger{ Info: &openapi_options.Info{ Title: "test", Extensions: map[string]*structpb.Value{ "x-info-extension": {Kind: &structpb.Value_StringValue{StringValue: "bar"}}, }, }, Extensions: map[string]*structpb.Value{ "x-foo": {Kind: &structpb.Value_StringValue{StringValue: "bar"}}, "x-bar": {Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{ Values: []*structpb.Value{{Kind: &structpb.Value_StringValue{StringValue: "baz"}}}, }}}, }, SecurityDefinitions: &openapi_options.SecurityDefinitions{ Security: map[string]*openapi_options.SecurityScheme{ "somescheme": { Extensions: map[string]*structpb.Value{ "x-security-baz": {Kind: &structpb.Value_BoolValue{BoolValue: true}}, }, }, }, }, Tags: []*openapi_options.Tag{ { Name: "test tag", Description: "test tag description", Extensions: map[string]*structpb.Value{ "x-traitTag": {Kind: &structpb.Value_BoolValue{BoolValue: true}}, }, }, }, } openapiOperation := openapi_options.Operation{ Responses: map[string]*openapi_options.Response{ "200": { Extensions: map[string]*structpb.Value{ "x-resp-id": {Kind: &structpb.Value_StringValue{StringValue: "resp1000"}}, }, }, }, Extensions: map[string]*structpb.Value{ "x-op-foo": {Kind: &structpb.Value_StringValue{StringValue: "baz"}}, }, } verifyTemplateExtensions := func(t *testing.T, reg *descriptor.Registry, file *descriptor.File, opts *openapiconfig.OpenAPIOptions) { if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } if opts != nil { if err := reg.RegisterOpenAPIOptions(opts); err != nil { t.Fatalf("failed to register OpenAPI annotations: %s", err) } } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := "2.0", result.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if got, want := len(result.extensions), 2; got != want { t.Fatalf("len(applyTemplate(%#v).Extensions) = %d want to be %d", file, got, want) } if got, want := result.extensions[0].key, "x-bar"; got != want { t.Errorf("applyTemplate(%#v).Extensions[0].key = %s want to be %s", file, got, want) } if got, want := result.extensions[1].key, "x-foo"; got != want { t.Errorf("applyTemplate(%#v).Extensions[1].key = %s want to be %s", file, got, want) } { var got []string err = marshaler.Unmarshal(result.extensions[0].value, &got) if err != nil { t.Fatalf("marshaler.Unmarshal failed: %v", err) } want := []string{"baz"} if diff := cmp.Diff(got, want); diff != "" { t.Errorf(diff) } } { var got string err = marshaler.Unmarshal(result.extensions[1].value, &got) if err != nil { t.Fatalf("marshaler.Unmarshal failed: %v", err) } want := "bar" if diff := cmp.Diff(got, want); diff != "" { t.Errorf(diff) } } var scheme openapiSecuritySchemeObject for _, v := range result.SecurityDefinitions { scheme = v } if want, is, name := []extension{ {key: "x-security-baz", value: json.RawMessage("true")}, }, scheme.extensions, "SecurityScheme.Extensions"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []extension{ {key: "x-info-extension", value: json.RawMessage("\"bar\"")}, }, result.Info.extensions, "Info.Extensions"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } var operation *openapiOperationObject var response openapiResponseObject for _, v := range result.Paths { operation = v.PathItemObject.Get response = v.PathItemObject.Get.Responses["200"] } if want, is, name := []extension{ {key: "x-op-foo", value: json.RawMessage("\"baz\"")}, }, operation.extensions, "operation.Extensions"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []extension{ {key: "x-resp-id", value: json.RawMessage("\"resp1000\"")}, }, response.extensions, "response.Extensions"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if len(result.Tags) == 0 { t.Errorf("No tags found in result") return } tag := result.Tags[0] if want, is, name := []extension{ {key: "x-traitTag", value: json.RawMessage("true")}, }, tag.extensions, "Tags[0].Extensions"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } } t.Run("verify template options set via proto options", func(t *testing.T) { file := newFile() proto.SetExtension(proto.Message(file.FileDescriptorProto.Options), openapi_options.E_Openapiv2Swagger, &swagger) proto.SetExtension(proto.Message(file.Services[0].Methods[0].Options), openapi_options.E_Openapiv2Operation, &openapiOperation) reg := descriptor.NewRegistry() verifyTemplateExtensions(t, reg, file, nil) }) t.Run("verify template options set via annotations", func(t *testing.T) { file := newFile() opts := &openapiconfig.OpenAPIOptions{ File: []*openapiconfig.OpenAPIFileOption{ { File: "example.proto", Option: &swagger, }, }, Method: []*openapiconfig.OpenAPIMethodOption{ { Method: "example.ExampleService.Example", Option: &openapiOperation, }, }, } reg := descriptor.NewRegistry() verifyTemplateExtensions(t, reg, file, opts) }) } func TestApplyTemplateHeaders(t *testing.T) { newFile := func() *descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), Options: &descriptorpb.MethodOptions{}, } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } return &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } } openapiOperation := openapi_options.Operation{ Responses: map[string]*openapi_options.Response{ "200": { Description: "Testing Headers", Headers: map[string]*openapi_options.Header{ "string": { Description: "string header description", Type: "string", Format: "uuid", Pattern: "", }, "boolean": { Description: "boolean header description", Type: "boolean", Default: "true", Pattern: "^true|false$", }, "integer": { Description: "integer header description", Type: "integer", Default: "0", Pattern: "^[0-9]$", }, "number": { Description: "number header description", Type: "number", Default: "1.2", Pattern: "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", }, }, }, }, } verifyTemplateHeaders := func(t *testing.T, reg *descriptor.Registry, file *descriptor.File, opts *openapiconfig.OpenAPIOptions) { if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } if opts != nil { if err := reg.RegisterOpenAPIOptions(opts); err != nil { t.Fatalf("failed to register OpenAPI annotations: %s", err) } } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := "2.0", result.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } var response openapiResponseObject for _, v := range result.Paths { response = v.PathItemObject.Get.Responses["200"] } if want, is, name := []openapiHeadersObject{ { "String": openapiHeaderObject{ Description: "string header description", Type: "string", Format: "uuid", Pattern: "", }, "Boolean": openapiHeaderObject{ Description: "boolean header description", Type: "boolean", Default: RawExample("true"), Pattern: "^true|false$", }, "Integer": openapiHeaderObject{ Description: "integer header description", Type: "integer", Default: RawExample("0"), Pattern: "^[0-9]$", }, "Number": openapiHeaderObject{ Description: "number header description", Type: "number", Default: RawExample("1.2"), Pattern: "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", }, }, }[0], response.Headers, "response.Headers"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } } t.Run("verify template options set via proto options", func(t *testing.T) { file := newFile() proto.SetExtension(proto.Message(file.Services[0].Methods[0].Options), openapi_options.E_Openapiv2Operation, &openapiOperation) reg := descriptor.NewRegistry() verifyTemplateHeaders(t, reg, file, nil) }) } func TestValidateHeaderType(t *testing.T) { type test struct { Type string Format string expectedError error } tests := []test{ { "string", "date-time", nil, }, { "boolean", "", nil, }, { "integer", "uint", nil, }, { "integer", "uint8", nil, }, { "integer", "uint16", nil, }, { "integer", "uint32", nil, }, { "integer", "uint64", nil, }, { "integer", "int", nil, }, { "integer", "int8", nil, }, { "integer", "int16", nil, }, { "integer", "int32", nil, }, { "integer", "int64", nil, }, { "integer", "float64", errors.New("the provided format \"float64\" is not a valid extension of the type \"integer\""), }, { "integer", "uuid", errors.New("the provided format \"uuid\" is not a valid extension of the type \"integer\""), }, { "number", "uint", nil, }, { "number", "uint8", nil, }, { "number", "uint16", nil, }, { "number", "uint32", nil, }, { "number", "uint64", nil, }, { "number", "int", nil, }, { "number", "int8", nil, }, { "number", "int16", nil, }, { "number", "int32", nil, }, { "number", "int64", nil, }, { "number", "float", nil, }, { "number", "float32", nil, }, { "number", "float64", nil, }, { "number", "complex64", nil, }, { "number", "complex128", nil, }, { "number", "double", nil, }, { "number", "byte", nil, }, { "number", "rune", nil, }, { "number", "uintptr", nil, }, { "number", "date", errors.New("the provided format \"date\" is not a valid extension of the type \"number\""), }, { "array", "", errors.New("the provided header type \"array\" is not supported"), }, { "foo", "", errors.New("the provided header type \"foo\" is not supported"), }, } for _, v := range tests { err := validateHeaderTypeAndFormat(v.Type, v.Format) if v.expectedError == nil { if err != nil { t.Errorf("unexpected error %v", err) } } else { if err == nil { t.Fatal("expected header error not returned") } if err.Error() != v.expectedError.Error() { t.Errorf("expected error malformed, expected %q, got %q", v.expectedError.Error(), err.Error()) } } } } func TestValidateDefaultValueType(t *testing.T) { type test struct { Type string Value string Format string expectedError error } tests := []test{ { "string", `"string"`, "", nil, }, { "string", "\"2012-11-01T22:08:41+00:00\"", "date-time", nil, }, { "string", "\"2012-11-01\"", "date", nil, }, { "string", "0", "", errors.New("the provided default value \"0\" does not match provider type \"string\", or is not properly quoted with escaped quotations"), }, { "string", "false", "", errors.New("the provided default value \"false\" does not match provider type \"string\", or is not properly quoted with escaped quotations"), }, { "boolean", "true", "", nil, }, { "boolean", "0", "", errors.New("the provided default value \"0\" does not match provider type \"boolean\""), }, { "boolean", `"string"`, "", errors.New("the provided default value \"\\\"string\\\"\" does not match provider type \"boolean\""), }, { "number", "1.2", "", nil, }, { "number", "123", "", nil, }, { "number", "nan", "", errors.New("the provided number \"nan\" is not a valid JSON number"), }, { "number", "NaN", "", errors.New("the provided number \"NaN\" is not a valid JSON number"), }, { "number", "-459.67", "", nil, }, { "number", "inf", "", errors.New("the provided number \"inf\" is not a valid JSON number"), }, { "number", "infinity", "", errors.New("the provided number \"infinity\" is not a valid JSON number"), }, { "number", "Inf", "", errors.New("the provided number \"Inf\" is not a valid JSON number"), }, { "number", "Infinity", "", errors.New("the provided number \"Infinity\" is not a valid JSON number"), }, { "number", "false", "", errors.New("the provided default value \"false\" does not match provider type \"number\""), }, { "number", `"string"`, "", errors.New("the provided default value \"\\\"string\\\"\" does not match provider type \"number\""), }, { "integer", "2", "", nil, }, { "integer", fmt.Sprint(math.MaxInt32), "int32", nil, }, { "integer", fmt.Sprint(math.MaxInt32 + 1), "int32", errors.New("the provided default value \"2147483648\" does not match provided format \"int32\""), }, { "integer", fmt.Sprint(math.MaxInt64), "int64", nil, }, { "integer", "9223372036854775808", "int64", errors.New("the provided default value \"9223372036854775808\" does not match provided format \"int64\""), }, { "integer", "18446744073709551615", "uint64", nil, }, { "integer", "false", "", errors.New("the provided default value \"false\" does not match provided type \"integer\""), }, { "integer", "1.2", "", errors.New("the provided default value \"1.2\" does not match provided type \"integer\""), }, { "integer", `"string"`, "", errors.New("the provided default value \"\\\"string\\\"\" does not match provided type \"integer\""), }, } for _, v := range tests { err := validateDefaultValueTypeAndFormat(v.Type, v.Value, v.Format) if v.expectedError == nil { if err != nil { t.Errorf("unexpected error '%v'", err) } } else { if err == nil { t.Error("expected update error not returned") } if err.Error() != v.expectedError.Error() { t.Errorf("expected error malformed, expected %q, got %q", v.expectedError.Error(), err.Error()) } } } } func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(false), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } meth.ServerStreaming = proto.Bool(false) msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew): Figure out what this should really be }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, }), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fmt.Fprintln(os.Stderr, "fd", file.FileDescriptorProto) err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } fmt.Fprintln(os.Stderr, "AllFQMNs", reg.GetAllFQMNs()) result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, got := "2.0", result.Swagger; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Swagger = %s want to be %s", file, got, want) } if want, got := "", result.BasePath; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).BasePath = %s want to be %s", file, got, want) } if want, got := ([]string)(nil), result.Schemes; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Schemes = %s want to be %s", file, got, want) } if want, got := []string{"application/json"}, result.Consumes; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Consumes = %s want to be %s", file, got, want) } if want, got := []string{"application/json"}, result.Produces; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Produces = %s want to be %s", file, got, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(true), ServerStreaming: proto.Bool(true), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew): Figure out what this should really be }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, }), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } // Only ExampleMessage must be present, not NestedMessage if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } if _, ok := result.getPathItemObject("/v1/echo").Post.Responses["200"]; !ok { t.Errorf("applyTemplate(%#v).%s = expected 200 response to be defined", file, `result.getPathItemObject("/v1/echo").Post.Responses["200"]`) } else { if want, got, name := "A successful response.(streaming responses)", result.getPathItemObject("/v1/echo").Post.Responses["200"].Description, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessage := result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema if want, got, name := "object", streamExampleExampleMessage.Type, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Type`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } if want, got, name := "Stream result of exampleExampleMessage", streamExampleExampleMessage.Title, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Title`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessageProperties := *(streamExampleExampleMessage.Properties) if want, got, name := 2, len(streamExampleExampleMessageProperties), `len(StreamDefinitions["exampleExampleMessage"].Properties)`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } else { resultProperty := streamExampleExampleMessageProperties[0] if want, got, name := "result", resultProperty.Key, `(*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Key`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } result := resultProperty.Value.(openapiSchemaObject) if want, got, name := "#/definitions/exampleExampleMessage", result.Ref, `((*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Value.(openapiSchemaObject)).Ref`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } errorProperty := streamExampleExampleMessageProperties[1] if want, got, name := "error", errorProperty.Key, `(*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Key`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } err := errorProperty.Value.(openapiSchemaObject) if want, got, name := "#/definitions/rpcStatus", err.Ref, `((*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Value.(openapiSchemaObject)).Ref`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } } } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateRequestWithServerStreamingAndNoStandardErrors(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String("NestedMessage"), Number: proto.Int32(1), }, }, } nesteddesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestedMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("int32"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Number: proto.Int32(1), }, { Name: proto.String("bool"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), ClientStreaming: proto.Bool(false), ServerStreaming: proto.Bool(true), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } nested := &descriptor.Message{ DescriptorProto: nesteddesc, } nestedField := &descriptor.Field{ Message: msg, FieldDescriptorProto: msg.GetField()[0], } intField := &descriptor.Field{ Message: nested, FieldDescriptorProto: nested.GetField()[0], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc, nesteddesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nested}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, { Name: "int32", Target: intField, }, }), Target: intField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "nested", Target: nestedField, }, }), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } reg.SetDisableDefaultErrors(true) result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } // Should only include the message, no status or any type if want, got, name := 1, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } if _, ok := result.getPathItemObject("/v1/echo").Post.Responses["200"]; !ok { t.Errorf("applyTemplate(%#v).%s = expected 200 response to be defined", file, `result.getPathItemObject("/v1/echo").Post.Responses["200"]`) } else { if want, got, name := "A successful response.(streaming responses)", result.getPathItemObject("/v1/echo").Post.Responses["200"].Description, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessage := result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema if want, got, name := "object", streamExampleExampleMessage.Type, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Type`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } if want, got, name := "Stream result of exampleExampleMessage", streamExampleExampleMessage.Title, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Title`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessageProperties := *(streamExampleExampleMessage.Properties) if want, got, name := 1, len(streamExampleExampleMessageProperties), `len(StreamDefinitions["exampleExampleMessage"].Properties)`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } else { resultProperty := streamExampleExampleMessageProperties[0] if want, got, name := "result", resultProperty.Key, `(*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Key`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } result := resultProperty.Value.(openapiSchemaObject) if want, got, name := "#/definitions/exampleExampleMessage", result.Ref, `((*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Value.(openapiSchemaObject)).Ref`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } } } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateRequestWithUnusedReferences(t *testing.T) { reqdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("string"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } respdesc := &descriptorpb.DescriptorProto{ Name: proto.String("EmptyMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("EmptyMessage"), ClientStreaming: proto.Bool(false), ServerStreaming: proto.Bool(false), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } req := &descriptor.Message{ DescriptorProto: reqdesc, } resp := &descriptor.Message{ DescriptorProto: respdesc, } stringField := &descriptor.Field{ Message: req, FieldDescriptorProto: req.GetField()[0], } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{reqdesc, respdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{req, resp}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: req, ResponseType: resp, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/example", }, }, { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/example/{string}", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "string", Target: stringField, }, }), Target: stringField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "string", Target: stringField, }, }), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } // Only EmptyMessage must be present, not ExampleMessage (plus error status) if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateRequestWithBodyQueryParameters(t *testing.T) { bookDesc := &descriptorpb.DescriptorProto{ Name: proto.String("Book"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("name"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("id"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, } createDesc := &descriptorpb.DescriptorProto{ Name: proto.String("CreateBookRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("parent"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("book"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, { Name: proto.String("book_id"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("CreateBook"), InputType: proto.String("CreateBookRequest"), OutputType: proto.String("Book"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("BookService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } bookMsg := &descriptor.Message{ DescriptorProto: bookDesc, } createMsg := &descriptor.Message{ DescriptorProto: createDesc, } parentField := &descriptor.Field{ Message: createMsg, FieldDescriptorProto: createMsg.GetField()[0], } bookField := &descriptor.Field{ Message: createMsg, FieldMessage: bookMsg, FieldDescriptorProto: createMsg.GetField()[1], } bookIDField := &descriptor.Field{ Message: createMsg, FieldDescriptorProto: createMsg.GetField()[2], } createMsg.Fields = []*descriptor.Field{parentField, bookField, bookIDField} newFile := func() descriptor.File { return descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("book.proto"), MessageType: []*descriptorpb.DescriptorProto{bookDesc, createDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/book.pb", Name: "book_pb", }, Messages: []*descriptor.Message{bookMsg, createMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: createMsg, ResponseType: bookMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{parent=publishers/*}/books", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "parent", Target: parentField, }, }), Target: parentField, }, }, Body: &descriptor.Body{ FieldPath: []descriptor.FieldPathComponent{ { Name: "book", Target: bookField, }, }, }, }, }, }, }, }, }, } } type args struct { file descriptor.File } type paramOut struct { Name string In string Required bool } tests := []struct { name string args args want []paramOut }{ { name: "book_in_body", args: args{file: newFile()}, want: []paramOut{ {"parent", "path", true}, {"book", "body", true}, {"book_id", "query", false}, }, }, { name: "book_in_query", args: args{file: func() descriptor.File { f := newFile() f.Services[0].Methods[0].Bindings[0].Body = nil return f }()}, want: []paramOut{ {"parent", "path", true}, {"book", "query", false}, {"book_id", "query", false}, }, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{tt.args.file.FileDescriptorProto}}) if err != nil { t.Errorf("Registry.Load() failed with %v; want success", err) return } result, err := applyTemplate(param{File: crossLinkFixture(&tt.args.file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", tt.args.file, err) return } if _, ok := result.getPathItemObject("/v1/{parent}/books").Post.Responses["200"]; !ok { t.Errorf("applyTemplate(%#v).%s = expected 200 response to be defined", tt.args.file, `result.getPathItemObject("/v1/{parent}/books").Post.Responses["200"]`) } else { if want, got, name := 3, len(result.getPathItemObject("/v1/{parent}/books").Post.Parameters), `len(result.getPathItemObject("/v1/{parent}/books").Post.Parameters)`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", tt.args.file, name, got, want) } for i, want := range tt.want { p := result.getPathItemObject("/v1/{parent}/books").Post.Parameters[i] if got, name := (paramOut{p.Name, p.In, p.Required}), `result.getPathItemObject("/v1/{parent}/books").Post.Parameters[0]`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %v want to be %v", tt.args.file, name, got, want) } } } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", tt.args.file) t.Errorf("got: %s", fmt.Sprint(result)) } }) } } func TestApplyTemplateWithRequestAndBodyParameters(t *testing.T) { bookDesc := &descriptorpb.DescriptorProto{ Name: proto.String("Book"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("name"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("id"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, } createDesc := &descriptorpb.DescriptorProto{ Name: proto.String("CreateBookRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("parent"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("book"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, { Name: proto.String("book_id"), Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("CreateBook"), InputType: proto.String("CreateBookRequest"), OutputType: proto.String("Book"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("BookService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } bookMsg := &descriptor.Message{ DescriptorProto: bookDesc, } createMsg := &descriptor.Message{ DescriptorProto: createDesc, } parentField := &descriptor.Field{ Message: createMsg, FieldDescriptorProto: createMsg.GetField()[0], } bookField := &descriptor.Field{ Message: createMsg, FieldMessage: bookMsg, FieldDescriptorProto: createMsg.GetField()[1], } bookIDField := &descriptor.Field{ Message: createMsg, FieldDescriptorProto: createMsg.GetField()[2], } createMsg.Fields = []*descriptor.Field{parentField, bookField, bookIDField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("book.proto"), MessageType: []*descriptorpb.DescriptorProto{bookDesc, createDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/book.pb", Name: "book_pb", }, Messages: []*descriptor.Message{bookMsg, createMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: createMsg, ResponseType: bookMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{parent=publishers/*}/books", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "parent", Target: parentField, }, }), Target: parentField, }, }, Body: &descriptor.Body{ FieldPath: []descriptor.FieldPathComponent{}, }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) return } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := "2.0", result.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := "", result.BasePath, "BasePath"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := ([]string)(nil), result.Schemes, "Schemes"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []string{"application/json"}, result.Consumes, "Consumes"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []string{"application/json"}, result.Produces, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := 1, len(result.Paths), "len(result.Paths)"; !reflect.DeepEqual(is, want) { t.Errorf("%s = %d want to be %d", name, want, is) } if want, is, name := 4, len(result.Paths[0].PathItemObject.Post.Parameters), "len(result.Paths[0].PathItemObject.Post.Parameters)"; !reflect.DeepEqual(is, want) { t.Errorf("%s = %d want to be %d", name, want, is) } if want, is, name := "#/definitions/BookServiceCreateBookBody", result.Paths[0].PathItemObject.Post.Parameters[1].Schema.schemaCore.Ref, "result.Paths[0].PathItemObject.Post.Parameters[1].Schema.schemaCore.Ref"; !reflect.DeepEqual(is, want) { t.Errorf("%s = %s want to be %s", name, want, is) } _, found := result.Definitions["BookServiceCreateBookBody"] if !found { t.Error("expecting definition to contain BookServiceCreateBookBody") } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } // TestApplyTemplateProtobufAny tests that the protobufAny definition is correctly rendered with the @type field and // allowing additional properties. func TestApplyTemplateProtobufAny(t *testing.T) { // checkProtobufAnyFormat verifies the only property should be @type and additional properties are allowed checkProtobufAnyFormat := func(t *testing.T, protobufAny openapiSchemaObject) { anyPropsJSON, err := protobufAny.Properties.MarshalJSON() if err != nil { t.Errorf("protobufAny.Properties.MarshalJSON(), got error = %v", err) } var anyPropsMap map[string]interface{} if err := json.Unmarshal(anyPropsJSON, &anyPropsMap); err != nil { t.Errorf("json.Unmarshal(), got error = %v", err) } // @type should exist if _, ok := anyPropsMap["@type"]; !ok { t.Errorf("protobufAny.Properties missing key, \"@type\". got = %#v", anyPropsMap) } // and @type should be the only property if len(anyPropsMap) > 1 { t.Errorf("len(protobufAny.Properties) = %v, want = %v", len(anyPropsMap), 1) } // protobufAny should have additionalProperties allowed if protobufAny.AdditionalProperties == nil { t.Errorf("protobufAny.AdditionalProperties = nil, want not-nil") } } type args struct { regConfig func(registry *descriptor.Registry) msgContainsAny bool } tests := []struct { name string args args wantNumDefinitions int }{ { // our proto schema doesn't directly use protobufAny, but it is implicitly used by rpcStatus being // automatically rendered name: "default_protobufAny_from_rpcStatus", args: args{ msgContainsAny: false, }, wantNumDefinitions: 4, }, { // we have a protobufAny in a message, it should contain a ref inside the custom message name: "protobufAny_referenced_in_message", args: args{ msgContainsAny: true, }, wantNumDefinitions: 4, }, { // we have a protobufAny in a message but with automatic rendering of rpcStatus disabled name: "protobufAny_referenced_in_message_with_default_errors_disabled", args: args{ msgContainsAny: true, regConfig: func(reg *descriptor.Registry) { reg.SetDisableDefaultErrors(true) }, }, wantNumDefinitions: 3, }, { // we have a protobufAny in a message but with automatic rendering of responses disabled name: "protobufAny_referenced_in_message_with_default_responses_disabled", args: args{ msgContainsAny: true, regConfig: func(reg *descriptor.Registry) { reg.SetDisableDefaultResponses(true) }, }, wantNumDefinitions: 4, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { reqdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("name"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } respdesc := &descriptorpb.DescriptorProto{ Name: proto.String("EmptyMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("EmptyMessage"), ClientStreaming: proto.Bool(false), ServerStreaming: proto.Bool(false), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } req := &descriptor.Message{ DescriptorProto: reqdesc, } resp := &descriptor.Message{ DescriptorProto: respdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{reqdesc, respdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{req, resp}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: req, ResponseType: resp, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetGenerateUnboundMethods(true) if tt.args.regConfig != nil { tt.args.regConfig(reg) } if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } protoFiles := []*descriptorpb.FileDescriptorProto{ file.FileDescriptorProto, } if tt.args.msgContainsAny { // add an Any field to the request message reqdesc.Field = append(reqdesc.Field, &descriptorpb.FieldDescriptorProto{ Name: proto.String("any_value"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".google.protobuf.Any"), Number: proto.Int32(2), }) // update the dependencies to import it file.Dependency = append(file.Dependency, "google/protobuf/any.proto") anyDescriptorProto := protodesc.ToFileDescriptorProto((&anypb.Any{}).ProtoReflect().Descriptor().ParentFile()) anyDescriptorProto.SourceCodeInfo = &descriptorpb.SourceCodeInfo{} // prepend the anyDescriptorProto to the protoFiles slice so that the dependency can be resolved protoFiles = append(append(make([]*descriptorpb.FileDescriptorProto, 0, len(protoFiles)+1), anyDescriptorProto), protoFiles[0:]...) } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: protoFiles, FileToGenerate: []string{file.GetName()}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } target, err := reg.LookupFile(file.GetName()) if err != nil { t.Fatalf("failed to lookup file from reg: %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(target), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, got, name := tt.wantNumDefinitions, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } protobufAny, ok := result.Definitions["protobufAny"] if !ok { t.Error("expecting Definitions to contain protobufAny") } checkProtobufAnyFormat(t, protobufAny) // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) resultJSON, _ := json.Marshal(result) t.Errorf("got: %s", resultJSON) } }) } } func generateFieldsForJSONReservedName() []*descriptor.Field { fields := make([]*descriptor.Field, 0) fieldName := "json_name" fieldJSONName := "jsonNAME" fieldDescriptor := descriptorpb.FieldDescriptorProto{Name: &fieldName, JsonName: &fieldJSONName} field := &descriptor.Field{FieldDescriptorProto: &fieldDescriptor} return append(fields, field) } func generateMsgsForJSONReservedName() []*descriptor.Message { result := make([]*descriptor.Message, 0) // The first message, its field is field_abc and its type is NewType // NewType field_abc fieldName := "field_abc" fieldJSONName := "fieldAbc" messageName1 := "message1" messageType := "pkg.a.NewType" pfd := descriptorpb.FieldDescriptorProto{Name: &fieldName, JsonName: &fieldJSONName, TypeName: &messageType} result = append(result, &descriptor.Message{ DescriptorProto: &descriptorpb.DescriptorProto{ Name: &messageName1, Field: []*descriptorpb.FieldDescriptorProto{&pfd}, }, }) // The second message, its name is NewName, its type is string // message NewType { // string field_newName [json_name = RESERVEDJSONNAME] // } messageName := "NewType" field := "field_newName" fieldJSONName2 := "RESERVEDJSONNAME" pfd2 := descriptorpb.FieldDescriptorProto{Name: &field, JsonName: &fieldJSONName2} result = append(result, &descriptor.Message{ DescriptorProto: &descriptorpb.DescriptorProto{ Name: &messageName, Field: []*descriptorpb.FieldDescriptorProto{&pfd2}, }, }) return result } func TestTemplateWithJsonCamelCase(t *testing.T) { var tests = []struct { input string expected string }{ {"/test/{test_id}", "/test/{testId}"}, {"/test1/{test1_id}/test2/{test2_id}", "/test1/{test1Id}/test2/{test2Id}"}, {"/test1/{test1_id}/{test2_id}", "/test1/{test1Id}/{test2Id}"}, {"/test1/test2/{test1_id}/{test2_id}", "/test1/test2/{test1Id}/{test2Id}"}, {"/test1/{test1_id1_id2}", "/test1/{test1Id1Id2}"}, {"/test1/{test1_id1_id2}/test2/{test2_id3_id4}", "/test1/{test1Id1Id2}/test2/{test2Id3Id4}"}, {"/test1/test2/{test1_id1_id2}/{test2_id3_id4}", "/test1/test2/{test1Id1Id2}/{test2Id3Id4}"}, {"test/{a}", "test/{a}"}, {"test/{ab}", "test/{ab}"}, {"test/{a_a}", "test/{aA}"}, {"test/{ab_c}", "test/{abC}"}, {"test/{json_name}", "test/{jsonNAME}"}, {"test/{field_abc.field_newName}", "test/{fieldAbc.RESERVEDJSONNAME}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } } func TestTemplateWithoutJsonCamelCase(t *testing.T) { var tests = []struct { input string expected string }{ {"/test/{test_id}", "/test/{test_id}"}, {"/test1/{test1_id}/test2/{test2_id}", "/test1/{test1_id}/test2/{test2_id}"}, {"/test1/{test1_id}/{test2_id}", "/test1/{test1_id}/{test2_id}"}, {"/test1/test2/{test1_id}/{test2_id}", "/test1/test2/{test1_id}/{test2_id}"}, {"/test1/{test1_id1_id2}", "/test1/{test1_id1_id2}"}, {"/test1/{test1_id1_id2}/test2/{test2_id3_id4}", "/test1/{test1_id1_id2}/test2/{test2_id3_id4}"}, {"/test1/test2/{test1_id1_id2}/{test2_id3_id4}", "/test1/test2/{test1_id1_id2}/{test2_id3_id4}"}, {"test/{a}", "test/{a}"}, {"test/{ab}", "test/{ab}"}, {"test/{a_a}", "test/{a_a}"}, {"test/{json_name}", "test/{json_name}"}, {"test/{field_abc.field_newName}", "test/{field_abc.field_newName}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } } func TestTemplateToOpenAPIPath(t *testing.T) { var tests = []struct { input string expected string }{ {"/test", "/test"}, {"/{test}", "/{test}"}, {"/{test=prefix/*}", "/{test}"}, {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, {"/{name=prefix/*}", "/{name}"}, {"/{name=prefix1/*/prefix2/*}", "/{name}"}, {"/{user.name=prefix/*}", "/{user.name}"}, {"/{user.name=prefix1/*/prefix2/*}", "/{user.name}"}, {"/{parent=prefix/*}/children", "/{parent}/children"}, {"/{name=prefix/*}:customMethod", "/{name}:customMethod"}, {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name}:customMethod"}, {"/{user.name=prefix/*}:customMethod", "/{user.name}:customMethod"}, {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name}:customMethod"}, {"/{parent=prefix/*}/children:customMethod", "/{parent}/children:customMethod"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } } func BenchmarkTemplateToOpenAPIPath(b *testing.B) { const input = "/{user.name=prefix1/*/prefix2/*}:customMethod" b.Run("with JSON names", func(b *testing.B) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for i := 0; i < b.N; i++ { _ = templateToOpenAPIPath(input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) } }) b.Run("without JSON names", func(b *testing.B) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) for i := 0; i < b.N; i++ { _ = templateToOpenAPIPath(input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) } }) } func TestResolveFullyQualifiedNameToOpenAPIName(t *testing.T) { var tests = []struct { input string output string listOfFQMNs []string namingStrategy string }{ { ".a.b.C", "C", []string{ ".a.b.C", }, "legacy", }, { ".a.b.C", "C", []string{ ".a.b.C", }, "simple", }, { ".a.b.C", "abC", []string{ ".a.C", ".a.b.C", }, "legacy", }, { ".a.b.C", "b.C", []string{ ".a.C", ".a.b.C", }, "simple", }, { ".a.b.C", "abC", []string{ ".C", ".a.C", ".a.b.C", }, "legacy", }, { ".a.b.C", "b.C", []string{ ".C", ".a.C", ".a.b.C", }, "simple", }, { ".a.b.C", "a.b.C", []string{ ".C", ".a.C", ".a.b.C", }, "fqn", }, } for _, data := range tests { names := resolveFullyQualifiedNameToOpenAPINames(data.listOfFQMNs, data.namingStrategy) output := names[data.input] if output != data.output { t.Errorf("Expected fullyQualifiedNameToOpenAPIName(%v, %s) to be %s but got %s", data.input, data.namingStrategy, data.output, output) } } } func templateToOpenAPIPath(path string, reg *descriptor.Registry, fields []*descriptor.Field, msgs []*descriptor.Message, pathParamNames map[string]string) string { return partsToOpenAPIPath(templateToParts(path, reg, fields, msgs), pathParamNames) } func templateToRegexpMap(path string, reg *descriptor.Registry, fields []*descriptor.Field, msgs []*descriptor.Message) map[string]string { return partsToRegexpMap(templateToParts(path, reg, fields, msgs)) } func TestFQMNToRegexpMap(t *testing.T) { var tests = []struct { input string expected map[string]string }{ {"/test", map[string]string{}}, {"/{test}", map[string]string{}}, {"/{test" + pathParamUniqueSuffixDeliminator + "1=prefix/*}", map[string]string{"test" + pathParamUniqueSuffixDeliminator + "1": "prefix/[^/]+"}}, {"/{test=prefix/that/has/multiple/parts/to/it/**}", map[string]string{"test": "prefix/that/has/multiple/parts/to/it/.+"}}, {"/{test1=organizations/*}/{test2=divisions/*}", map[string]string{ "test1": "organizations/[^/]+", "test2": "divisions/[^/]+", }}, {"/v1/{name=projects/*/topics/*}:delete", map[string]string{"name": "projects/[^/]+/topics/[^/]+"}}, } reg := descriptor.NewRegistry() for _, data := range tests { actual := templateToRegexpMap(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if !reflect.DeepEqual(data.expected, actual) { t.Errorf("Expected partsToRegexpMap(%v) = %v, actual: %v", data.input, data.expected, actual) } } } func TestFQMNtoOpenAPIName(t *testing.T) { var tests = []struct { input string expected string }{ {"/test", "/test"}, {"/{test}", "/{test}"}, {"/{test=prefix/*}", "/{test}"}, {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, {"/v1/{name=tests/*}/tests", "/v1/{name}/tests"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { actual := templateToOpenAPIPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName(), make(map[string]string)) if data.expected != actual { t.Errorf("Expected templateToOpenAPIPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } } func TestSchemaOfField(t *testing.T) { type test struct { field *descriptor.Field refs refMap expected openapiSchemaObject openAPIOptions *openapiconfig.OpenAPIOptions useJSONNamesForFields bool } jsonSchema := &openapi_options.JSONSchema{ Title: "field title", Description: "field description", } jsonSchemaWithOptions := &openapi_options.JSONSchema{ Title: "field title", Description: "field description", MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", MaxItems: 20, MinItems: 2, UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, } jsonSchemaRequired := &openapi_options.JSONSchema{ Required: []string{"required_via_json_schema"}, } jsonSchemaWithFormat := &openapi_options.JSONSchema{ Format: "uuid", } var fieldOptions = new(descriptorpb.FieldOptions) proto.SetExtension(fieldOptions, openapi_options.E_Openapiv2Field, jsonSchema) var requiredField = []annotations.FieldBehavior{annotations.FieldBehavior_REQUIRED} var requiredFieldOptions = new(descriptorpb.FieldOptions) proto.SetExtension(requiredFieldOptions, annotations.E_FieldBehavior, requiredField) var outputOnlyField = []annotations.FieldBehavior{annotations.FieldBehavior_OUTPUT_ONLY} var outputOnlyOptions = new(descriptorpb.FieldOptions) proto.SetExtension(outputOnlyOptions, annotations.E_FieldBehavior, outputOnlyField) tests := []test{ { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("primitive_field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("repeated_primitive_field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("empty_field"), TypeName: proto.String(".google.protobuf.Empty"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, Properties: &openapiSchemaObjectProperties{}, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.FieldMask"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Timestamp"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Format: "date-time", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Duration"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.StringValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("repeated_wrapped_field"), TypeName: proto.String(".google.protobuf.StringValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.BytesValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Format: "byte", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Int32Value"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "integer", Format: "int32", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.UInt32Value"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "integer", Format: "int64", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Int64Value"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Format: "int64", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.UInt64Value"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Format: "uint64", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.FloatValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "number", Format: "float", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.DoubleValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "number", Format: "double", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.BoolValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "boolean", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Struct"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.Value"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{}, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.ListValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{schemaCore: schemaCore{ Type: "object", }}, }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("wrapped_field"), TypeName: proto.String(".google.protobuf.NullValue"), Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("message_field"), TypeName: proto.String(".example.Message"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), }, }, refs: refMap{".example.Message": struct{}{}}, expected: openapiSchemaObject{ schemaCore: schemaCore{ Ref: "#/definitions/exampleMessage", }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("map_field"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Message.MapFieldEntry"), Options: fieldOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, AdditionalProperties: &openapiSchemaObject{ schemaCore: schemaCore{Type: "string"}, }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("array_field"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Options: fieldOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{schemaCore: schemaCore{ Type: "string", }}, }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("primitive_field"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), Options: fieldOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "integer", Format: "int32", }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("message_field"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Empty"), Options: fieldOptions, }, }, refs: refMap{".example.Empty": struct{}{}}, expected: openapiSchemaObject{ schemaCore: schemaCore{ Ref: "#/definitions/exampleEmpty", }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("map_field"), // should be called map_field_option but it's not valid map field name Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Message.MapFieldEntry"), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.map_field", Option: jsonSchema, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, AdditionalProperties: &openapiSchemaObject{ schemaCore: schemaCore{Type: "string"}, }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("array_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.array_field_option", Option: jsonSchema, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{schemaCore: schemaCore{ Type: "string", }}, }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("primitive_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.primitive_field_option", Option: jsonSchema, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "integer", Format: "int32", }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("primitive_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum().Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.primitive_field_option", Option: &openapi_options.JSONSchema{ Title: "field title", Description: "field description", Format: "uuid", }, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", Format: "uuid", }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("message_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Empty"), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.message_field_option", Option: jsonSchema, }, }, }, refs: refMap{".example.Empty": struct{}{}}, expected: openapiSchemaObject{ schemaCore: schemaCore{ Ref: "#/definitions/exampleEmpty", }, Title: "field title", Description: "field description", }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("required_via_field_behavior_field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Options: requiredFieldOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, Required: []string{"required_via_field_behavior_field"}, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("readonly_via_field_behavior_field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Options: outputOnlyOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, ReadOnly: true, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("required_message_field"), TypeName: proto.String(".example.Message"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), Options: requiredFieldOptions, }, }, refs: refMap{".example.Message": struct{}{}}, expected: openapiSchemaObject{ schemaCore: schemaCore{ Ref: "#/definitions/exampleMessage", }, Required: []string{"required_message_field"}, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("array_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.array_field_option", Option: jsonSchemaWithOptions, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", }, MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, Title: "field title", Description: "field description", MaxItems: 20, MinItems: 2, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("array_field_option"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.array_field_option", Option: jsonSchemaWithOptions, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", Format: "int64", }, MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, Title: "field title", Description: "field description", MaxItems: 20, MinItems: 2, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("array_field_format"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.array_field_format", Option: jsonSchemaWithFormat, }, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "string", Format: "uuid", }, }, }, }, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("required_via_field_behavior_field_json_name"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), JsonName: proto.String("required_field_custom_name"), Options: requiredFieldOptions, }, }, refs: make(refMap), expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, Required: []string{"required_field_custom_name"}, }, useJSONNamesForFields: true, }, { field: &descriptor.Field{ FieldDescriptorProto: &descriptorpb.FieldDescriptorProto{ Name: proto.String("required_via_json_schema"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), JsonName: proto.String("required_via_json_schema_json_name"), }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.required_via_json_schema", Option: jsonSchemaRequired, }, }, }, refs: make(refMap), useJSONNamesForFields: true, expected: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, Required: []string{"required_via_json_schema_json_name"}, }, }, } for _, test := range tests { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(test.useJSONNamesForFields) req := &pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ { Name: proto.String("third_party/google.proto"), Package: proto.String("google.protobuf"), Options: &descriptorpb.FileOptions{ GoPackage: proto.String("third_party/google"), }, MessageType: []*descriptorpb.DescriptorProto{ protodesc.ToDescriptorProto((&emptypb.Empty{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&structpb.Struct{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&structpb.Value{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&structpb.ListValue{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&field_mask.FieldMask{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((×tamppb.Timestamp{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&durationpb.Duration{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.StringValue{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.BytesValue{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.Int32Value{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.UInt32Value{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.Int64Value{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.UInt64Value{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.FloatValue{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.DoubleValue{}).ProtoReflect().Descriptor()), protodesc.ToDescriptorProto((&wrapperspb.BoolValue{}).ProtoReflect().Descriptor()), }, EnumType: []*descriptorpb.EnumDescriptorProto{ protodesc.ToEnumDescriptorProto(structpb.NullValue(0).Descriptor()), }, }, { SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{"third_party/google.proto"}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, MessageType: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("value"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, func() *descriptorpb.FieldDescriptorProto { fd := test.field.FieldDescriptorProto fd.Number = proto.Int32(2) return fd }(), }, NestedType: []*descriptorpb.DescriptorProto{ { Name: proto.String("MapFieldEntry"), Options: &descriptorpb.MessageOptions{MapEntry: proto.Bool(true)}, Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("key"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("value"), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, }, }, }, { Name: proto.String("Empty"), }, }, EnumType: []*descriptorpb.EnumDescriptorProto{ { Name: proto.String("MessageType"), Value: []*descriptorpb.EnumValueDescriptorProto{ { Name: proto.String("MESSAGE_TYPE_1"), Number: proto.Int32(0), }, }, }, }, Service: []*descriptorpb.ServiceDescriptorProto{}, }, }, } err := reg.Load(req) if err != nil { t.Errorf("failed to reg.Load(req): %v", err) } // set field's parent message pointer to message so field can resolve its FQFN test.field.Message = &descriptor.Message{ DescriptorProto: req.ProtoFile[1].MessageType[0], File: &descriptor.File{ FileDescriptorProto: req.ProtoFile[1], }, } if test.openAPIOptions != nil { if err := reg.RegisterOpenAPIOptions(test.openAPIOptions); err != nil { t.Fatalf("failed to register OpenAPI options: %s", err) } } refs := make(refMap) actual := schemaOfField(test.field, reg, refs) expectedSchemaObject := test.expected if e, a := expectedSchemaObject, actual; !reflect.DeepEqual(a, e) { t.Errorf("Expected schemaOfField(%v) = \n%#+v, actual: \n%#+v", test.field, e, a) } if !reflect.DeepEqual(refs, test.refs) { t.Errorf("Expected schemaOfField(%v) to add refs %v, not %v", test.field, test.refs, refs) } } } func TestRenderMessagesAsDefinition(t *testing.T) { jsonSchema := &openapi_options.JSONSchema{ Title: "field title", Description: "field description", Required: []string{"aRequiredField"}, } var requiredField = new(descriptorpb.FieldOptions) proto.SetExtension(requiredField, openapi_options.E_Openapiv2Field, jsonSchema) var fieldBehaviorRequired = []annotations.FieldBehavior{annotations.FieldBehavior_REQUIRED} var requiredFieldOptions = new(descriptorpb.FieldOptions) proto.SetExtension(requiredFieldOptions, annotations.E_FieldBehavior, fieldBehaviorRequired) var fieldBehaviorOutputOnlyField = []annotations.FieldBehavior{annotations.FieldBehavior_OUTPUT_ONLY} var fieldBehaviorOutputOnlyOptions = new(descriptorpb.FieldOptions) proto.SetExtension(fieldBehaviorOutputOnlyOptions, annotations.E_FieldBehavior, fieldBehaviorOutputOnlyField) var fieldVisibilityFieldInternal = &visibility.VisibilityRule{Restriction: "INTERNAL"} var fieldVisibilityInternalOption = new(descriptorpb.FieldOptions) proto.SetExtension(fieldVisibilityInternalOption, visibility.E_FieldVisibility, fieldVisibilityFieldInternal) var fieldVisibilityFieldPreview = &visibility.VisibilityRule{Restriction: "INTERNAL,PREVIEW"} var fieldVisibilityPreviewOption = new(descriptorpb.FieldOptions) proto.SetExtension(fieldVisibilityPreviewOption, visibility.E_FieldVisibility, fieldVisibilityFieldPreview) tests := []struct { descr string msgDescs []*descriptorpb.DescriptorProto schema map[string]*openapi_options.Schema // per-message schema to add defs openapiDefinitionsObject openAPIOptions *openapiconfig.OpenAPIOptions pathParams []descriptor.Parameter UseJSONNamesForFields bool UseAllOfForRefs bool }{ { descr: "no OpenAPI options", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{}, defs: map[string]openapiSchemaObject{ "Message": {schemaCore: schemaCore{Type: "object"}}, }, }, { descr: "example option", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { Example: `{"foo":"bar"}`, }, }, defs: map[string]openapiSchemaObject{ "Message": {schemaCore: schemaCore{ Type: "object", Example: RawExample(`{"foo":"bar"}`), }}, }, }, { descr: "example option with something non-json", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { Example: `XXXX anything goes XXXX`, }, }, defs: map[string]openapiSchemaObject{ "Message": {schemaCore: schemaCore{ Type: "object", Example: RawExample(`XXXX anything goes XXXX`), }}, }, }, { descr: "external docs option", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "glorious docs", Url: "https://nada", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, ExternalDocs: &openapiExternalDocumentationObject{ Description: "glorious docs", URL: "https://nada", }, }, }, }, { descr: "JSONSchema options", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", MaxItems: 20, MinItems: 2, UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", MaxItems: 20, MinItems: 2, UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, }, { descr: "JSONSchema options from registry", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Message: []*openapiconfig.OpenAPIMessageOption{ { Message: "example.Message", Option: &openapi_options.Schema{ JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", MaxItems: 20, MinItems: 2, UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", MultipleOf: 100, Maximum: 101, ExclusiveMaximum: true, Minimum: 1, ExclusiveMinimum: true, MaxLength: 10, MinLength: 3, Pattern: "[a-z]+", MaxItems: 20, MinItems: 2, UniqueItems: true, MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, ReadOnly: true, }, }, }, { descr: "JSONSchema with required properties", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("FieldOne"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("FieldTwo"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), Options: requiredFieldOptions, }, { Name: proto.String("FieldThree"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), Options: requiredFieldOptions, }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{"FieldOne", "FieldTwo"}, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"FieldOne", "FieldTwo", "FieldThree"}, Properties: &openapiSchemaObjectProperties{ { Key: "FieldOne", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "FieldTwo", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "FieldThree", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, }, }, { descr: "JSONSchema with required properties", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("FieldOne"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), Options: requiredFieldOptions, }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"FieldOne"}, Properties: &openapiSchemaObjectProperties{ { Key: "FieldOne", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, }, }, { descr: "JSONSchema with required properties by using annotations", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("FieldOne"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), Options: requiredFieldOptions, }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"FieldOne"}, Properties: &openapiSchemaObjectProperties{ { Key: "FieldOne", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, }, }, { descr: "JSONSchema with hidden properties", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("aInternalField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), Options: fieldVisibilityInternalOption, }, { Name: proto.String("aPreviewField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), Options: fieldVisibilityPreviewOption, }, { Name: proto.String("aVisibleField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{"req"}, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"req"}, Properties: &openapiSchemaObjectProperties{ { Key: "aPreviewField", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "aVisibleField", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, }, }, { descr: "JSONSchema with path parameters", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("aRequiredField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), Options: requiredField, }, { Name: proto.String("aPathParameter"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{"req"}, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"req", "aRequiredField"}, Properties: &openapiSchemaObjectProperties{ { Key: "aRequiredField", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, Description: "field description", Title: "field title", }, }, }, }, }, pathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath{ descriptor.FieldPathComponent{ Name: ("aPathParameter"), }, }, }, }, }, { descr: "JSONSchema with required properties via field_behavior", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("aRequiredField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), Options: requiredFieldOptions, }, { Name: proto.String("aOutputOnlyField"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), Options: fieldBehaviorOutputOnlyOptions, }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{"req"}, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"req", "aRequiredField"}, Properties: &openapiSchemaObjectProperties{ { Key: "aRequiredField", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "aOutputOnlyField", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, ReadOnly: true, }, }, }, }, }, }, { descr: "JSONSchema with required properties and fields with json_name", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("FieldOne"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), JsonName: proto.String("custom_json_1"), }, { Name: proto.String("FieldTwo"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), JsonName: proto.String("custom_json_2"), Options: requiredFieldOptions, }, { Name: proto.String("FieldThree"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(3), JsonName: proto.String("custom_json_3"), Options: requiredFieldOptions, }, }, }, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{"FieldOne", "FieldTwo"}, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: []string{"custom_json_1", "custom_json_2", "custom_json_3"}, Properties: &openapiSchemaObjectProperties{ { Key: "custom_json_1", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "custom_json_2", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, { Key: "custom_json_3", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, }, }, UseJSONNamesForFields: true, }, { descr: "JSONSchema with a read_only nested field", msgDescs: []*descriptorpb.DescriptorProto{ { Name: proto.String("Message"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("nested"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.Message.Nested"), Number: proto.Int32(1), Options: fieldBehaviorOutputOnlyOptions, }, }, NestedType: []*descriptorpb.DescriptorProto{{ Name: proto.String("Nested"), }}, }, }, UseAllOfForRefs: true, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "title", Description: "desc", Required: []string{}, }, }, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Field: []*openapiconfig.OpenAPIFieldOption{ { Field: "example.Message.nested", Option: &openapi_options.JSONSchema{ Title: "nested field title", Description: "nested field desc", Example: `"ok":"TRUE"`, }, }, }, }, defs: map[string]openapiSchemaObject{ "exampleMessage": { schemaCore: schemaCore{ Type: "object", }, Title: "title", Description: "desc", Required: nil, Properties: &openapiSchemaObjectProperties{ { Key: "nested", Value: openapiSchemaObject{ AllOf: []allOfEntry{{Ref: "#/definitions/MessageNested"}}, ReadOnly: true, schemaCore: schemaCore{ Example: RawExample(`"ok":"TRUE"`), }, Title: "nested field title", Description: "nested field desc", }, }, }, }, }, }, } for _, test := range tests { t.Run(test.descr, func(t *testing.T) { msgs := []*descriptor.Message{} for _, msgdesc := range test.msgDescs { msgdesc.Options = &descriptorpb.MessageOptions{} msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } reg := descriptor.NewRegistry() file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.msgDescs, EnumType: []*descriptorpb.EnumDescriptorProto{}, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) reg.SetVisibilityRestrictionSelectors([]string{"PREVIEW"}) if test.UseJSONNamesForFields { reg.SetUseJSONNamesForFields(true) } if test.UseAllOfForRefs { reg.SetUseAllOfForRefs(true) } if err != nil { t.Fatalf("failed to load code generator request: %v", err) } msgMap := map[string]*descriptor.Message{} for _, d := range test.msgDescs { name := d.GetName() msg, err := reg.LookupMsg("example", name) if err != nil { t.Fatalf("lookup message %v: %v", name, err) } msgMap[msg.FQMN()] = msg if schema, ok := test.schema[name]; ok { proto.SetExtension(d.Options, openapi_options.E_Openapiv2Schema, schema) } } if test.openAPIOptions != nil { if err := reg.RegisterOpenAPIOptions(test.openAPIOptions); err != nil { t.Fatalf("failed to register OpenAPI options: %s", err) } } refs := make(refMap) actual := make(openapiDefinitionsObject) if err := renderMessagesAsDefinition(msgMap, actual, reg, refs, test.pathParams); err != nil { t.Errorf("renderMessagesAsDefinition failed with: %s", err) } if !reflect.DeepEqual(actual, test.defs) { t.Errorf("Expected renderMessagesAsDefinition() to add defs %+v, not %+v", test.defs, actual) } }) } } func TestUpdateOpenAPIDataFromComments(t *testing.T) { tests := []struct { descr string openapiSwaggerObject interface{} comments string expectedError error expectedOpenAPIObject interface{} useGoTemplate bool goTemplateArgs []string }{ { descr: "empty comments", openapiSwaggerObject: nil, expectedOpenAPIObject: nil, comments: "", expectedError: nil, }, { descr: "set field to read only", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ ReadOnly: true, Description: "... Output only. ...", }, comments: "... Output only. ...", expectedError: nil, }, { descr: "set title", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "Comment with no trailing dot", }, comments: "Comment with no trailing dot", expectedError: nil, }, { descr: "set description", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Description: "Comment with trailing dot.", }, comments: "Comment with trailing dot.", expectedError: nil, }, { descr: "use info object", openapiSwaggerObject: &openapiSwaggerObject{ Info: openapiInfoObject{}, }, expectedOpenAPIObject: &openapiSwaggerObject{ Info: openapiInfoObject{ Description: "Comment with trailing dot.", }, }, comments: "Comment with trailing dot.", expectedError: nil, }, { descr: "multi line comment with title", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "First line", Description: "Second line", }, comments: "First line\n\nSecond line", expectedError: nil, }, { descr: "multi line comment no title", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Description: "First line.\n\nSecond line", }, comments: "First line.\n\nSecond line", expectedError: nil, }, { descr: "multi line comment with summary with dot", openapiSwaggerObject: &openapiOperationObject{}, expectedOpenAPIObject: &openapiOperationObject{ Summary: "First line.", Description: "Second line", }, comments: "First line.\n\nSecond line", expectedError: nil, }, { descr: "multi line comment with summary no dot", openapiSwaggerObject: &openapiOperationObject{}, expectedOpenAPIObject: &openapiOperationObject{ Summary: "First line", Description: "Second line", }, comments: "First line\n\nSecond line", expectedError: nil, }, { descr: "multi line comment with summary no dot", openapiSwaggerObject: &schemaCore{}, expectedOpenAPIObject: &schemaCore{}, comments: "Any comment", expectedError: errors.New("no description nor summary property"), }, { descr: "without use_go_template", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "First line", Description: "{{import \"documentation.md\"}}", }, comments: "First line\n\n{{import \"documentation.md\"}}", expectedError: nil, }, { descr: "error with use_go_template", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "First line", Description: "open noneexistingfile.txt: no such file or directory", }, comments: "First line\n\n{{import \"noneexistingfile.txt\"}}", expectedError: nil, useGoTemplate: true, }, { descr: "template with use_go_template", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "Template", Description: `Description "which means nothing"`, }, comments: "Template\n\nDescription {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", expectedError: nil, useGoTemplate: true, }, { descr: "template with use_go_template and go_template_args", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "Template", Description: `Description "which means nothing" for environment test with value my_value`, }, comments: "Template\n\nDescription {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} for " + "environment {{arg \"environment\"}} with value {{arg \"my_key\"}}", expectedError: nil, useGoTemplate: true, goTemplateArgs: []string{"my_key=my_value", "environment=test"}, }, { descr: "template with use_go_template and undefined go_template_args", openapiSwaggerObject: &openapiSchemaObject{}, expectedOpenAPIObject: &openapiSchemaObject{ Title: "Template", Description: `Description "which means nothing" for environment test with value ` + `goTemplateArg something_undefined not found`, }, comments: "Template\n\nDescription {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} for " + "environment {{arg \"environment\"}} with value {{arg \"something_undefined\"}}", expectedError: nil, useGoTemplate: true, goTemplateArgs: []string{"environment=test"}, }, } for _, test := range tests { t.Run(test.descr, func(t *testing.T) { reg := descriptor.NewRegistry() if test.useGoTemplate { reg.SetUseGoTemplate(true) } if len(test.goTemplateArgs) > 0 { reg.SetGoTemplateArgs(test.goTemplateArgs) } err := updateOpenAPIDataFromComments(reg, test.openapiSwaggerObject, nil, test.comments, false) if test.expectedError == nil { if err != nil { t.Errorf("unexpected error '%v'", err) } if !reflect.DeepEqual(test.openapiSwaggerObject, test.expectedOpenAPIObject) { t.Errorf("openapiSwaggerObject was not updated correctly, expected '%+v', got '%+v'", test.expectedOpenAPIObject, test.openapiSwaggerObject) } } else { if err == nil { t.Error("expected update error not returned") } if !reflect.DeepEqual(test.openapiSwaggerObject, test.expectedOpenAPIObject) { t.Errorf("openapiSwaggerObject was not updated correctly, expected '%+v', got '%+v'", test.expectedOpenAPIObject, test.openapiSwaggerObject) } if err.Error() != test.expectedError.Error() { t.Errorf("expected error malformed, expected %q, got %q", test.expectedError.Error(), err.Error()) } } }) } } func TestMessageOptionsWithGoTemplate(t *testing.T) { tests := []struct { descr string msgDescs []*descriptorpb.DescriptorProto schema map[string]*openapi_options.Schema // per-message schema to add defs openapiDefinitionsObject openAPIOptions *openapiconfig.OpenAPIOptions useGoTemplate bool goTemplateArgs []string }{ { descr: "external docs option", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "Message", Description: `Description "which means nothing"`, ExternalDocs: &openapiExternalDocumentationObject{ Description: `Description "which means nothing"`, }, }, }, useGoTemplate: true, }, { descr: "external docs option", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", ExternalDocs: &openapiExternalDocumentationObject{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, }, }, useGoTemplate: false, }, { descr: "external docs option with go template args", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, schema: map[string]*openapi_options.Schema{ "Message": { JsonSchema: &openapi_options.JSONSchema{ Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} " + "{{arg \"my_key\"}}", }, ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} " + "{{arg \"my_key\"}}", }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "Message", Description: `Description "which means nothing" too`, ExternalDocs: &openapiExternalDocumentationObject{ Description: `Description "which means nothing" too`, }, }, }, useGoTemplate: true, goTemplateArgs: []string{"my_key=too"}, }, { descr: "registered OpenAPIOption", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Message: []*openapiconfig.OpenAPIMessageOption{ { Message: "example.Message", Option: &openapi_options.Schema{ JsonSchema: &openapi_options.JSONSchema{ Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", }, }, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "Message", Description: `Description "which means nothing"`, ExternalDocs: &openapiExternalDocumentationObject{ Description: `Description "which means nothing"`, }, }, }, useGoTemplate: true, }, { descr: "registered OpenAPIOption with go template args", msgDescs: []*descriptorpb.DescriptorProto{ {Name: proto.String("Message")}, }, openAPIOptions: &openapiconfig.OpenAPIOptions{ Message: []*openapiconfig.OpenAPIMessageOption{ { Message: "example.Message", Option: &openapi_options.Schema{ JsonSchema: &openapi_options.JSONSchema{ Title: "{{.Name}}", Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} " + "{{arg \"my_key\"}}", }, ExternalDocs: &openapi_options.ExternalDocumentation{ Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}} " + "{{arg \"my_key\"}}", }, }, }, }, }, defs: map[string]openapiSchemaObject{ "Message": { schemaCore: schemaCore{ Type: "object", }, Title: "Message", Description: `Description "which means nothing" too`, ExternalDocs: &openapiExternalDocumentationObject{ Description: `Description "which means nothing" too`, }, }, }, useGoTemplate: true, goTemplateArgs: []string{"my_key=too"}, }, } for _, test := range tests { t.Run(test.descr, func(t *testing.T) { msgs := []*descriptor.Message{} for _, msgdesc := range test.msgDescs { msgdesc.Options = &descriptorpb.MessageOptions{} msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) } reg := descriptor.NewRegistry() reg.SetUseGoTemplate(test.useGoTemplate) reg.SetGoTemplateArgs(test.goTemplateArgs) file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: test.msgDescs, EnumType: []*descriptorpb.EnumDescriptorProto{}, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, Messages: msgs, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } msgMap := map[string]*descriptor.Message{} for _, d := range test.msgDescs { name := d.GetName() msg, err := reg.LookupMsg("example", name) if err != nil { t.Fatalf("lookup message %v: %v", name, err) } msgMap[msg.FQMN()] = msg if schema, ok := test.schema[name]; ok { proto.SetExtension(d.Options, openapi_options.E_Openapiv2Schema, schema) } } if test.openAPIOptions != nil { if err := reg.RegisterOpenAPIOptions(test.openAPIOptions); err != nil { t.Fatalf("failed to register OpenAPI options: %s", err) } } refs := make(refMap) actual := make(openapiDefinitionsObject) if err := renderMessagesAsDefinition(msgMap, actual, reg, refs, nil); err != nil { t.Errorf("renderMessagesAsDefinition failed with: %s", err) } if !reflect.DeepEqual(actual, test.defs) { t.Errorf("Expected renderMessagesAsDefinition() to add defs %+v, not %+v", test.defs, actual) } }) } } func TestTagsWithGoTemplate(t *testing.T) { reg := descriptor.NewRegistry() reg.SetUseGoTemplate(true) reg.SetGoTemplateArgs([]string{"my_key=my_value"}) svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Options: &descriptorpb.ServiceOptions{}, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{}, MessageType: []*descriptorpb.DescriptorProto{}, EnumType: []*descriptorpb.EnumDescriptorProto{}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, Messages: []*descriptor.Message{}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, }, }, } // Set tag through service extension proto.SetExtension(file.GetService()[0].Options, openapi_options.E_Openapiv2Tag, &openapi_options.Tag{ Name: "service tag", Description: "{{ .Name }}!"}) // Set tags through file extension swagger := openapi_options.Swagger{ Tags: []*openapi_options.Tag{ { Name: "not a service tag", Description: "{{ import \"file\" }}", }, { Name: "ExampleService", Description: "ExampleService!", }, { Name: "not a service tag 2", Description: "{{ import \"file\" }}", }, { Name: "Service with my_key", Description: "the {{arg \"my_key\"}}", }, }, } proto.SetExtension(proto.Message(file.FileDescriptorProto.Options), openapi_options.E_Openapiv2Swagger, &swagger) actual, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } expectedTags := []openapiTagObject{ { Name: "not a service tag", Description: "open file: no such file or directory", }, { Name: "ExampleService", Description: "ExampleService!", }, { Name: "not a service tag 2", Description: "open file: no such file or directory", }, { Name: "Service with my_key", Description: "the my_value", }, { Name: "service tag", Description: "ExampleService!", }, } if !reflect.DeepEqual(actual.Tags, expectedTags) { t.Errorf("Expected tags %+v, not %+v", expectedTags, actual.Tags) } } func TestTemplateWithoutErrorDefinition(t *testing.T) { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{}, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Errorf("failed to reg.Load(): %v", err) return } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } defRsp, ok := result.getPathItemObject("/v1/echo").Post.Responses["default"] if !ok { return } ref := defRsp.Schema.schemaCore.Ref refName := strings.TrimPrefix(ref, "#/definitions/") if refName == "" { t.Fatal("created default Error response with empty reflink") } if _, ok := result.Definitions[refName]; !ok { t.Errorf("default Error response with reflink '%v', but its definition was not found", refName) } } func TestSingleServiceTemplateWithDuplicateHttp1Operations(t *testing.T) { fieldType := descriptorpb.FieldDescriptorProto_TYPE_STRING field1 := &descriptorpb.FieldDescriptorProto{ Name: proto.String("name"), Number: proto.Int32(1), Type: &fieldType, } getFooMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("GetFooRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } getFooMsg := &descriptor.Message{ DescriptorProto: getFooMsgDesc, } deleteFooMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("DeleteFooRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } deleteFooMsg := &descriptor.Message{ DescriptorProto: deleteFooMsgDesc, } getFoo := &descriptorpb.MethodDescriptorProto{ Name: proto.String("GetFoo"), InputType: proto.String("GetFooRequest"), OutputType: proto.String("EmptyMessage"), } deleteFoo := &descriptorpb.MethodDescriptorProto{ Name: proto.String("DeleteFoo"), InputType: proto.String("DeleteFooRequest"), OutputType: proto.String("EmptyMessage"), } getBarMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("GetBarRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } getBarMsg := &descriptor.Message{ DescriptorProto: getBarMsgDesc, } deleteBarMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("DeleteBarRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } deleteBarMsg := &descriptor.Message{ DescriptorProto: deleteBarMsgDesc, } getBar := &descriptorpb.MethodDescriptorProto{ Name: proto.String("GetBar"), InputType: proto.String("GetBarRequest"), OutputType: proto.String("EmptyMessage"), } deleteBar := &descriptorpb.MethodDescriptorProto{ Name: proto.String("DeleteBar"), InputType: proto.String("DeleteBarRequest"), OutputType: proto.String("EmptyMessage"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Service1"), Method: []*descriptorpb.MethodDescriptorProto{getFoo, deleteFoo, getBar, deleteBar}, } emptyMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("EmptyMessage"), } emptyMsg := &descriptor.Message{ DescriptorProto: emptyMsgDesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("service1.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{getBarMsgDesc, deleteBarMsgDesc, getFooMsgDesc, deleteFooMsgDesc, emptyMsgDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{getFooMsg, deleteFooMsg, getBarMsg, deleteBarMsg, emptyMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: getFoo, RequestType: getFooMsg, ResponseType: getFooMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=foos/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: getFooMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: deleteFoo, RequestType: deleteFooMsg, ResponseType: emptyMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "DELETE", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=foos/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: deleteFooMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: getBar, RequestType: getBarMsg, ResponseType: getBarMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=bars/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: getBarMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: deleteBar, RequestType: deleteBarMsg, ResponseType: emptyMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "DELETE", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=bars/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: deleteBarMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } if got, want := len(result.Paths), 2; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } firstOpGet := result.getPathItemObject("/v1/{name}").Get if got, want := firstOpGet.OperationID, "Service1_GetFoo"; got != want { t.Fatalf("First operation GET id differed, got %s want %s", got, want) } if got, want := len(firstOpGet.Parameters), 2; got != want { t.Fatalf("First operation GET params length differed, got %d want %d", got, want) } if got, want := firstOpGet.Parameters[0].Name, "name"; got != want { t.Fatalf("First operation GET first param name differed, got %s want %s", got, want) } if got, want := firstOpGet.Parameters[0].Pattern, "foos/[^/]+"; got != want { t.Fatalf("First operation GET first param pattern differed, got %s want %s", got, want) } if got, want := firstOpGet.Parameters[1].In, "body"; got != want { t.Fatalf("First operation GET second param 'in' differed, got %s want %s", got, want) } firstOpDelete := result.getPathItemObject("/v1/{name}").Delete if got, want := firstOpDelete.OperationID, "Service1_DeleteFoo"; got != want { t.Fatalf("First operation id DELETE differed, got %s want %s", got, want) } if got, want := len(firstOpDelete.Parameters), 2; got != want { t.Fatalf("First operation DELETE params length differed, got %d want %d", got, want) } if got, want := firstOpDelete.Parameters[0].Name, "name"; got != want { t.Fatalf("First operation DELETE first param name differed, got %s want %s", got, want) } if got, want := firstOpDelete.Parameters[0].Pattern, "foos/[^/]+"; got != want { t.Fatalf("First operation DELETE first param pattern differed, got %s want %s", got, want) } if got, want := firstOpDelete.Parameters[1].In, "body"; got != want { t.Fatalf("First operation DELETE second param 'in' differed, got %s want %s", got, want) } secondOpGet := result.getPathItemObject("/v1/{name" + pathParamUniqueSuffixDeliminator + "1}").Get if got, want := secondOpGet.OperationID, "Service1_GetBar"; got != want { t.Fatalf("Second operation id GET differed, got %s want %s", got, want) } if got, want := len(secondOpGet.Parameters), 2; got != want { t.Fatalf("Second operation GET params length differed, got %d want %d", got, want) } if got, want := secondOpGet.Parameters[0].Name, "name"+pathParamUniqueSuffixDeliminator+"1"; got != want { t.Fatalf("Second operation GET first param name differed, got %s want %s", got, want) } if got, want := secondOpGet.Parameters[0].Pattern, "bars/[^/]+"; got != want { t.Fatalf("Second operation GET first param pattern differed, got %s want %s", got, want) } if got, want := secondOpGet.Parameters[1].In, "body"; got != want { t.Fatalf("Second operation GET second param 'in' differed, got %s want %s", got, want) } secondOpDelete := result.getPathItemObject("/v1/{name" + pathParamUniqueSuffixDeliminator + "1}").Delete if got, want := secondOpDelete.OperationID, "Service1_DeleteBar"; got != want { t.Fatalf("Second operation id differed, got %s want %s", got, want) } if got, want := len(secondOpDelete.Parameters), 2; got != want { t.Fatalf("Second operation params length differed, got %d want %d", got, want) } if got, want := secondOpDelete.Parameters[0].Name, "name"+pathParamUniqueSuffixDeliminator+"1"; got != want { t.Fatalf("Second operation first param name differed, got %s want %s", got, want) } if got, want := secondOpDelete.Parameters[0].Pattern, "bars/[^/]+"; got != want { t.Fatalf("Second operation first param pattern differed, got %s want %s", got, want) } if got, want := secondOpDelete.Parameters[1].In, "body"; got != want { t.Fatalf("Second operation third param 'in' differed, got %s want %s", got, want) } } func getOperation(pathItem openapiPathItemObject, httpMethod string) *openapiOperationObject { switch httpMethod { case "GET": return pathItem.Get case "POST": return pathItem.Post case "PUT": return pathItem.Put case "DELETE": return pathItem.Delete case "PATCH": return pathItem.Patch case "HEAD": return pathItem.Head case "OPTIONS": return pathItem.Options default: return nil } } func TestSingleServiceTemplateWithDuplicateInAllSupportedHttp1Operations(t *testing.T) { supportedMethods := []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"} for _, method := range supportedMethods { fieldType := descriptorpb.FieldDescriptorProto_TYPE_STRING field1 := &descriptorpb.FieldDescriptorProto{ Name: proto.String("name"), Number: proto.Int32(1), Type: &fieldType, } methodFooMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String(method + "FooRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } methodFooMsg := &descriptor.Message{ DescriptorProto: methodFooMsgDesc, } methodFoo := &descriptorpb.MethodDescriptorProto{ Name: proto.String(method + "Foo"), InputType: proto.String(method + "FooRequest"), OutputType: proto.String("EmptyMessage"), } methodBarMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String(method + "BarRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } methodBarMsg := &descriptor.Message{ DescriptorProto: methodBarMsgDesc, } methodBar := &descriptorpb.MethodDescriptorProto{ Name: proto.String(method + "Bar"), InputType: proto.String(method + "BarRequest"), OutputType: proto.String("EmptyMessage"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Service1"), Method: []*descriptorpb.MethodDescriptorProto{methodFoo, methodBar}, } emptyMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("EmptyMessage"), } emptyMsg := &descriptor.Message{ DescriptorProto: emptyMsgDesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("service1.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{methodBarMsgDesc, methodFooMsgDesc, emptyMsgDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{methodFooMsg, methodBarMsg, emptyMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: methodFoo, RequestType: methodFooMsg, ResponseType: methodFooMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: method, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=foos/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: methodFooMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: methodBar, RequestType: methodBarMsg, ResponseType: methodBarMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: method, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=bars/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: methodBarMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } if got, want := len(result.Paths), 2; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } firstOpMethod := getOperation(result.getPathItemObject("/v1/{name}"), method) if got, want := firstOpMethod.OperationID, "Service1_"+method+"Foo"; got != want { t.Fatalf("First operation %s id differed, got %s want %s", method, got, want) } if got, want := len(firstOpMethod.Parameters), 2; got != want { t.Fatalf("First operation %s params length differed, got %d want %d", method, got, want) } if got, want := firstOpMethod.Parameters[0].Name, "name"; got != want { t.Fatalf("First operation %s first param name differed, got %s want %s", method, got, want) } if got, want := firstOpMethod.Parameters[0].Pattern, "foos/[^/]+"; got != want { t.Fatalf("First operation %s first param pattern differed, got %s want %s", method, got, want) } if got, want := firstOpMethod.Parameters[1].In, "body"; got != want { t.Fatalf("First operation %s second param 'in' differed, got %s want %s", method, got, want) } secondOpMethod := getOperation(result.getPathItemObject("/v1/{name"+pathParamUniqueSuffixDeliminator+"1}"), method) if got, want := secondOpMethod.OperationID, "Service1_"+method+"Bar"; got != want { t.Fatalf("Second operation id %s differed, got %s want %s", method, got, want) } if got, want := len(secondOpMethod.Parameters), 2; got != want { t.Fatalf("Second operation %s params length differed, got %d want %d", method, got, want) } if got, want := secondOpMethod.Parameters[0].Name, "name"+pathParamUniqueSuffixDeliminator+"1"; got != want { t.Fatalf("Second operation %s first param name differed, got %s want %s", method, got, want) } if got, want := secondOpMethod.Parameters[0].Pattern, "bars/[^/]+"; got != want { t.Fatalf("Second operation %s first param pattern differed, got %s want %s", method, got, want) } if got, want := secondOpMethod.Parameters[1].In, "body"; got != want { t.Fatalf("Second operation %s second param 'in' differed, got %s want %s", method, got, want) } } } func TestSingleServiceTemplateWithDuplicateHttp1UnsupportedOperations(t *testing.T) { fieldType := descriptorpb.FieldDescriptorProto_TYPE_STRING field1 := &descriptorpb.FieldDescriptorProto{ Name: proto.String("name"), Number: proto.Int32(1), Type: &fieldType, } unsupportedFooMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("UnsupportedFooRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } unsupportedFooMsg := &descriptor.Message{ DescriptorProto: unsupportedFooMsgDesc, } unsupportedFoo := &descriptorpb.MethodDescriptorProto{ Name: proto.String("UnsupportedFoo"), InputType: proto.String("UnsupportedFooRequest"), OutputType: proto.String("EmptyMessage"), } unsupportedBarMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("UnsupportedBarRequest"), Field: []*descriptorpb.FieldDescriptorProto{ field1, }, } unsupportedBarMsg := &descriptor.Message{ DescriptorProto: unsupportedBarMsgDesc, } unsupportedBar := &descriptorpb.MethodDescriptorProto{ Name: proto.String("UnsupportedBar"), InputType: proto.String("UnsupportedBarRequest"), OutputType: proto.String("EmptyMessage"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Service1"), Method: []*descriptorpb.MethodDescriptorProto{unsupportedFoo, unsupportedBar}, } emptyMsgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("EmptyMessage"), } emptyMsg := &descriptor.Message{ DescriptorProto: emptyMsgDesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("service1.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{unsupportedBarMsgDesc, unsupportedFooMsgDesc, emptyMsgDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{unsupportedFooMsg, unsupportedBarMsg, emptyMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: unsupportedFoo, RequestType: unsupportedFooMsg, ResponseType: unsupportedFooMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "UNSUPPORTED", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=foos/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: unsupportedFooMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: unsupportedBar, RequestType: unsupportedBarMsg, ResponseType: unsupportedBarMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "UNSUPPORTED", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=bars/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: unsupportedBarMsg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } // Just should not crash, no special handling of unsupported HTTP methods if got, want := len(result.Paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } } func TestTemplateWithDuplicateHttp1Operations(t *testing.T) { fieldType := descriptorpb.FieldDescriptorProto_TYPE_STRING field1 := &descriptorpb.FieldDescriptorProto{ Name: proto.String("name"), Number: proto.Int32(1), Type: &fieldType, } field2 := &descriptorpb.FieldDescriptorProto{ Name: proto.String("role"), Number: proto.Int32(2), Type: &fieldType, } msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ field1, field2, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Method1"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Method2"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Service1"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } meth3 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Method3"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } meth4 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Method4"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } svc2 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Service2"), Method: []*descriptorpb.MethodDescriptorProto{meth3, meth4}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("service1.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1, svc2}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=organizations/*}/{role=roles/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, { Target: &descriptor.Field{ FieldDescriptorProto: field2, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "role", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: meth2, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=users/*}/{role=roles/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, { Target: &descriptor.Field{ FieldDescriptorProto: field2, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "role", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, { ServiceDescriptorProto: svc2, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth3, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=users/*}/roles", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, { MethodDescriptorProto: meth4, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/{name=groups/*}/{role=roles/*}", }, PathParams: []descriptor.Parameter{ { Target: &descriptor.Field{ FieldDescriptorProto: field1, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "name", }, }, }, { Target: &descriptor.Field{ FieldDescriptorProto: field2, Message: msg, }, FieldPath: descriptor.FieldPath{ { Name: "role", }, }, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } if got, want := len(result.Paths), 4; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } firstOp := result.getPathItemObject("/v1/{name}/{role}").Get if got, want := firstOp.OperationID, "Service1_Method1"; got != want { t.Fatalf("First operation id differed, got %s want %s", got, want) } if got, want := len(firstOp.Parameters), 3; got != want { t.Fatalf("First operation params length differed, got %d want %d", got, want) } if got, want := firstOp.Parameters[0].Name, "name"; got != want { t.Fatalf("First operation first param name differed, got %s want %s", got, want) } if got, want := firstOp.Parameters[0].Pattern, "organizations/[^/]+"; got != want { t.Fatalf("First operation first param pattern differed, got %s want %s", got, want) } if got, want := firstOp.Parameters[1].Name, "role"; got != want { t.Fatalf("First operation second param name differed, got %s want %s", got, want) } if got, want := firstOp.Parameters[1].Pattern, "roles/[^/]+"; got != want { t.Fatalf("First operation second param pattern differed, got %s want %s", got, want) } if got, want := firstOp.Parameters[2].In, "body"; got != want { t.Fatalf("First operation third param 'in' differed, got %s want %s", got, want) } secondOp := result.getPathItemObject("/v1/{name" + pathParamUniqueSuffixDeliminator + "1}/{role}").Get if got, want := secondOp.OperationID, "Service1_Method2"; got != want { t.Fatalf("Second operation id differed, got %s want %s", got, want) } if got, want := len(secondOp.Parameters), 3; got != want { t.Fatalf("Second operation params length differed, got %d want %d", got, want) } if got, want := secondOp.Parameters[0].Name, "name"+pathParamUniqueSuffixDeliminator+"1"; got != want { t.Fatalf("Second operation first param name differed, got %s want %s", got, want) } if got, want := secondOp.Parameters[0].Pattern, "users/[^/]+"; got != want { t.Fatalf("Second operation first param pattern differed, got %s want %s", got, want) } if got, want := secondOp.Parameters[1].Name, "role"; got != want { t.Fatalf("Second operation second param name differed, got %s want %s", got, want) } if got, want := secondOp.Parameters[1].Pattern, "roles/[^/]+"; got != want { t.Fatalf("Second operation second param pattern differed, got %s want %s", got, want) } if got, want := secondOp.Parameters[2].In, "body"; got != want { t.Fatalf("Second operation third param 'in' differed, got %s want %s", got, want) } thirdOp := result.getPathItemObject("/v1/{name}/roles").Get if got, want := thirdOp.OperationID, "Service2_Method3"; got != want { t.Fatalf("Third operation id differed, got %s want %s", got, want) } if got, want := len(thirdOp.Parameters), 2; got != want { t.Fatalf("Third operation params length differed, got %d want %d", got, want) } if got, want := thirdOp.Parameters[0].Name, "name"; got != want { t.Fatalf("Third operation first param name differed, got %s want %s", got, want) } if got, want := thirdOp.Parameters[0].Pattern, "users/[^/]+"; got != want { t.Fatalf("Third operation first param pattern differed, got %s want %s", got, want) } if got, want := thirdOp.Parameters[1].In, "body"; got != want { t.Fatalf("Third operation second param 'in' differed, got %s want %s", got, want) } forthOp := result.getPathItemObject("/v1/{name" + pathParamUniqueSuffixDeliminator + "2}/{role}").Get if got, want := forthOp.OperationID, "Service2_Method4"; got != want { t.Fatalf("Fourth operation id differed, got %s want %s", got, want) } if got, want := len(forthOp.Parameters), 3; got != want { t.Fatalf("Fourth operation params length differed, got %d want %d", got, want) } if got, want := forthOp.Parameters[0].Name, "name"+pathParamUniqueSuffixDeliminator+"2"; got != want { t.Fatalf("Fourth operation first param name differed, got %s want %s", got, want) } if got, want := forthOp.Parameters[0].Pattern, "groups/[^/]+"; got != want { t.Fatalf("Fourth operation first param pattern differed, got %s want %s", got, want) } if got, want := forthOp.Parameters[1].Name, "role"; got != want { t.Fatalf("Fourth operation second param name differed, got %s want %s", got, want) } if got, want := forthOp.Parameters[1].Pattern, "roles/[^/]+"; got != want { t.Fatalf("Fourth operation second param pattern differed, got %s want %s", got, want) } if got, want := forthOp.Parameters[2].In, "body"; got != want { t.Fatalf("Fourth operation second param 'in' differed, got %s want %s", got, want) } } func Test_getReservedJsonName(t *testing.T) { type args struct { fieldName string messageNameToFieldsToJSONName map[string]map[string]string fieldNameToType map[string]string } tests := []struct { name string args args want string }{ { "test case 1: single dot use case", args{ fieldName: "abc.a_1", messageNameToFieldsToJSONName: map[string]map[string]string{ "Msg": { "a_1": "a1JSONNAME", "b_1": "b1JSONNAME", }, }, fieldNameToType: map[string]string{ "abc": "pkg1.test.Msg", "bcd": "pkg1.test.Msg", }, }, "a1JSONNAME", }, { "test case 2: single dot use case with no existing field", args{ fieldName: "abc.d_1", messageNameToFieldsToJSONName: map[string]map[string]string{ "Msg": { "a_1": "a1JSONNAME", "b_1": "b1JSONNAME", }, }, fieldNameToType: map[string]string{ "abc": "pkg1.test.Msg", "bcd": "pkg1.test.Msg", }, }, "", }, { "test case 3: double dot use case", args{ fieldName: "pkg.abc.a_1", messageNameToFieldsToJSONName: map[string]map[string]string{ "Msg": { "a_1": "a1JSONNAME", "b_1": "b1JSONNAME", }, }, fieldNameToType: map[string]string{ "abc": "pkg1.test.Msg", "bcd": "pkg1.test.Msg", }, }, "a1JSONNAME", }, { "test case 4: double dot use case with a not existed field", args{ fieldName: "pkg.abc.c_1", messageNameToFieldsToJSONName: map[string]map[string]string{ "Msg": { "a_1": "a1JSONNAME", "b_1": "b1JSONNAME", }, }, fieldNameToType: map[string]string{ "abc": "pkg1.test.Msg", "bcd": "pkg1.test.Msg", }, }, "", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := getReservedJSONName(tt.args.fieldName, tt.args.messageNameToFieldsToJSONName, tt.args.fieldNameToType); got != tt.want { t.Errorf("getReservedJSONName() = %v, want %v", got, tt.want) } }) } } func TestParseIncompleteSecurityRequirement(t *testing.T) { swagger := openapi_options.Swagger{ Security: []*openapi_options.SecurityRequirement{ { SecurityRequirement: map[string]*openapi_options.SecurityRequirement_SecurityRequirementValue{ "key": nil, }, }, }, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, } proto.SetExtension(proto.Message(file.FileDescriptorProto.Options), openapi_options.E_Openapiv2Swagger, &swagger) reg := descriptor.NewRegistry() err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Errorf("failed to reg.Load(): %v", err) return } _, err = applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err == nil { t.Errorf("applyTemplate(%#v) did not error as expected", file) return } } func TestSubPathParams(t *testing.T) { outerParams := []descriptor.Parameter{ { FieldPath: []descriptor.FieldPathComponent{ { Name: "prefix", }, { Name: "first", }, }, }, { FieldPath: []descriptor.FieldPathComponent{ { Name: "prefix", }, { Name: "second", }, { Name: "deeper", }, }, }, { FieldPath: []descriptor.FieldPathComponent{ { Name: "otherprefix", }, { Name: "third", }, }, }, } subParams := subPathParams("prefix", outerParams) if got, want := len(subParams), 2; got != want { t.Fatalf("Wrong number of path params, got %d want %d", got, want) } if got, want := len(subParams[0].FieldPath), 1; got != want { t.Fatalf("Wrong length of path param 0, got %d want %d", got, want) } if got, want := subParams[0].FieldPath[0].Name, "first"; got != want { t.Fatalf("Wrong path param 0, element 0, got %s want %s", got, want) } if got, want := len(subParams[1].FieldPath), 2; got != want { t.Fatalf("Wrong length of path param 1 got %d want %d", got, want) } if got, want := subParams[1].FieldPath[0].Name, "second"; got != want { t.Fatalf("Wrong path param 1, element 0, got %s want %s", got, want) } if got, want := subParams[1].FieldPath[1].Name, "deeper"; got != want { t.Fatalf("Wrong path param 1, element 1, got %s want %s", got, want) } } func TestRenderServicesParameterDescriptionNoFieldBody(t *testing.T) { optionsRaw := `{ "[grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema]": { "jsonSchema": { "title": "aMessage title", "description": "aMessage description" } } }` options := &descriptorpb.MessageOptions{} err := protojson.Unmarshal([]byte(optionsRaw), options) if err != nil { t.Fatalf("Error while unmarshalling options: %s", err.Error()) } aMessageDesc := &descriptorpb.DescriptorProto{ Name: proto.String("AMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("project_id"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("other_field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, Options: options, } someResponseDesc := &descriptorpb.DescriptorProto{ Name: proto.String("SomeResponse"), } aMeth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("AMethod"), InputType: proto.String("AMessage"), OutputType: proto.String("SomeResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("Test"), Method: []*descriptorpb.MethodDescriptorProto{aMeth}, } aMessage := &descriptor.Message{ DescriptorProto: aMessageDesc, } someResponseMessage := &descriptor.Message{ DescriptorProto: someResponseDesc, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("api"), Name: proto.String("test.proto"), MessageType: []*descriptorpb.DescriptorProto{aMessageDesc, someResponseDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{aMessage, someResponseMessage}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: aMeth, RequestType: aMessage, ResponseType: someResponseMessage, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/projects/someotherpath", }, Body: &descriptor.Body{}, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err = reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } got := result.getPathItemObject("/v1/projects/someotherpath").Post.Parameters[0].Description want := "aMessage description" if got != want { t.Fatalf("Wrong description for body parameter, got %s want %s", got, want) } } func TestRenderServicesWithBodyFieldNameInCamelCase(t *testing.T) { userDesc := &descriptorpb.DescriptorProto{ Name: proto.String("User"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("name"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("role"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, } updateDesc := &descriptorpb.DescriptorProto{ Name: proto.String("UpdateUserRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("user_object"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.User"), Number: proto.Int32(1), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("UpdateUser"), InputType: proto.String("UpdateUserRequest"), OutputType: proto.String("User"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("UserService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } userMsg := &descriptor.Message{ DescriptorProto: userDesc, } updateMsg := &descriptor.Message{ DescriptorProto: updateDesc, } nameField := &descriptor.Field{ Message: userMsg, FieldDescriptorProto: userMsg.GetField()[0], } nameField.JsonName = proto.String("name") roleField := &descriptor.Field{ Message: userMsg, FieldDescriptorProto: userMsg.GetField()[1], } roleField.JsonName = proto.String("role") userMsg.Fields = []*descriptor.Field{nameField, roleField} userField := &descriptor.Field{ Message: updateMsg, FieldMessage: userMsg, FieldDescriptorProto: updateMsg.GetField()[0], } userField.JsonName = proto.String("userObject") updateMsg.Fields = []*descriptor.Field{userField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String("user_service.proto"), MessageType: []*descriptorpb.DescriptorProto{userDesc, updateDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{userMsg, updateMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: updateMsg, ResponseType: userMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/users/{user_object.name}", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "user_object", }, { Name: "name", }, }), Target: nameField, }, }, Body: &descriptor.Body{ FieldPath: []descriptor.FieldPathComponent{ { Name: "user_object", Target: userField, }, }, }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/v1/users/{userObject.name}"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/v1/users/{userObject.name}").Post if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "userObject.name"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "userObject"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } // The body parameter should be inlined and not contain 'name', as this is a path parameter. schema := operation.Parameters[1].Schema if got, want := schema.Ref, ""; got != want { t.Fatalf("Wrong reference, got %s want %s", got, want) } props := schema.Properties if props == nil { t.Fatal("No properties on body parameter") } if got, want := len(*props), 1; got != want { t.Fatalf("Properties length differed, got %d want %d", got, want) } for _, v := range *props { if got, want := v.Key, "role"; got != want { t.Fatalf("Wrong key for property, got %s want %s", got, want) } } } func TestRenderServicesWithBodyFieldHasFieldMask(t *testing.T) { userDesc := &descriptorpb.DescriptorProto{ Name: proto.String("User"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("name"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, { Name: proto.String("role"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(2), }, }, } updateDesc := &descriptorpb.DescriptorProto{ Name: proto.String("UpdateUserRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("user_object"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.User"), Number: proto.Int32(1), }, { Name: proto.String("update_mask"), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".google.protobuf.FieldMask"), Number: proto.Int32(2), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("UpdateUser"), InputType: proto.String("UpdateUserRequest"), OutputType: proto.String("User"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("UserService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } userMsg := &descriptor.Message{ DescriptorProto: userDesc, } updateMsg := &descriptor.Message{ DescriptorProto: updateDesc, } nameField := &descriptor.Field{ Message: userMsg, FieldDescriptorProto: userMsg.GetField()[0], } nameField.JsonName = proto.String("name") roleField := &descriptor.Field{ Message: userMsg, FieldDescriptorProto: userMsg.GetField()[1], } roleField.JsonName = proto.String("role") userMsg.Fields = []*descriptor.Field{nameField, roleField} userField := &descriptor.Field{ Message: updateMsg, FieldMessage: userMsg, FieldDescriptorProto: updateMsg.GetField()[0], } userField.JsonName = proto.String("userObject") updateMaskField := &descriptor.Field{ Message: updateMsg, FieldDescriptorProto: updateMsg.GetField()[1], } updateMaskField.JsonName = proto.String("updateMask") updateMsg.Fields = []*descriptor.Field{userField, updateMaskField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String("user_service.proto"), Dependency: []string{"google/well_known.proto"}, MessageType: []*descriptorpb.DescriptorProto{userDesc, updateDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{userMsg, updateMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: updateMsg, ResponseType: userMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "PATCH", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/users/{user_object.name}", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "user_object", }, { Name: "name", }, }), Target: nameField, }, }, Body: &descriptor.Body{ FieldPath: []descriptor.FieldPathComponent{ { Name: "user_object", Target: userField, }, }, }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) reg.SetAllowPatchFeature(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{ { SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("google/well_known.proto"), Package: proto.String("google.protobuf"), Dependency: []string{}, MessageType: []*descriptorpb.DescriptorProto{ protodesc.ToDescriptorProto((&field_mask.FieldMask{}).ProtoReflect().Descriptor()), }, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("google/well_known"), }, }, file.FileDescriptorProto, }}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/v1/users/{userObject.name}"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/v1/users/{userObject.name}").Patch if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "userObject.name"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "userObject"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } } func TestRenderServicesWithColonInPath(t *testing.T) { jsonSchema := &openapi_options.JSONSchema{ FieldConfiguration: &openapi_options.JSONSchema_FieldConfiguration{ PathParamName: "overrideField", }, } var fieldOptions = new(descriptorpb.FieldOptions) proto.SetExtension(fieldOptions, openapi_options.E_Openapiv2Field, jsonSchema) reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), Options: fieldOptions, }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/my/{field}:foo", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "field", }, }), Target: reqField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/my/{overrideField}:foo"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/my/{overrideField}:foo").Post if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "overrideField"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[0].Type, "string"; got != want { t.Fatalf("Wrong parameter type, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "body"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } } func TestRenderServicesWithDoubleColonInPath(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/my/{field}:foo:bar", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "field", }, }), Target: reqField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/my/{field}:foo:bar"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/my/{field}:foo:bar").Post if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "field"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[0].Type, "string"; got != want { t.Fatalf("Wrong parameter type, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "body"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } } func TestRenderServicesWithColonLastInPath(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/my/{field}:", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "field", }, }), Target: reqField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/my/{field}:"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/my/{field}:").Post if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "field"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[0].Type, "string"; got != want { t.Fatalf("Wrong parameter type, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "body"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } } func TestRenderServicesWithColonInSegment(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/my/{field=segment/wi:th}", }, PathParams: []descriptor.Parameter{ { FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ { Name: "field", }, }), Target: reqField, }, }, Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) err := reg.Load(reqFromFile(&file)) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := GetPaths(result) if got, want := len(paths), 1; got != want { t.Fatalf("Results path length differed, got %d want %d", got, want) } if got, want := paths[0], "/my/{field}"; got != want { t.Fatalf("Wrong results path, got %s want %s", got, want) } var operation = *result.getPathItemObject("/my/{field}").Post if got, want := len(operation.Parameters), 2; got != want { t.Fatalf("Parameters length differed, got %d want %d", got, want) } if got, want := operation.Parameters[0].Name, "field"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[0].In, "path"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } if got, want := operation.Parameters[0].Type, "string"; got != want { t.Fatalf("Wrong parameter type, got %s want %s", got, want) } if got, want := operation.Parameters[1].Name, "body"; got != want { t.Fatalf("Wrong parameter name, got %s want %s", got, want) } if got, want := operation.Parameters[1].In, "body"; got != want { t.Fatalf("Wrong parameter location, got %s want %s", got, want) } } func TestRenderServiceWithHeaderParameters(t *testing.T) { file := func() descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), Options: &descriptorpb.MethodOptions{}, } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } return descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, }, }, }, }, }, }, } } type test struct { file func() descriptor.File openapiOperation *openapi_options.Operation parameters openapiParametersObject } tests := map[string]*test{ "type string": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Type: openapi_options.HeaderParameter_STRING, }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Type: "string", }, }, }, "type string with format": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Type: openapi_options.HeaderParameter_STRING, Format: "uuid", }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Type: "string", Format: "uuid", }, }, }, "type integer": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Type: openapi_options.HeaderParameter_INTEGER, }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Type: "integer", }, }, }, "type number": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Type: openapi_options.HeaderParameter_NUMBER, }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Type: "number", }, }, }, "type boolean": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Type: openapi_options.HeaderParameter_BOOLEAN, }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Type: "boolean", }, }, }, "header required": { file: file, openapiOperation: &openapi_options.Operation{ Parameters: &openapi_options.Parameters{ Headers: []*openapi_options.HeaderParameter{ { Name: "X-Custom-Header", Required: true, Type: openapi_options.HeaderParameter_STRING, }, }, }, }, parameters: openapiParametersObject{ { Name: "X-Custom-Header", In: "header", Required: true, Type: "string", }, }, }, } for name, test := range tests { test := test t.Run(name, func(t *testing.T) { file := test.file() proto.SetExtension( proto.Message(file.Services[0].Methods[0].Options), openapi_options.E_Openapiv2Operation, test.openapiOperation) reg := descriptor.NewRegistry() fileCL := crossLinkFixture(&file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } params := result.getPathItemObject("/v1/echo").Get.Parameters if !reflect.DeepEqual(params, test.parameters) { t.Errorf("expected %+v, got %+v", test.parameters, params) } }) } } func GetPaths(req *openapiSwaggerObject) []string { paths := make([]string, len(req.Paths)) i := 0 for _, k := range req.Paths { paths[i] = k.Path i++ } return paths } func TestRenderServicesOpenapiPathsOrderPreserved(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod1"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod2"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/c/cpath", }, }, }, }, { MethodDescriptorProto: meth2, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/b/bpath", }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetPreserveRPCOrder(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := result.Paths firstRPCPath := file.Services[0].Methods[0].Bindings[0].PathTmpl.Template secondRPCPath := file.Services[0].Methods[1].Bindings[0].PathTmpl.Template for i, pathData := range paths { switch i { case 0: if got, want := pathData.Path, firstRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 1: if got, want := pathData.Path, secondRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } } } } func TestRenderServicesOpenapiPathsOrderPreservedMultipleServices(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod1"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod2"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } meth3 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod3"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } meth4 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod4"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc1 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyServiceOne"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } svc2 := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyServiceTwo"), Method: []*descriptorpb.MethodDescriptorProto{meth3, meth4}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc1, svc2}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/g/gpath", }, }, }, }, { MethodDescriptorProto: meth2, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/f/fpath", }, }, }, }, }, }, { ServiceDescriptorProto: svc1, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth3, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/c/cpath", }, }, }, }, { MethodDescriptorProto: meth4, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/b/bpath", }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetPreserveRPCOrder(true) reg.SetUseJSONNamesForFields(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := result.Paths firstRPCPath := file.Services[0].Methods[0].Bindings[0].PathTmpl.Template secondRPCPath := file.Services[0].Methods[1].Bindings[0].PathTmpl.Template thirdRPCPath := file.Services[1].Methods[0].Bindings[0].PathTmpl.Template fourthRPCPath := file.Services[1].Methods[1].Bindings[0].PathTmpl.Template for i, pathData := range paths { switch i { case 0: if got, want := pathData.Path, firstRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 1: if got, want := pathData.Path, secondRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 2: if got, want := pathData.Path, thirdRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 3: if got, want := pathData.Path, fourthRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } } } } func TestRenderServicesOpenapiPathsOrderPreservedAdditionalBindings(t *testing.T) { reqDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyRequest"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } resDesc := &descriptorpb.DescriptorProto{ Name: proto.String("MyResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("field"), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, }, } meth1 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod1"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } meth2 := &descriptorpb.MethodDescriptorProto{ Name: proto.String("MyMethod2"), InputType: proto.String("MyRequest"), OutputType: proto.String("MyResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("MyService"), Method: []*descriptorpb.MethodDescriptorProto{meth1, meth2}, } reqMsg := &descriptor.Message{ DescriptorProto: reqDesc, } resMsg := &descriptor.Message{ DescriptorProto: resDesc, } reqField := &descriptor.Field{ Message: reqMsg, FieldDescriptorProto: reqMsg.GetField()[0], } resField := &descriptor.Field{ Message: resMsg, FieldDescriptorProto: resMsg.GetField()[0], } reqField.JsonName = proto.String("field") resField.JsonName = proto.String("field") reqMsg.Fields = []*descriptor.Field{reqField} resMsg.Fields = []*descriptor.Field{resField} file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Package: proto.String("example"), Name: proto.String(",my_service.proto"), MessageType: []*descriptorpb.DescriptorProto{reqDesc, resDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{reqMsg, resMsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth1, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/c/cpath", }, }, { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/additionalbinding", }, }, }, }, { MethodDescriptorProto: meth2, RequestType: reqMsg, ResponseType: resMsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/b/bpath", }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetPreserveRPCOrder(true) reg.SetUseJSONNamesForFields(true) err := reg.Load(&pluginpb.CodeGeneratorRequest{ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}}) if err != nil { t.Fatalf("failed to reg.Load(): %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } paths := result.Paths if err != nil { t.Fatalf("failed to obtain extension paths: %v", err) } firstRPCPath := file.Services[0].Methods[0].Bindings[0].PathTmpl.Template firstRPCPathAdditionalBinding := file.Services[0].Methods[0].Bindings[1].PathTmpl.Template secondRPCPath := file.Services[0].Methods[1].Bindings[0].PathTmpl.Template for i, pathData := range paths { switch i { case 0: if got, want := pathData.Path, firstRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 1: if got, want := pathData.Path, firstRPCPathAdditionalBinding; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } case 2: if got, want := pathData.Path, secondRPCPath; got != want { t.Fatalf("RPC path order not preserved, got %s want %s", got, want) } } } } func TestArrayMessageItemsType(t *testing.T) { msgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("children"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.ExampleMessage"), Number: proto.Int32(1), JsonName: proto.String("children"), }, }, } nestDesc := &descriptorpb.DescriptorProto{ Name: proto.String("NestDescMessage"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("children"), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.ExampleMessage"), Number: proto.Int32(1), JsonName: proto.String("children"), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("NestDescMessage"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgDesc, } nsg := &descriptor.Message{ DescriptorProto: nestDesc, } msg.Fields = []*descriptor.Field{ { Message: msg, FieldDescriptorProto: msg.GetField()[0], }, } nsg.Fields = []*descriptor.Field{ { Message: nsg, FieldDescriptorProto: nsg.GetField()[0], }, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgDesc, nestDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nsg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: nsg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", Body: &descriptor.Body{ FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), }, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) if err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ { SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("acme/example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgDesc, nestDesc}, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("acme/example"), }, }, }, }); err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", reg, err) return } expect := openapiDefinitionsObject{ "rpcStatus": openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, Properties: &openapiSchemaObjectProperties{ keyVal{ Key: "code", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "integer", Format: "int32", }, }, }, keyVal{ Key: "message", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, keyVal{ Key: "details", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "object", Ref: "#/definitions/protobufAny", }, }, }, }, }, }, }, "exampleExampleMessage": openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, Properties: &openapiSchemaObjectProperties{ keyVal{ Key: "children", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "object", Ref: "#/definitions/exampleExampleMessage", }, }, }, }, }, }, }, "exampleNestDescMessage": openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, Properties: &openapiSchemaObjectProperties{ keyVal{ Key: "children", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: &openapiItemsObject{ schemaCore: schemaCore{ Type: "object", Ref: "#/definitions/exampleExampleMessage", }, }, }, }, }, }, }, "protobufAny": openapiSchemaObject{ schemaCore: schemaCore{ Type: "object", }, Properties: &openapiSchemaObjectProperties{ keyVal{ Key: "@type", Value: openapiSchemaObject{ schemaCore: schemaCore{ Type: "string", }, }, }, }, AdditionalProperties: &openapiSchemaObject{}, }, } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", reg, err) return } if want, is, name := []string{"application/json"}, result.Produces, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := expect, result.Definitions, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %v want to be %v", file, name, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestQueryParameterType(t *testing.T) { ntDesc := &descriptorpb.DescriptorProto{ Name: proto.String("AddressEntry"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("key"), Number: proto.Int32(1), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), JsonName: proto.String("key"), }, { Name: proto.String("value"), Number: proto.Int32(2), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), JsonName: proto.String("value"), }, }, Options: &descriptorpb.MessageOptions{ MapEntry: proto.Bool(true), }, } msgDesc := &descriptorpb.DescriptorProto{ Name: proto.String("Person"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("Address"), Number: proto.Int32(1), Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), TypeName: proto.String(".example.com.Person.AddressEntry"), JsonName: proto.String("Address"), }, }, NestedType: []*descriptorpb.DescriptorProto{ ntDesc, }, } nesteDesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleResponse"), Field: []*descriptorpb.FieldDescriptorProto{ { Name: proto.String("Key"), Number: proto.Int32(1), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), JsonName: proto.String("Key"), }, { Name: proto.String("Value"), Number: proto.Int32(2), Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), JsonName: proto.String("Value"), }, }, } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("Person"), OutputType: proto.String("ExampleResponse"), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgDesc, } nt := &descriptor.Message{ DescriptorProto: ntDesc, } nest := &descriptor.Message{ DescriptorProto: nesteDesc, } msg.Fields = []*descriptor.Field{ { Message: msg, FieldDescriptorProto: msg.GetField()[0], }, } nt.Fields = []*descriptor.Field{ { Message: nt, FieldDescriptorProto: msg.GetField()[0], }, } nest.Fields = []*descriptor.Field{ { Message: nest, FieldDescriptorProto: nest.GetField()[0], }, { Message: nest, FieldDescriptorProto: nest.GetField()[1], }, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("person.proto"), Package: proto.String("example.com"), MessageType: []*descriptorpb.DescriptorProto{msgDesc, nesteDesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg, nest}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: nest, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, }, }, }, }, }, }, } expect := openapiPathsObject{{ Path: "/v1/echo", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Parameters: openapiParametersObject{ { Name: "Address[string]", Description: `This is a request variable of the map type. The query format is "map_name[key]=value", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age["bob"]=18`, In: "query", Type: "integer", }, }, }, }, }} reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(&file) err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ { Name: proto.String("person.proto"), Package: proto.String("example.com"), SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, MessageType: []*descriptorpb.DescriptorProto{msgDesc, nesteDesc}, Service: []*descriptorpb.ServiceDescriptorProto{}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("person.proto"), }, }, }, }) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, is, name := []string{"application/json"}, result.Produces, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := expect[0].PathItemObject.Get.Parameters, result.getPathItemObject("/v1/echo").Get.Parameters, "Produces"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %v want to be %v", file, name, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } func TestApplyTemplateRequestWithServerStreamingHttpBody(t *testing.T) { meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Echo"), InputType: proto.String(".google.api.HttpBody"), OutputType: proto.String(".google.api.HttpBody"), ClientStreaming: proto.Bool(false), ServerStreaming: proto.Bool(true), } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } httpBodyFile, err := protoregistry.GlobalFiles.FindFileByPath("google/api/httpbody.proto") if err != nil { t.Fatal(err) } httpBodyFile.SourceLocations() desc, err := protoregistry.GlobalFiles.FindDescriptorByName("google.api.HttpBody") if err != nil { t.Fatal(err) } msg := &descriptor.Message{ DescriptorProto: protodesc.ToDescriptorProto(desc.(protoreflect.MessageDescriptor)), File: &descriptor.File{ FileDescriptorProto: protodesc.ToFileDescriptorProto(httpBodyFile), }, } anyFile, err := protoregistry.GlobalFiles.FindFileByPath("google/protobuf/any.proto") if err != nil { t.Fatal(err) } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), Dependency: []string{ "google/api/httpbody.proto", }, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "POST", PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", }, }, }, }, }, }, }, } reg := descriptor.NewRegistry() if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } err = reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{ protodesc.ToFileDescriptorProto(anyFile), protodesc.ToFileDescriptorProto(httpBodyFile), file.FileDescriptorProto, }, }) if err != nil { t.Fatalf("failed to load code generator request: %v", err) } result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return } if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } if _, ok := result.getPathItemObject("/v1/echo").Post.Responses["200"]; !ok { t.Errorf("applyTemplate(%#v).%s = expected 200 response to be defined", file, `result.getPathItemObject("/v1/echo").Post.Responses["200"]`) } else { if want, got, name := "A successful response.(streaming responses)", result.getPathItemObject("/v1/echo").Post.Responses["200"].Description, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessage := result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema if want, got, name := "string", streamExampleExampleMessage.Type, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Type`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } if want, got, name := "binary", streamExampleExampleMessage.Format, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Format`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } if want, got, name := "Free form byte stream", streamExampleExampleMessage.Title, `result.getPathItemObject("/v1/echo").Post.Responses["200"].Schema.Title`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } if len(*streamExampleExampleMessage.Properties) != 0 { t.Errorf("applyTemplate(%#v).Properties should be empty", file) } } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", file) t.Errorf("got: %s", fmt.Sprint(result)) } } // Returns the openapiPathItemObject associated with a path. func (so openapiSwaggerObject) getPathItemObject(path string) openapiPathItemObject { for _, pathData := range so.Paths { if pathData.Path == path { return pathData.PathItemObject } } return openapiPathItemObject{} } func TestGetPathItemObjectSwaggerObjectMethod(t *testing.T) { testCases := [...]struct { testName string swaggerObject openapiSwaggerObject path string expectedPathItemObject openapiPathItemObject }{ { testName: "Path present in swagger object", swaggerObject: openapiSwaggerObject{Paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}}, path: "a/path", expectedPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }, { testName: "Path not present in swaggerObject", swaggerObject: openapiSwaggerObject{Paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}}, path: "b/path", expectedPathItemObject: openapiPathItemObject{}, }, { testName: "Path present in swaggerPathsObject with multiple paths", swaggerObject: openapiSwaggerObject{Paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }, { Path: "another/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "Another testful description", }, }, }}}, path: "another/path", expectedPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "Another testful description", }, }, }, { testName: "Path not present in swaggerObject with no paths", swaggerObject: openapiSwaggerObject{}, path: "b/path", expectedPathItemObject: openapiPathItemObject{}, }, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { actualPathItemObject := tc.swaggerObject.getPathItemObject(tc.path) if isEqual := reflect.DeepEqual(actualPathItemObject, tc.expectedPathItemObject); !isEqual { t.Fatalf("Got pathItemObject: %#v, want pathItemObject: %#v", actualPathItemObject, tc.expectedPathItemObject) } }) } } func TestGetPathItemObjectFunction(t *testing.T) { testCases := [...]struct { testName string paths openapiPathsObject path string expectedPathItemObject openapiPathItemObject expectedIsPathPresent bool }{ { testName: "Path present in openapiPathsObject", paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}, path: "a/path", expectedPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, expectedIsPathPresent: true, }, { testName: "Path not present in openapiPathsObject", paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}, path: "b/path", expectedPathItemObject: openapiPathItemObject{}, expectedIsPathPresent: false, }, { testName: "Path present in openapiPathsObject with multiple paths", paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }, { Path: "another/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "Another testful description", }, }, }}, path: "another/path", expectedPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "Another testful description", }, }, expectedIsPathPresent: true, }, { testName: "Path not present in empty openapiPathsObject", paths: openapiPathsObject{}, path: "b/path", expectedPathItemObject: openapiPathItemObject{}, expectedIsPathPresent: false, }, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { actualPathItemObject, actualIsPathPresent := getPathItemObject(tc.paths, tc.path) if isEqual := reflect.DeepEqual(actualPathItemObject, tc.expectedPathItemObject); !isEqual { t.Fatalf("Got pathItemObject: %#v, want pathItemObject: %#v", actualPathItemObject, tc.expectedPathItemObject) } if actualIsPathPresent != tc.expectedIsPathPresent { t.Fatalf("Got isPathPresent bool: %t, want isPathPresent bool: %t", actualIsPathPresent, tc.expectedIsPathPresent) } }) } } func TestUpdatePaths(t *testing.T) { testCases := [...]struct { testName string paths openapiPathsObject pathToUpdate string newPathItemObject openapiPathItemObject expectedUpdatedPaths openapiPathsObject }{ { testName: "Path present in openapiPathsObject, pathItemObject updated.", paths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}, pathToUpdate: "a/path", newPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A newly updated testful description", }, }, expectedUpdatedPaths: openapiPathsObject{{ Path: "a/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A newly updated testful description", }, }, }}, }, { testName: "Path not present in openapiPathsObject, new path data appended.", paths: openapiPathsObject{{ Path: "c/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }}, pathToUpdate: "b/path", newPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A new testful description to add", }, }, expectedUpdatedPaths: openapiPathsObject{{ Path: "c/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A testful description", }, }, }, { Path: "b/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A new testful description to add", }, }, }}, }, { testName: "No paths present in openapiPathsObject, new path data appended.", paths: openapiPathsObject{}, pathToUpdate: "b/path", newPathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A new testful description to add", }, }, expectedUpdatedPaths: openapiPathsObject{{ Path: "b/path", PathItemObject: openapiPathItemObject{ Get: &openapiOperationObject{ Description: "A new testful description to add", }, }, }}, }, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { updatePaths(&tc.paths, tc.pathToUpdate, tc.newPathItemObject) if pathsCorrectlyUpdated := reflect.DeepEqual(tc.paths, tc.expectedUpdatedPaths); !pathsCorrectlyUpdated { t.Fatalf("Paths not correctly updated. Want %#v, got %#v", tc.expectedUpdatedPaths, tc.paths) } }) } } // Test that enum values have internal comments removed func TestEnumValueProtoComments(t *testing.T) { reg := descriptor.NewRegistry() name := "kind" comments := "(-- this is a comment --)" enum := &descriptor.Enum{ EnumDescriptorProto: &descriptorpb.EnumDescriptorProto{ Name: &name, }, File: &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ Name: new(string), Package: new(string), SourceCodeInfo: &descriptorpb.SourceCodeInfo{ Location: []*descriptorpb.SourceCodeInfo_Location{ &descriptorpb.SourceCodeInfo_Location{ LeadingComments: &comments, }, }, }, }, }, } comments = enumValueProtoComments(reg, enum) if comments != "" { t.Errorf("expected '', got '%v'", comments) } } func MustMarshal(v interface{}) []byte { b, err := json.Marshal(v) if err != nil { panic(err) } return b } func TestMergeTags(t *testing.T) { testCases := [...]struct { testName string existingTags []openapiTagObject newTags []openapiTagObject expectedMergedTags []openapiTagObject }{ { testName: "Simple merge.", existingTags: []openapiTagObject{{ Name: "tag1", Description: "tag1 description", }}, newTags: []openapiTagObject{{ Name: "tag2", Description: "tag2 description", }}, expectedMergedTags: []openapiTagObject{{ Name: "tag1", Description: "tag1 description", }, { Name: "tag2", Description: "tag2 description", }}, }, { testName: "Merge description", existingTags: []openapiTagObject{{ Name: "tag1", Description: "tag1 description", }, { Name: "tag2", }, { Name: "tag3", Description: "tag3 description", }}, newTags: []openapiTagObject{{ Name: "tag2", Description: "tag2 description", }}, expectedMergedTags: []openapiTagObject{{ Name: "tag1", Description: "tag1 description", }, { Name: "tag2", Description: "tag2 description", }, { Name: "tag3", Description: "tag3 description", }}, }, { testName: "Merge external docs", existingTags: []openapiTagObject{{ Name: "tag1", ExternalDocs: &openapiExternalDocumentationObject{}, }, { Name: "tag2", }, { Name: "tag3", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag3 description", }, }, { Name: "tag4", ExternalDocs: &openapiExternalDocumentationObject{ URL: "tag4 url", }, }}, newTags: []openapiTagObject{{ Name: "tag1", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag1 description", }, }, { Name: "tag2", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag2 description", URL: "tag2 url", }, }, { Name: "tag3", ExternalDocs: &openapiExternalDocumentationObject{ Description: "ignored tag3 description", URL: "tag3 url", }, }, { Name: "tag4", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag4 description", }, }}, expectedMergedTags: []openapiTagObject{{ Name: "tag1", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag1 description", }, }, { Name: "tag2", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag2 description", URL: "tag2 url", }, }, { Name: "tag3", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag3 description", URL: "tag3 url", }, }, { Name: "tag4", ExternalDocs: &openapiExternalDocumentationObject{ Description: "tag4 description", URL: "tag4 url", }, }}, }, { testName: "Merge extensions", existingTags: []openapiTagObject{{ Name: "tag1", extensions: []extension{{key: "x-key1", value: MustMarshal("key1 extension")}}, }, { Name: "tag2", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, {key: "x-key2", value: MustMarshal("key2 extension")}, }, }, { Name: "tag3", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, }, }, { Name: "tag4", extensions: nil, }}, newTags: []openapiTagObject{{ Name: "tag1", extensions: []extension{{key: "x-key2", value: MustMarshal("key2 extension")}}, }, { Name: "tag2", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, {key: "x-key2", value: MustMarshal("ignored key2 extension")}, {key: "x-key3", value: MustMarshal("key3 extension")}, }, }, { Name: "tag3", extensions: nil, }, { Name: "tag4", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, }, }}, expectedMergedTags: []openapiTagObject{{ Name: "tag1", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, {key: "x-key2", value: MustMarshal("key2 extension")}, }, }, { Name: "tag2", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, {key: "x-key2", value: MustMarshal("key2 extension")}, {key: "x-key3", value: MustMarshal("key3 extension")}, }, }, { Name: "tag3", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, }, }, { Name: "tag4", extensions: []extension{ {key: "x-key1", value: MustMarshal("key1 extension")}, }, }}, }, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { mergedTags := mergeTags(tc.existingTags, tc.newTags) if !reflect.DeepEqual(tc.expectedMergedTags, mergedTags) { t.Fatalf("%s: Tags not correctly merged. Want %#v, got %#v", tc.testName, tc.expectedMergedTags, mergedTags) } }) } } func TestApiVisibilityOption(t *testing.T) { reg := descriptor.NewRegistry() msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } msg := &descriptor.Message{ DescriptorProto: msgdesc, } methodExample := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), } serviceOptions := &descriptorpb.ServiceOptions{} proto.SetExtension(serviceOptions, visibility.E_ApiVisibility, &visibility.VisibilityRule{ Restriction: "INTERNAL", }) svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Options: serviceOptions, Method: []*descriptorpb.MethodDescriptorProto{methodExample}, } file := descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: methodExample, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/example", }, }, }, }, }, }, }, } err := reg.Load(&pluginpb.CodeGeneratorRequest{ ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto}, }) if err != nil { t.Errorf("failed to reg.Load(req): %v", err) } actual, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Fatalf("applyTemplate(%#v) failed with %v; want success", file, err) } if len(actual.Definitions) != 0 { t.Fatal("Definition should be excluded by api visibility option") } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/testdata/000077500000000000000000000000001465037340600334145ustar00rootroot00000000000000generator/000077500000000000000000000000001465037340600353235ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/testdatapath_item_object.prototext000066400000000000000000000012311465037340600426120ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/testdata/generatorfile_to_generate: "your/service/v1/your_service.proto" proto_file: { name: "your/service/v1/your_service.proto" package: "your.service.v1" message_type: { name: "StringMessage" field: { name: "value" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING json_name: "value" } } service: { name: "YourService" method: { name: "Echo" input_type: ".your.service.v1.StringMessage" output_type: ".your.service.v1.StringMessage" options: { [google.api.http]: { post: "/api/echo" } } } } options: { go_package: "github.com/yourorg/yourprotos/gen/go/your/service/v1" } syntax: "proto3" } path_item_object.swagger.yaml000066400000000000000000000011741465037340600431500ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/testdata/generatorswagger: "2.0" info: title: your/service/v1/your_service.proto version: version not set tags: - name: YourService consumes: - application/json produces: - application/json paths: /api/echo: post: operationId: YourService_Echo responses: "200": description: A successful response. schema: $ref: '#/definitions/v1StringMessage' parameters: - name: value in: query required: false type: string tags: - YourService definitions: v1StringMessage: type: object properties: value: type: string golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapi/types.go000066400000000000000000000365251465037340600333110ustar00rootroot00000000000000package genopenapi import ( "bytes" "encoding/json" "fmt" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "gopkg.in/yaml.v3" ) type param struct { *descriptor.File reg *descriptor.Registry } // http://swagger.io/specification/#infoObject type openapiInfoObject struct { Title string `json:"title" yaml:"title"` Description string `json:"description,omitempty" yaml:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"` Version string `json:"version" yaml:"version"` Contact *openapiContactObject `json:"contact,omitempty" yaml:"contact,omitempty"` License *openapiLicenseObject `json:"license,omitempty" yaml:"license,omitempty"` extensions []extension `json:"-" yaml:"-"` } // https://swagger.io/specification/#tagObject type openapiTagObject struct { Name string `json:"name" yaml:"name"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ExternalDocs *openapiExternalDocumentationObject `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` extensions []extension `json:"-" yaml:"-"` } // http://swagger.io/specification/#contactObject type openapiContactObject struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` Email string `json:"email,omitempty" yaml:"email,omitempty"` } // http://swagger.io/specification/#licenseObject type openapiLicenseObject struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` } // http://swagger.io/specification/#externalDocumentationObject type openapiExternalDocumentationObject struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` } type extension struct { key string `json:"-" yaml:"-"` value json.RawMessage `json:"-" yaml:"-"` } // http://swagger.io/specification/#swaggerObject type openapiSwaggerObject struct { Swagger string `json:"swagger" yaml:"swagger"` Info openapiInfoObject `json:"info" yaml:"info"` Tags []openapiTagObject `json:"tags,omitempty" yaml:"tags,omitempty"` Host string `json:"host,omitempty" yaml:"host,omitempty"` BasePath string `json:"basePath,omitempty" yaml:"basePath,omitempty"` Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty"` Consumes []string `json:"consumes" yaml:"consumes"` Produces []string `json:"produces" yaml:"produces"` Paths openapiPathsObject `json:"paths" yaml:"paths"` Definitions openapiDefinitionsObject `json:"definitions" yaml:"definitions"` SecurityDefinitions openapiSecurityDefinitionsObject `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"` Security []openapiSecurityRequirementObject `json:"security,omitempty" yaml:"security,omitempty"` ExternalDocs *openapiExternalDocumentationObject `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` extensions []extension `json:"-" yaml:"-"` } // http://swagger.io/specification/#securityDefinitionsObject type openapiSecurityDefinitionsObject map[string]openapiSecuritySchemeObject // http://swagger.io/specification/#securitySchemeObject type openapiSecuritySchemeObject struct { Type string `json:"type" yaml:"type"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` Flow string `json:"flow,omitempty" yaml:"flow,omitempty"` AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` Scopes openapiScopesObject `json:"scopes,omitempty" yaml:"scopes,omitempty"` extensions []extension `json:"-" yaml:"-"` } // http://swagger.io/specification/#scopesObject type openapiScopesObject map[string]string // http://swagger.io/specification/#securityRequirementObject type openapiSecurityRequirementObject map[string][]string // http://swagger.io/specification/#pathsObject type openapiPathsObject []pathData type pathData struct { Path string PathItemObject openapiPathItemObject } // http://swagger.io/specification/#pathItemObject type openapiPathItemObject struct { Get *openapiOperationObject `json:"get,omitempty" yaml:"get,omitempty"` Delete *openapiOperationObject `json:"delete,omitempty" yaml:"delete,omitempty"` Post *openapiOperationObject `json:"post,omitempty" yaml:"post,omitempty"` Put *openapiOperationObject `json:"put,omitempty" yaml:"put,omitempty"` Patch *openapiOperationObject `json:"patch,omitempty" yaml:"patch,omitempty"` Head *openapiOperationObject `json:"head,omitempty" yaml:"head,omitempty"` Options *openapiOperationObject `json:"options,omitempty" yaml:"options,omitempty"` // While TRACE is supported in OpenAPI v3, it is not supported in OpenAPI v2 // Trace *openapiOperationObject `json:"trace,omitempty" yaml:"trace,omitempty"` } // http://swagger.io/specification/#operationObject type openapiOperationObject struct { Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` OperationID string `json:"operationId" yaml:"operationId"` Responses openapiResponsesObject `json:"responses" yaml:"responses"` Parameters openapiParametersObject `json:"parameters,omitempty" yaml:"parameters,omitempty"` Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty"` Produces []string `json:"produces,omitempty" yaml:"produces,omitempty"` Security *[]openapiSecurityRequirementObject `json:"security,omitempty" yaml:"security,omitempty"` ExternalDocs *openapiExternalDocumentationObject `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` extensions []extension `json:"-" yaml:"-"` } type openapiParametersObject []openapiParameterObject // http://swagger.io/specification/#parameterObject type openapiParameterObject struct { Name string `json:"name" yaml:"name"` Description string `json:"description,omitempty" yaml:"description,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` Required bool `json:"required" yaml:"required"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Items *openapiItemsObject `json:"items,omitempty" yaml:"items,omitempty"` Enum interface{} `json:"enum,omitempty" yaml:"enum,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` MinItems *int `json:"minItems,omitempty" yaml:"minItems,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` // Or you can explicitly refer to another type. If this is defined all // other fields should be empty Schema *openapiSchemaObject `json:"schema,omitempty" yaml:"schema,omitempty"` extensions []extension } // core part of schema, which is common to itemsObject and schemaObject. // http://swagger.io/specification/v2/#itemsObject // The OAS3 spec (https://swagger.io/specification/#schemaObject) defines the // `nullable` field as part of a Schema Object. This behavior has been // "back-ported" to OAS2 as the Specification Extension `x-nullable`, and is // supported by generation tools such as swagger-codegen and go-swagger. // For protoc-gen-openapiv3, we'd want to add `nullable` instead. type schemaCore struct { Type string `json:"type,omitempty" yaml:"type,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` XNullable bool `json:"x-nullable,omitempty" yaml:"x-nullable,omitempty"` Example RawExample `json:"example,omitempty" yaml:"example,omitempty"` Items *openapiItemsObject `json:"items,omitempty" yaml:"items,omitempty"` // If the item is an enumeration include a list of all the *NAMES* of the // enum values. I'm not sure how well this will work but assuming all enums // start from 0 index it will be great. I don't think that is a good assumption. Enum interface{} `json:"enum,omitempty" yaml:"enum,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` } type allOfEntry struct { Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` } type RawExample json.RawMessage func (m RawExample) MarshalJSON() ([]byte, error) { return (json.RawMessage)(m).MarshalJSON() } func (m *RawExample) UnmarshalJSON(data []byte) error { return (*json.RawMessage)(m).UnmarshalJSON(data) } // MarshalYAML implements yaml.Marshaler interface. // // It converts RawExample to one of yaml-supported types and returns it. // // From yaml.Marshaler docs: The Marshaler interface may be implemented // by types to customize their behavior when being marshaled into a YAML // document. The returned value is marshaled in place of the original // value implementing Marshaler. func (e RawExample) MarshalYAML() (interface{}, error) { // From docs, json.Unmarshal will store one of next types to data: // - bool, for JSON booleans; // - float64, for JSON numbers; // - string, for JSON strings; // - []interface{}, for JSON arrays; // - map[string]interface{}, for JSON objects; // - nil for JSON null. var data interface{} if err := json.Unmarshal(e, &data); err != nil { return nil, err } return data, nil } func (s *schemaCore) setRefFromFQN(ref string, reg *descriptor.Registry) error { name, ok := fullyQualifiedNameToOpenAPIName(ref, reg) if !ok { return fmt.Errorf("setRefFromFQN: can't resolve OpenAPI name from %q", ref) } s.Ref = fmt.Sprintf("#/definitions/%s", name) return nil } type openapiItemsObject openapiSchemaObject // http://swagger.io/specification/#responsesObject type openapiResponsesObject map[string]openapiResponseObject // http://swagger.io/specification/#responseObject type openapiResponseObject struct { Description string `json:"description" yaml:"description"` Schema openapiSchemaObject `json:"schema" yaml:"schema"` Examples map[string]interface{} `json:"examples,omitempty" yaml:"examples,omitempty"` Headers openapiHeadersObject `json:"headers,omitempty" yaml:"headers,omitempty"` extensions []extension `json:"-" yaml:"-"` } type openapiHeadersObject map[string]openapiHeaderObject // http://swagger.io/specification/#headerObject type openapiHeaderObject struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Default RawExample `json:"default,omitempty" yaml:"default,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` } type keyVal struct { Key string Value interface{} } type openapiSchemaObjectProperties []keyVal func (p openapiSchemaObjectProperties) MarshalYAML() (interface{}, error) { n := yaml.Node{ Kind: yaml.MappingNode, Content: make([]*yaml.Node, len(p)*2), } for i, v := range p { keyNode := yaml.Node{} if err := keyNode.Encode(v.Key); err != nil { return nil, err } valueNode := yaml.Node{} if err := valueNode.Encode(v.Value); err != nil { return nil, err } n.Content[i*2+0] = &keyNode n.Content[i*2+1] = &valueNode } return n, nil } func (op openapiSchemaObjectProperties) MarshalJSON() ([]byte, error) { var buf bytes.Buffer buf.WriteString("{") for i, kv := range op { if i != 0 { buf.WriteString(",") } key, err := json.Marshal(kv.Key) if err != nil { return nil, err } buf.Write(key) buf.WriteString(":") val, err := json.Marshal(kv.Value) if err != nil { return nil, err } buf.Write(val) } buf.WriteString("}") return buf.Bytes(), nil } // http://swagger.io/specification/#schemaObject type openapiSchemaObject struct { schemaCore `yaml:",inline"` // Properties can be recursively defined Properties *openapiSchemaObjectProperties `json:"properties,omitempty" yaml:"properties,omitempty"` AdditionalProperties *openapiSchemaObject `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Title string `json:"title,omitempty" yaml:"title,omitempty"` ExternalDocs *openapiExternalDocumentationObject `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` Maximum float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` MaxLength uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` MaxItems uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` MaxProperties uint64 `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` MinProperties uint64 `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` Required []string `json:"required,omitempty" yaml:"required,omitempty"` extensions []extension AllOf []allOfEntry `json:"allOf,omitempty" yaml:"allOf,omitempty"` } // http://swagger.io/specification/#definitionsObject type openapiDefinitionsObject map[string]openapiSchemaObject // Internal type mapping from FQMN to descriptor.Message. Used as a set by the // findServiceMessages function. type messageMap map[string]*descriptor.Message // Internal type mapping from FQEN to descriptor.Enum. Used as a set by the // findServiceMessages function. type enumMap map[string]*descriptor.Enum // Internal type to store used references. type refMap map[string]struct{} types_test.go000066400000000000000000000040441465037340600342600ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/internal/genopenapipackage genopenapi import ( "encoding/json" "strings" "testing" "gopkg.in/yaml.v3" ) func newSpaceReplacer() *strings.Replacer { return strings.NewReplacer(" ", "", "\n", "", "\t", "") } func TestRawExample(t *testing.T) { t.Parallel() testCases := [...]struct { In RawExample Exp string }{{ In: RawExample(`1`), Exp: `1`, }, { In: RawExample(`"1"`), Exp: `"1"`, }, { In: RawExample(`{"hello":"worldr"}`), Exp: ` hello: worldr `, }} sr := newSpaceReplacer() for _, tc := range testCases { tc := tc t.Run(string(tc.In), func(t *testing.T) { t.Parallel() ex := tc.In out, err := yaml.Marshal(ex) switch { case err != nil: t.Fatalf("expect no yaml marshal error, got: %s", err) case !json.Valid(tc.In): t.Fatalf("json is invalid: %#q", tc.In) case sr.Replace(tc.Exp) != sr.Replace(string(out)): t.Fatalf("expected: %s, actual: %s", tc.Exp, out) } out, err = json.Marshal(tc.In) switch { case err != nil: t.Fatalf("expect no json marshal error, got: %s", err) case sr.Replace(string(tc.In)) != sr.Replace(string(out)): t.Fatalf("expected: %s, actual: %s", tc.In, out) } }) } } func TestOpenapiSchemaObjectProperties(t *testing.T) { t.Parallel() v := map[string]interface{}{ "example": openapiSchemaObjectProperties{{ Key: "test1", Value: 1, }, { Key: "test2", Value: 2, }}, } t.Run("yaml", func(t *testing.T) { t.Parallel() const exp = ` example: test1: 1 test2: 2 ` sr := newSpaceReplacer() out, err := yaml.Marshal(v) switch { case err != nil: t.Fatalf("expect no marshal error, got: %s", err) case sr.Replace(exp) != sr.Replace(string(out)): t.Fatalf("expected: %s, actual: %s", exp, out) } }) t.Run("json", func(t *testing.T) { t.Parallel() const exp = `{"example":{"test1":1,"test2":2}}` got, err := json.Marshal(v) switch { case err != nil: t.Fatalf("expect no marshal error, got: %s", err) case exp != string(got): t.Fatalf("expected: %s, actual: %s", exp, got) } }) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/main.go000066400000000000000000000311241465037340600271160ustar00rootroot00000000000000package main import ( "flag" "fmt" "os" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" ) var ( importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") file = flag.String("file", "-", "where to load data from") allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") grpcAPIConfiguration = flag.String("grpc_api_configuration", "", "path to file which describes the gRPC API Configuration in YAML format") allowMerge = flag.Bool("allow_merge", false, "if set, generation one OpenAPI file out of multiple protos") mergeFileName = flag.String("merge_file_name", "apidocs", "target OpenAPI file name prefix after merge") useJSONNamesForFields = flag.Bool("json_names_for_fields", true, "if disabled, the original proto name will be used for generating OpenAPI definitions") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`") versionFlag = flag.Bool("version", false, "print the current version") _ = flag.Bool("allow_repeated_fields_in_body", true, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option. DEPRECATED: the value is ignored and always behaves as `true`.") includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. If set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") useFQNForOpenAPIName = flag.Bool("fqn_for_openapi_name", false, "if set, the object's OpenAPI names will use the fully qualified names from the proto definition (ie my.package.MyMessage.MyInnerMessage). DEPRECATED: prefer `openapi_naming_strategy=fqn`") openAPINamingStrategy = flag.String("openapi_naming_strategy", "", "use the given OpenAPI naming strategy. Allowed values are `legacy`, `fqn`, `simple`. If unset, either `legacy` or `fqn` are selected, depending on the value of the `fqn_for_openapi_name` flag") useGoTemplate = flag.Bool("use_go_templates", false, "if set, you can use Go templates in protofile comments") goTemplateArgs = utilities.StringArrayFlag(flag.CommandLine, "go_template_args", "provide a custom value that can override a key in the Go template. Requires the `use_go_templates` option to be set") ignoreComments = flag.Bool("ignore_comments", false, "if set, all protofile comments are excluded from output") removeInternalComments = flag.Bool("remove_internal_comments", false, "if set, removes all substrings in comments that start with `(--` and end with `--)` as specified in https://google.aip.dev/192#internal-comments") disableDefaultErrors = flag.Bool("disable_default_errors", false, "if set, disables generation of default errors. This is useful if you have defined custom error handling") enumsAsInts = flag.Bool("enums_as_ints", false, "whether to render enum values as integers, as opposed to string values") simpleOperationIDs = flag.Bool("simple_operation_ids", false, "whether to remove the service prefix in the operationID generation. Can introduce duplicate operationIDs, use with caution.") proto3OptionalNullable = flag.Bool("proto3_optional_nullable", false, "whether Proto3 Optional fields should be marked as x-nullable") openAPIConfiguration = flag.String("openapi_configuration", "", "path to file which describes the OpenAPI Configuration in YAML format") generateUnboundMethods = flag.Bool("generate_unbound_methods", false, "generate swagger metadata even for RPC methods that have no HttpRule annotation") recursiveDepth = flag.Int("recursive-depth", 1000, "maximum recursion count allowed for a field type") omitEnumDefaultValue = flag.Bool("omit_enum_default_value", false, "if set, omit default enum value") outputFormat = flag.String("output_format", string(genopenapi.FormatJSON), fmt.Sprintf("output content format. Allowed values are: `%s`, `%s`", genopenapi.FormatJSON, genopenapi.FormatYAML)) visibilityRestrictionSelectors = utilities.StringArrayFlag(flag.CommandLine, "visibility_restriction_selectors", "list of `google.api.VisibilityRule` visibility labels to include in the generated output when a visibility annotation is defined. Repeat this option to supply multiple values. Elements without visibility annotations are unaffected by this setting.") disableServiceTags = flag.Bool("disable_service_tags", false, "if set, disables generation of service tags. This is useful if you do not want to expose the names of your backend grpc services.") disableDefaultResponses = flag.Bool("disable_default_responses", false, "if set, disables generation of default responses. Useful if you have to support custom response codes that are not 200.") useAllOfForRefs = flag.Bool("use_allof_for_refs", false, "if set, will use allOf as container for $ref to preserve same-level properties.") allowPatchFeature = flag.Bool("allow_patch_feature", true, "whether to hide update_mask fields in PATCH requests from the generated swagger file.") preserveRPCOrder = flag.Bool("preserve_rpc_order", false, "if true, will ensure the order of paths emitted in openapi swagger files mirror the order of RPC methods found in proto files. If false, emitted paths will be ordered alphabetically.") _ = flag.Bool("logtostderr", false, "Legacy glog compatibility. This flag is a no-op, you can safely remove it") ) // Variables set by goreleaser at build time var ( version = "dev" commit = "unknown" date = "unknown" ) func main() { flag.Parse() if *versionFlag { fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) os.Exit(0) } reg := descriptor.NewRegistry() if grpclog.V(1) { grpclog.Info("Processing code generator request") } f := os.Stdin if *file != "-" { var err error f, err = os.Open(*file) if err != nil { grpclog.Fatal(err) } } if grpclog.V(1) { grpclog.Info("Parsing code generator request") } req, err := codegenerator.ParseRequest(f) if err != nil { grpclog.Fatal(err) } if grpclog.V(1) { grpclog.Info("Parsed code generator request") } pkgMap := make(map[string]string) if req.Parameter != nil { if err := parseReqParam(req.GetParameter(), flag.CommandLine, pkgMap); err != nil { grpclog.Fatalf("Error parsing flags: %v", err) } } reg.SetPrefix(*importPrefix) reg.SetAllowDeleteBody(*allowDeleteBody) reg.SetAllowMerge(*allowMerge) reg.SetMergeFileName(*mergeFileName) reg.SetUseJSONNamesForFields(*useJSONNamesForFields) flag.Visit(func(f *flag.Flag) { if f.Name == "allow_repeated_fields_in_body" { grpclog.Warning("The `allow_repeated_fields_in_body` flag is deprecated and will always behave as `true`.") } }) reg.SetIncludePackageInTags(*includePackageInTags) reg.SetUseFQNForOpenAPIName(*useFQNForOpenAPIName) // Set the naming strategy either directly from the flag, or via the value of the legacy fqn_for_openapi_name // flag. namingStrategy := *openAPINamingStrategy if *useFQNForOpenAPIName { if namingStrategy != "" { grpclog.Fatal("The deprecated `fqn_for_openapi_name` flag must remain unset if `openapi_naming_strategy` is set.") } grpclog.Warning("The `fqn_for_openapi_name` flag is deprecated. Please use `openapi_naming_strategy=fqn` instead.") namingStrategy = "fqn" } else if namingStrategy == "" { namingStrategy = "legacy" } if strategyFn := genopenapi.LookupNamingStrategy(namingStrategy); strategyFn == nil { emitError(fmt.Errorf("invalid naming strategy %q", namingStrategy)) return } if *useGoTemplate && *ignoreComments { emitError(fmt.Errorf("`ignore_comments` and `use_go_templates` are mutually exclusive and cannot be enabled at the same time")) return } reg.SetUseGoTemplate(*useGoTemplate) reg.SetIgnoreComments(*ignoreComments) reg.SetRemoveInternalComments(*removeInternalComments) if len(*goTemplateArgs) > 0 && !*useGoTemplate { emitError(fmt.Errorf("`go_template_args` requires `use_go_templates` to be enabled")) return } reg.SetGoTemplateArgs(*goTemplateArgs) reg.SetOpenAPINamingStrategy(namingStrategy) reg.SetEnumsAsInts(*enumsAsInts) reg.SetDisableDefaultErrors(*disableDefaultErrors) reg.SetSimpleOperationIDs(*simpleOperationIDs) reg.SetProto3OptionalNullable(*proto3OptionalNullable) reg.SetGenerateUnboundMethods(*generateUnboundMethods) reg.SetRecursiveDepth(*recursiveDepth) reg.SetOmitEnumDefaultValue(*omitEnumDefaultValue) reg.SetVisibilityRestrictionSelectors(*visibilityRestrictionSelectors) reg.SetDisableServiceTags(*disableServiceTags) reg.SetDisableDefaultResponses(*disableDefaultResponses) reg.SetUseAllOfForRefs(*useAllOfForRefs) reg.SetAllowPatchFeature(*allowPatchFeature) reg.SetPreserveRPCOrder(*preserveRPCOrder) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return } for k, v := range pkgMap { reg.AddPkgMap(k, v) } if *grpcAPIConfiguration != "" { if err := reg.LoadGrpcAPIServiceFromYAML(*grpcAPIConfiguration); err != nil { emitError(err) return } } format := genopenapi.Format(*outputFormat) if err := format.Validate(); err != nil { emitError(err) return } g := genopenapi.New(reg, format) if err := genopenapi.AddErrorDefs(reg); err != nil { emitError(err) return } if err := reg.Load(req); err != nil { emitError(err) return } if *openAPIConfiguration != "" { if err := reg.LoadOpenAPIConfigFromYAML(*openAPIConfiguration); err != nil { emitError(err) return } } targets := make([]*descriptor.File, 0, len(req.FileToGenerate)) for _, target := range req.FileToGenerate { f, err := reg.LookupFile(target) if err != nil { grpclog.Fatal(err) } targets = append(targets, f) } out, err := g.Generate(targets) if grpclog.V(1) { grpclog.Info("Processed code generator request") } if err != nil { emitError(err) return } emitFiles(out) } func emitFiles(out []*descriptor.ResponseFile) { files := make([]*pluginpb.CodeGeneratorResponse_File, len(out)) for idx, item := range out { files[idx] = item.CodeGeneratorResponse_File } resp := &pluginpb.CodeGeneratorResponse{File: files} codegenerator.SetSupportedFeaturesOnCodeGeneratorResponse(resp) emitResp(resp) } func emitError(err error) { emitResp(&pluginpb.CodeGeneratorResponse{Error: proto.String(err.Error())}) } func emitResp(resp *pluginpb.CodeGeneratorResponse) { buf, err := proto.Marshal(resp) if err != nil { grpclog.Fatal(err) } if _, err := os.Stdout.Write(buf); err != nil { grpclog.Fatal(err) } } // parseReqParam parses a CodeGeneratorRequest parameter and adds the // extracted values to the given FlagSet and pkgMap. Returns a non-nil // error if setting a flag failed. func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) error { if param == "" { return nil } for _, p := range strings.Split(param, ",") { spec := strings.SplitN(p, "=", 2) if len(spec) == 1 { switch spec[0] { case "allow_delete_body": if err := f.Set(spec[0], "true"); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } continue case "allow_merge": if err := f.Set(spec[0], "true"); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } continue case "allow_repeated_fields_in_body": if err := f.Set(spec[0], "true"); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } continue case "include_package_in_tags": if err := f.Set(spec[0], "true"); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } continue } if err := f.Set(spec[0], ""); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } continue } name, value := spec[0], spec[1] if strings.HasPrefix(name, "M") { pkgMap[name[1:]] = value continue } if err := f.Set(name, value); err != nil { return fmt.Errorf("cannot set flag %s: %w", p, err) } } return nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/main_test.go000066400000000000000000000221271465037340600301600ustar00rootroot00000000000000package main import ( "errors" "flag" "reflect" "testing" ) func TestParseReqParam(t *testing.T) { testcases := []struct { name string expected map[string]string request string expectedError error allowDeleteBodyV bool allowMergeV bool includePackageInTagsV bool fileV string importPathV string mergeFileNameV string useFQNForOpenAPINameV bool openAPINamingStrategyV string }{ { // this one must be first - with no leading clearFlags call it // verifies our expectation of default values as we reset by // clearFlags name: "Test 0", expected: map[string]string{}, request: "", allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "-", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 1", expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"}, request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api", allowDeleteBodyV: true, allowMergeV: true, includePackageInTagsV: true, fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "apidocs", }, { name: "Test 2", expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"}, request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,include_package_in_tags=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api", allowDeleteBodyV: true, allowMergeV: true, includePackageInTagsV: true, fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "test_name", }, { name: "Test 3", expected: map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"}, request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 4", expected: map[string]string{}, request: "", allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 5", expected: map[string]string{}, request: "unknown_param=17", expectedError: errors.New("cannot set flag unknown_param=17: no such flag -unknown_param"), allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 6", expected: map[string]string{}, request: "Mfoo", expectedError: errors.New("cannot set flag Mfoo: no such flag -Mfoo"), allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 7", expected: map[string]string{}, request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,merge_file_name", allowDeleteBodyV: true, allowMergeV: true, includePackageInTagsV: true, fileV: "", importPathV: "", mergeFileNameV: "", }, { name: "Test 8", expected: map[string]string{}, request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name", expectedError: errors.New(`cannot set flag allow_repeated_fields_in_body=3: parse error`), allowDeleteBodyV: true, allowMergeV: true, includePackageInTagsV: false, fileV: "", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 9", expected: map[string]string{}, request: "include_package_in_tags=3", expectedError: errors.New(`cannot set flag include_package_in_tags=3: parse error`), allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 10", expected: map[string]string{}, request: "fqn_for_openapi_name=3", expectedError: errors.New(`cannot set flag fqn_for_openapi_name=3: parse error`), allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 11", expected: map[string]string{}, request: "fqn_for_openapi_name=true", allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: true, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 12", expected: map[string]string{}, request: "openapi_naming_strategy=simple", allowDeleteBodyV: false, allowMergeV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: false, openAPINamingStrategyV: "simple", fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, } for i, tc := range testcases { t.Run(tc.name, func(tt *testing.T) { f := flag.CommandLine pkgMap := make(map[string]string) err := parseReqParam(tc.request, f, pkgMap) if tc.expectedError == nil { if err != nil { tt.Errorf("unexpected parse error '%v'", err) } if !reflect.DeepEqual(pkgMap, tc.expected) { tt.Errorf("pkgMap parse error, expected '%v', got '%v'", tc.expected, pkgMap) } } else { if err == nil { tt.Error("expected parse error not returned") } if !reflect.DeepEqual(pkgMap, tc.expected) { tt.Errorf("pkgMap parse error, expected '%v', got '%v'", tc.expected, pkgMap) } if err.Error() != tc.expectedError.Error() { tt.Errorf("expected error malformed, expected %q, got %q", tc.expectedError.Error(), err.Error()) } } checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.includePackageInTagsV, tc.useFQNForOpenAPINameV, tc.openAPINamingStrategyV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) clearFlags() }) } } func checkFlags( allowDeleteV, allowMergeV, includePackageInTagsV bool, useFQNForOpenAPINameV bool, openAPINamingStrategyV, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int, ) { if *importPrefix != importPathV { t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) } if *file != fileV { t.Errorf("Test %v: file misparsed, expected '%v', got '%v'", tid, fileV, *file) } if *allowDeleteBody != allowDeleteV { t.Errorf("Test %v: allow_delete_body misparsed, expected '%v', got '%v'", tid, allowDeleteV, *allowDeleteBody) } if *allowMerge != allowMergeV { t.Errorf("Test %v: allow_merge misparsed, expected '%v', got '%v'", tid, allowMergeV, *allowMerge) } if *mergeFileName != mergeFileNameV { t.Errorf("Test %v: merge_file_name misparsed, expected '%v', got '%v'", tid, mergeFileNameV, *mergeFileName) } if *includePackageInTags != includePackageInTagsV { t.Errorf("Test %v: include_package_in_tags misparsed, expected '%v', got '%v'", tid, includePackageInTagsV, *includePackageInTags) } if *useFQNForOpenAPIName != useFQNForOpenAPINameV { t.Errorf("Test %v: fqn_for_openapi_name misparsed, expected '%v', got '%v'", tid, useFQNForOpenAPINameV, *useFQNForOpenAPIName) } if *openAPINamingStrategy != openAPINamingStrategyV { t.Errorf("Test %v: openapi_naming_strategy misparsed, expected '%v', got '%v'", tid, openAPINamingStrategyV, *openAPINamingStrategy) } } func clearFlags() { *importPrefix = "" *file = "stdin" *allowDeleteBody = false *allowMerge = false *includePackageInTags = false *mergeFileName = "apidocs" *useFQNForOpenAPIName = false *openAPINamingStrategy = "" } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/000077500000000000000000000000001465037340600273355ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/BUILD.bazel000066400000000000000000000020531465037340600312130ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) filegroup( name = "options_proto_files", srcs = [ "annotations.proto", "openapiv2.proto", ], ) go_library( name = "options", embed = [":options_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options", ) proto_library( name = "options_proto", srcs = [ "annotations.proto", "openapiv2.proto", ], deps = [ "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:struct_proto", ], ) go_proto_library( name = "options_go_proto", compilers = ["//:go_apiv2"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options", proto = ":options_proto", ) alias( name = "go_default_library", actual = ":options", visibility = ["//visibility:public"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/annotations.pb.go000066400000000000000000000327521465037340600326320ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: protoc-gen-openapiv2/options/annotations.proto package options import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" ) 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) ) var file_protoc_gen_openapiv2_options_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FileOptions)(nil), ExtensionType: (*Swagger)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger", Tag: "bytes,1042,opt,name=openapiv2_swagger", Filename: "protoc-gen-openapiv2/options/annotations.proto", }, { ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*Operation)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation", Tag: "bytes,1042,opt,name=openapiv2_operation", Filename: "protoc-gen-openapiv2/options/annotations.proto", }, { ExtendedType: (*descriptorpb.MessageOptions)(nil), ExtensionType: (*Schema)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema", Tag: "bytes,1042,opt,name=openapiv2_schema", Filename: "protoc-gen-openapiv2/options/annotations.proto", }, { ExtendedType: (*descriptorpb.ServiceOptions)(nil), ExtensionType: (*Tag)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag", Tag: "bytes,1042,opt,name=openapiv2_tag", Filename: "protoc-gen-openapiv2/options/annotations.proto", }, { ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*JSONSchema)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field", Tag: "bytes,1042,opt,name=openapiv2_field", Filename: "protoc-gen-openapiv2/options/annotations.proto", }, } // Extension fields to descriptorpb.FileOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. // // optional grpc.gateway.protoc_gen_openapiv2.options.Swagger openapiv2_swagger = 1042; E_Openapiv2Swagger = &file_protoc_gen_openapiv2_options_annotations_proto_extTypes[0] ) // Extension fields to descriptorpb.MethodOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. // // optional grpc.gateway.protoc_gen_openapiv2.options.Operation openapiv2_operation = 1042; E_Openapiv2Operation = &file_protoc_gen_openapiv2_options_annotations_proto_extTypes[1] ) // Extension fields to descriptorpb.MessageOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. // // optional grpc.gateway.protoc_gen_openapiv2.options.Schema openapiv2_schema = 1042; E_Openapiv2Schema = &file_protoc_gen_openapiv2_options_annotations_proto_extTypes[2] ) // Extension fields to descriptorpb.ServiceOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. // // optional grpc.gateway.protoc_gen_openapiv2.options.Tag openapiv2_tag = 1042; E_Openapiv2Tag = &file_protoc_gen_openapiv2_options_annotations_proto_extTypes[3] ) // Extension fields to descriptorpb.FieldOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. // // optional grpc.gateway.protoc_gen_openapiv2.options.JSONSchema openapiv2_field = 1042; E_Openapiv2Field = &file_protoc_gen_openapiv2_options_annotations_proto_extTypes[4] ) var File_protoc_gen_openapiv2_options_annotations_proto protoreflect.FileDescriptor var file_protoc_gen_openapiv2_options_annotations_proto_rawDesc = []byte{ 0x0a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x1a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x7e, 0x0a, 0x11, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x5f, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x92, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x52, 0x10, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x3a, 0x86, 0x01, 0x0a, 0x13, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x92, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x12, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x7e, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 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, 0x92, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x3a, 0x75, 0x0a, 0x0d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x5f, 0x74, 0x61, 0x67, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x92, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x0c, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x54, 0x61, 0x67, 0x3a, 0x7e, 0x0a, 0x0f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 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, 0x92, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x0e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_protoc_gen_openapiv2_options_annotations_proto_goTypes = []interface{}{ (*descriptorpb.FileOptions)(nil), // 0: google.protobuf.FileOptions (*descriptorpb.MethodOptions)(nil), // 1: google.protobuf.MethodOptions (*descriptorpb.MessageOptions)(nil), // 2: google.protobuf.MessageOptions (*descriptorpb.ServiceOptions)(nil), // 3: google.protobuf.ServiceOptions (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions (*Swagger)(nil), // 5: grpc.gateway.protoc_gen_openapiv2.options.Swagger (*Operation)(nil), // 6: grpc.gateway.protoc_gen_openapiv2.options.Operation (*Schema)(nil), // 7: grpc.gateway.protoc_gen_openapiv2.options.Schema (*Tag)(nil), // 8: grpc.gateway.protoc_gen_openapiv2.options.Tag (*JSONSchema)(nil), // 9: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema } var file_protoc_gen_openapiv2_options_annotations_proto_depIdxs = []int32{ 0, // 0: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger:extendee -> google.protobuf.FileOptions 1, // 1: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation:extendee -> google.protobuf.MethodOptions 2, // 2: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema:extendee -> google.protobuf.MessageOptions 3, // 3: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag:extendee -> google.protobuf.ServiceOptions 4, // 4: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field:extendee -> google.protobuf.FieldOptions 5, // 5: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Swagger 6, // 6: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Operation 7, // 7: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Schema 8, // 8: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Tag 9, // 9: grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema 10, // [10:10] is the sub-list for method output_type 10, // [10:10] is the sub-list for method input_type 5, // [5:10] is the sub-list for extension type_name 0, // [0:5] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_protoc_gen_openapiv2_options_annotations_proto_init() } func file_protoc_gen_openapiv2_options_annotations_proto_init() { if File_protoc_gen_openapiv2_options_annotations_proto != nil { return } file_protoc_gen_openapiv2_options_openapiv2_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_protoc_gen_openapiv2_options_annotations_proto_rawDesc, NumEnums: 0, NumMessages: 0, NumExtensions: 5, NumServices: 0, }, GoTypes: file_protoc_gen_openapiv2_options_annotations_proto_goTypes, DependencyIndexes: file_protoc_gen_openapiv2_options_annotations_proto_depIdxs, ExtensionInfos: file_protoc_gen_openapiv2_options_annotations_proto_extTypes, }.Build() File_protoc_gen_openapiv2_options_annotations_proto = out.File file_protoc_gen_openapiv2_options_annotations_proto_rawDesc = nil file_protoc_gen_openapiv2_options_annotations_proto_goTypes = nil file_protoc_gen_openapiv2_options_annotations_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/annotations.proto000066400000000000000000000033401465037340600327570ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.protoc_gen_openapiv2.options; import "google/protobuf/descriptor.proto"; import "protoc-gen-openapiv2/options/openapiv2.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; extend google.protobuf.FileOptions { // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. Swagger openapiv2_swagger = 1042; } extend google.protobuf.MethodOptions { // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. Operation openapiv2_operation = 1042; } extend google.protobuf.MessageOptions { // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. Schema openapiv2_schema = 1042; } extend google.protobuf.ServiceOptions { // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. Tag openapiv2_tag = 1042; } extend google.protobuf.FieldOptions { // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // // All IDs are the same, as assigned. It is okay that they are the same, as they extend // different descriptor messages. JSONSchema openapiv2_field = 1042; } annotations.swagger.json000066400000000000000000000014741465037340600341520ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options{ "swagger": "2.0", "info": { "title": "protoc-gen-openapiv2/options/annotations.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/openapiv2.pb.go000066400000000000000000004247221465037340600322020ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: protoc-gen-openapiv2/options/openapiv2.proto package options import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" 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) ) // Scheme describes the schemes supported by the OpenAPI Swagger // and Operation objects. type Scheme int32 const ( Scheme_UNKNOWN Scheme = 0 Scheme_HTTP Scheme = 1 Scheme_HTTPS Scheme = 2 Scheme_WS Scheme = 3 Scheme_WSS Scheme = 4 ) // Enum value maps for Scheme. var ( Scheme_name = map[int32]string{ 0: "UNKNOWN", 1: "HTTP", 2: "HTTPS", 3: "WS", 4: "WSS", } Scheme_value = map[string]int32{ "UNKNOWN": 0, "HTTP": 1, "HTTPS": 2, "WS": 3, "WSS": 4, } ) func (x Scheme) Enum() *Scheme { p := new(Scheme) *p = x return p } func (x Scheme) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (Scheme) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[0].Descriptor() } func (Scheme) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[0] } func (x Scheme) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use Scheme.Descriptor instead. func (Scheme) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{0} } // `Type` is a supported HTTP header type. // See https://swagger.io/specification/v2/#parameterType. type HeaderParameter_Type int32 const ( HeaderParameter_UNKNOWN HeaderParameter_Type = 0 HeaderParameter_STRING HeaderParameter_Type = 1 HeaderParameter_NUMBER HeaderParameter_Type = 2 HeaderParameter_INTEGER HeaderParameter_Type = 3 HeaderParameter_BOOLEAN HeaderParameter_Type = 4 ) // Enum value maps for HeaderParameter_Type. var ( HeaderParameter_Type_name = map[int32]string{ 0: "UNKNOWN", 1: "STRING", 2: "NUMBER", 3: "INTEGER", 4: "BOOLEAN", } HeaderParameter_Type_value = map[string]int32{ "UNKNOWN": 0, "STRING": 1, "NUMBER": 2, "INTEGER": 3, "BOOLEAN": 4, } ) func (x HeaderParameter_Type) Enum() *HeaderParameter_Type { p := new(HeaderParameter_Type) *p = x return p } func (x HeaderParameter_Type) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (HeaderParameter_Type) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[1].Descriptor() } func (HeaderParameter_Type) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[1] } func (x HeaderParameter_Type) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use HeaderParameter_Type.Descriptor instead. func (HeaderParameter_Type) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{3, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 const ( JSONSchema_UNKNOWN JSONSchema_JSONSchemaSimpleTypes = 0 JSONSchema_ARRAY JSONSchema_JSONSchemaSimpleTypes = 1 JSONSchema_BOOLEAN JSONSchema_JSONSchemaSimpleTypes = 2 JSONSchema_INTEGER JSONSchema_JSONSchemaSimpleTypes = 3 JSONSchema_NULL JSONSchema_JSONSchemaSimpleTypes = 4 JSONSchema_NUMBER JSONSchema_JSONSchemaSimpleTypes = 5 JSONSchema_OBJECT JSONSchema_JSONSchemaSimpleTypes = 6 JSONSchema_STRING JSONSchema_JSONSchemaSimpleTypes = 7 ) // Enum value maps for JSONSchema_JSONSchemaSimpleTypes. var ( JSONSchema_JSONSchemaSimpleTypes_name = map[int32]string{ 0: "UNKNOWN", 1: "ARRAY", 2: "BOOLEAN", 3: "INTEGER", 4: "NULL", 5: "NUMBER", 6: "OBJECT", 7: "STRING", } JSONSchema_JSONSchemaSimpleTypes_value = map[string]int32{ "UNKNOWN": 0, "ARRAY": 1, "BOOLEAN": 2, "INTEGER": 3, "NULL": 4, "NUMBER": 5, "OBJECT": 6, "STRING": 7, } ) func (x JSONSchema_JSONSchemaSimpleTypes) Enum() *JSONSchema_JSONSchemaSimpleTypes { p := new(JSONSchema_JSONSchemaSimpleTypes) *p = x return p } func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (JSONSchema_JSONSchemaSimpleTypes) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[2].Descriptor() } func (JSONSchema_JSONSchemaSimpleTypes) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[2] } func (x JSONSchema_JSONSchemaSimpleTypes) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use JSONSchema_JSONSchemaSimpleTypes.Descriptor instead. func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{11, 0} } // The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". type SecurityScheme_Type int32 const ( SecurityScheme_TYPE_INVALID SecurityScheme_Type = 0 SecurityScheme_TYPE_BASIC SecurityScheme_Type = 1 SecurityScheme_TYPE_API_KEY SecurityScheme_Type = 2 SecurityScheme_TYPE_OAUTH2 SecurityScheme_Type = 3 ) // Enum value maps for SecurityScheme_Type. var ( SecurityScheme_Type_name = map[int32]string{ 0: "TYPE_INVALID", 1: "TYPE_BASIC", 2: "TYPE_API_KEY", 3: "TYPE_OAUTH2", } SecurityScheme_Type_value = map[string]int32{ "TYPE_INVALID": 0, "TYPE_BASIC": 1, "TYPE_API_KEY": 2, "TYPE_OAUTH2": 3, } ) func (x SecurityScheme_Type) Enum() *SecurityScheme_Type { p := new(SecurityScheme_Type) *p = x return p } func (x SecurityScheme_Type) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SecurityScheme_Type) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[3].Descriptor() } func (SecurityScheme_Type) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[3] } func (x SecurityScheme_Type) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SecurityScheme_Type.Descriptor instead. func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{14, 0} } // The location of the API key. Valid values are "query" or "header". type SecurityScheme_In int32 const ( SecurityScheme_IN_INVALID SecurityScheme_In = 0 SecurityScheme_IN_QUERY SecurityScheme_In = 1 SecurityScheme_IN_HEADER SecurityScheme_In = 2 ) // Enum value maps for SecurityScheme_In. var ( SecurityScheme_In_name = map[int32]string{ 0: "IN_INVALID", 1: "IN_QUERY", 2: "IN_HEADER", } SecurityScheme_In_value = map[string]int32{ "IN_INVALID": 0, "IN_QUERY": 1, "IN_HEADER": 2, } ) func (x SecurityScheme_In) Enum() *SecurityScheme_In { p := new(SecurityScheme_In) *p = x return p } func (x SecurityScheme_In) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SecurityScheme_In) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[4].Descriptor() } func (SecurityScheme_In) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[4] } func (x SecurityScheme_In) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SecurityScheme_In.Descriptor instead. func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{14, 1} } // The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". type SecurityScheme_Flow int32 const ( SecurityScheme_FLOW_INVALID SecurityScheme_Flow = 0 SecurityScheme_FLOW_IMPLICIT SecurityScheme_Flow = 1 SecurityScheme_FLOW_PASSWORD SecurityScheme_Flow = 2 SecurityScheme_FLOW_APPLICATION SecurityScheme_Flow = 3 SecurityScheme_FLOW_ACCESS_CODE SecurityScheme_Flow = 4 ) // Enum value maps for SecurityScheme_Flow. var ( SecurityScheme_Flow_name = map[int32]string{ 0: "FLOW_INVALID", 1: "FLOW_IMPLICIT", 2: "FLOW_PASSWORD", 3: "FLOW_APPLICATION", 4: "FLOW_ACCESS_CODE", } SecurityScheme_Flow_value = map[string]int32{ "FLOW_INVALID": 0, "FLOW_IMPLICIT": 1, "FLOW_PASSWORD": 2, "FLOW_APPLICATION": 3, "FLOW_ACCESS_CODE": 4, } ) func (x SecurityScheme_Flow) Enum() *SecurityScheme_Flow { p := new(SecurityScheme_Flow) *p = x return p } func (x SecurityScheme_Flow) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (SecurityScheme_Flow) Descriptor() protoreflect.EnumDescriptor { return file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[5].Descriptor() } func (SecurityScheme_Flow) Type() protoreflect.EnumType { return &file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes[5] } func (x SecurityScheme_Flow) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use SecurityScheme_Flow.Descriptor instead. func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{14, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // title: "Echo API"; // version: "1.0"; // description: ""; // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // }; // schemes: HTTPS; // consumes: "application/json"; // produces: "application/json"; // }; type Swagger struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Specifies the OpenAPI Specification version being used. It can be // used by the OpenAPI UI and other clients to interpret the API listing. The // value MUST be "2.0". Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` // Provides metadata about the API. The metadata can be used by the // clients if needed. Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` // The host (name or ip) serving the API. This MUST be the host only and does // not include the scheme nor sub-paths. It MAY include a port. If the host is // not included, the host serving the documentation is to be used (including // the port). The host does not support path templating. Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` // The base path on which the API is served, which is relative to the host. If // it is not included, the API is served directly under the host. The value // MUST start with a leading slash (/). The basePath does not support path // templating. // Note that using `base_path` does not change the endpoint paths that are // generated in the resulting OpenAPI file. If you wish to use `base_path` // with relatively generated OpenAPI paths, the `base_path` prefix must be // manually removed from your `google.api.http` paths and your code changed to // serve the API from the `base_path`. BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` // The transfer protocol of the API. Values MUST be from the list: "http", // "https", "ws", "wss". If the schemes is not included, the default scheme to // be used is the one used to access the OpenAPI definition itself. Schemes []Scheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.Scheme" json:"schemes,omitempty"` // A list of MIME types the APIs can consume. This is global to all APIs but // can be overridden on specific API calls. Value MUST be as described under // Mime Types. Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` // A list of MIME types the APIs can produce. This is global to all APIs but // can be overridden on specific API calls. Value MUST be as described under // Mime Types. Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` // An object to hold responses that can be used across operations. This // property does not define global responses for all operations. Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Security scheme definitions that can be used across the specification. SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` // A declaration of which security schemes are applied for the API as a whole. // The list of values describes alternative security schemes that can be used // (that is, there is a logical OR between the security requirements). // Individual operations can override this definition. Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` // A list of tags for API documentation control. Tags can be used for logical // grouping of operations by resources or any other qualifier. Tags []*Tag `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags,omitempty"` // Additional external documentation. ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,15,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Swagger) Reset() { *x = Swagger{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Swagger) String() string { return protoimpl.X.MessageStringOf(x) } func (*Swagger) ProtoMessage() {} func (x *Swagger) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Swagger.ProtoReflect.Descriptor instead. func (*Swagger) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{0} } func (x *Swagger) GetSwagger() string { if x != nil { return x.Swagger } return "" } func (x *Swagger) GetInfo() *Info { if x != nil { return x.Info } return nil } func (x *Swagger) GetHost() string { if x != nil { return x.Host } return "" } func (x *Swagger) GetBasePath() string { if x != nil { return x.BasePath } return "" } func (x *Swagger) GetSchemes() []Scheme { if x != nil { return x.Schemes } return nil } func (x *Swagger) GetConsumes() []string { if x != nil { return x.Consumes } return nil } func (x *Swagger) GetProduces() []string { if x != nil { return x.Produces } return nil } func (x *Swagger) GetResponses() map[string]*Response { if x != nil { return x.Responses } return nil } func (x *Swagger) GetSecurityDefinitions() *SecurityDefinitions { if x != nil { return x.SecurityDefinitions } return nil } func (x *Swagger) GetSecurity() []*SecurityRequirement { if x != nil { return x.Security } return nil } func (x *Swagger) GetTags() []*Tag { if x != nil { return x.Tags } return nil } func (x *Swagger) GetExternalDocs() *ExternalDocumentation { if x != nil { return x.ExternalDocs } return nil } func (x *Swagger) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `Operation` is a representation of OpenAPI v2 specification's Operation object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject // // Example: // // service EchoService { // rpc Echo(SimpleMessage) returns (SimpleMessage) { // option (google.api.http) = { // get: "/v1/example/echo/{id}" // }; // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { // summary: "Get a message."; // operation_id: "getMessage"; // tags: "echo"; // responses: { // key: "200" // value: { // description: "OK"; // } // } // }; // } // } type Operation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // A list of tags for API documentation control. Tags can be used for logical // grouping of operations by resources or any other qualifier. Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` // A short summary of what the operation does. For maximum readability in the // swagger-ui, this field SHOULD be less than 120 characters. Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` // A verbose explanation of the operation behavior. GFM syntax can be used for // rich text representation. Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // Additional external documentation for this operation. ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` // Unique string used to identify the operation. The id MUST be unique among // all operations described in the API. Tools and libraries MAY use the // operationId to uniquely identify an operation, therefore, it is recommended // to follow common programming naming conventions. OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` // A list of MIME types the operation can consume. This overrides the consumes // definition at the OpenAPI Object. An empty value MAY be used to clear the // global definition. Value MUST be as described under Mime Types. Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` // A list of MIME types the operation can produce. This overrides the produces // definition at the OpenAPI Object. An empty value MAY be used to clear the // global definition. Value MUST be as described under Mime Types. Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` // The list of possible responses as they are returned from executing this // operation. Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // The transfer protocol for the operation. Values MUST be from the list: // "http", "https", "ws", "wss". The value overrides the OpenAPI Object // schemes definition. Schemes []Scheme `protobuf:"varint,10,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.Scheme" json:"schemes,omitempty"` // Declares this operation to be deprecated. Usage of the declared operation // should be refrained. Default value is false. Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` // A declaration of which security schemes are applied for this operation. The // list of values describes alternative security schemes that can be used // (that is, there is a logical OR between the security requirements). This // definition overrides any declared top-level security. To remove a top-level // security declaration, an empty array can be used. Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,13,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Custom parameters such as HTTP request headers. // See: https://swagger.io/docs/specification/2-0/describing-parameters/ // and https://swagger.io/specification/v2/#parameter-object. Parameters *Parameters `protobuf:"bytes,14,opt,name=parameters,proto3" json:"parameters,omitempty"` } func (x *Operation) Reset() { *x = Operation{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Operation) String() string { return protoimpl.X.MessageStringOf(x) } func (*Operation) ProtoMessage() {} func (x *Operation) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Operation.ProtoReflect.Descriptor instead. func (*Operation) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{1} } func (x *Operation) GetTags() []string { if x != nil { return x.Tags } return nil } func (x *Operation) GetSummary() string { if x != nil { return x.Summary } return "" } func (x *Operation) GetDescription() string { if x != nil { return x.Description } return "" } func (x *Operation) GetExternalDocs() *ExternalDocumentation { if x != nil { return x.ExternalDocs } return nil } func (x *Operation) GetOperationId() string { if x != nil { return x.OperationId } return "" } func (x *Operation) GetConsumes() []string { if x != nil { return x.Consumes } return nil } func (x *Operation) GetProduces() []string { if x != nil { return x.Produces } return nil } func (x *Operation) GetResponses() map[string]*Response { if x != nil { return x.Responses } return nil } func (x *Operation) GetSchemes() []Scheme { if x != nil { return x.Schemes } return nil } func (x *Operation) GetDeprecated() bool { if x != nil { return x.Deprecated } return false } func (x *Operation) GetSecurity() []*SecurityRequirement { if x != nil { return x.Security } return nil } func (x *Operation) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } func (x *Operation) GetParameters() *Parameters { if x != nil { return x.Parameters } return nil } // `Parameters` is a representation of OpenAPI v2 specification's parameters object. // Note: This technically breaks compatibility with the OpenAPI 2 definition structure as we only // allow header parameters to be set here since we do not want users specifying custom non-header // parameters beyond those inferred from the Protobuf schema. // See: https://swagger.io/specification/v2/#parameter-object type Parameters struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // `Headers` is one or more HTTP header parameter. // See: https://swagger.io/docs/specification/2-0/describing-parameters/#header-parameters Headers []*HeaderParameter `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` } func (x *Parameters) Reset() { *x = Parameters{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Parameters) String() string { return protoimpl.X.MessageStringOf(x) } func (*Parameters) ProtoMessage() {} func (x *Parameters) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Parameters.ProtoReflect.Descriptor instead. func (*Parameters) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{2} } func (x *Parameters) GetHeaders() []*HeaderParameter { if x != nil { return x.Headers } return nil } // `HeaderParameter` a HTTP header parameter. // See: https://swagger.io/specification/v2/#parameter-object type HeaderParameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // `Name` is the header name. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // `Description` is a short description of the header. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // `Type` is the type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. // See: https://swagger.io/specification/v2/#parameterType. Type HeaderParameter_Type `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter_Type" json:"type,omitempty"` // `Format` The extending format for the previously mentioned type. Format string `protobuf:"bytes,4,opt,name=format,proto3" json:"format,omitempty"` // `Required` indicates if the header is optional Required bool `protobuf:"varint,5,opt,name=required,proto3" json:"required,omitempty"` } func (x *HeaderParameter) Reset() { *x = HeaderParameter{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HeaderParameter) String() string { return protoimpl.X.MessageStringOf(x) } func (*HeaderParameter) ProtoMessage() {} func (x *HeaderParameter) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 HeaderParameter.ProtoReflect.Descriptor instead. func (*HeaderParameter) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{3} } func (x *HeaderParameter) GetName() string { if x != nil { return x.Name } return "" } func (x *HeaderParameter) GetDescription() string { if x != nil { return x.Description } return "" } func (x *HeaderParameter) GetType() HeaderParameter_Type { if x != nil { return x.Type } return HeaderParameter_UNKNOWN } func (x *HeaderParameter) GetFormat() string { if x != nil { return x.Format } return "" } func (x *HeaderParameter) GetRequired() bool { if x != nil { return x.Required } return false } // `Header` is a representation of OpenAPI v2 specification's Header object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject type Header struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // `Description` is a short description of the header. Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // `Format` The extending format for the previously mentioned type. Format string `protobuf:"bytes,3,opt,name=format,proto3" json:"format,omitempty"` // `Default` Declares the value of the header that the server will use if none is provided. // See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. // Unlike JSON Schema this value MUST conform to the defined type for the header. Default string `protobuf:"bytes,6,opt,name=default,proto3" json:"default,omitempty"` // 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"` } func (x *Header) Reset() { *x = Header{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Header) String() string { return protoimpl.X.MessageStringOf(x) } func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Header.ProtoReflect.Descriptor instead. func (*Header) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{4} } func (x *Header) GetDescription() string { if x != nil { return x.Description } return "" } func (x *Header) GetType() string { if x != nil { return x.Type } return "" } func (x *Header) GetFormat() string { if x != nil { return x.Format } return "" } func (x *Header) GetDefault() string { if x != nil { return x.Default } return "" } func (x *Header) GetPattern() string { if x != nil { return x.Pattern } return "" } // `Response` is a representation of OpenAPI v2 specification's Response object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject type Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // `Description` is a short description of the response. // GFM syntax can be used for rich text representation. Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` // `Headers` A list of headers that are sent with the response. // `Header` name is expected to be a string in the canonical format of the MIME header key // See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey Headers map[string]*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // `Examples` gives per-mimetype response examples. // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object Examples map[string]string `protobuf:"bytes,4,rep,name=examples,proto3" json:"examples,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Response) Reset() { *x = Response{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Response) String() string { return protoimpl.X.MessageStringOf(x) } func (*Response) ProtoMessage() {} func (x *Response) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Response.ProtoReflect.Descriptor instead. func (*Response) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{5} } func (x *Response) GetDescription() string { if x != nil { return x.Description } return "" } func (x *Response) GetSchema() *Schema { if x != nil { return x.Schema } return nil } func (x *Response) GetHeaders() map[string]*Header { if x != nil { return x.Headers } return nil } func (x *Response) GetExamples() map[string]string { if x != nil { return x.Examples } return nil } func (x *Response) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `Info` is a representation of OpenAPI v2 specification's Info object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // title: "Echo API"; // version: "1.0"; // description: ""; // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // }; // ... // }; type Info struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The title of the application. Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` // A short description of the application. GFM syntax can be used for rich // text representation. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // The Terms of Service for the API. TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` // The contact information for the exposed API. Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` // The license information for the exposed API. License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` // Provides the version of the application API (not to be confused // with the specification version). Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Info) Reset() { *x = Info{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Info) String() string { return protoimpl.X.MessageStringOf(x) } func (*Info) ProtoMessage() {} func (x *Info) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Info.ProtoReflect.Descriptor instead. func (*Info) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{6} } func (x *Info) GetTitle() string { if x != nil { return x.Title } return "" } func (x *Info) GetDescription() string { if x != nil { return x.Description } return "" } func (x *Info) GetTermsOfService() string { if x != nil { return x.TermsOfService } return "" } func (x *Info) GetContact() *Contact { if x != nil { return x.Contact } return nil } func (x *Info) GetLicense() *License { if x != nil { return x.License } return nil } func (x *Info) GetVersion() string { if x != nil { return x.Version } return "" } func (x *Info) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `Contact` is a representation of OpenAPI v2 specification's Contact object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // ... // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // ... // }; // ... // }; type Contact struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The identifying name of the contact person/organization. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The URL pointing to the contact information. MUST be in the format of a // URL. Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` // The email address of the contact person/organization. MUST be in the format // of an email address. Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` } func (x *Contact) Reset() { *x = Contact{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Contact) String() string { return protoimpl.X.MessageStringOf(x) } func (*Contact) ProtoMessage() {} func (x *Contact) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Contact.ProtoReflect.Descriptor instead. func (*Contact) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{7} } func (x *Contact) GetName() string { if x != nil { return x.Name } return "" } func (x *Contact) GetUrl() string { if x != nil { return x.Url } return "" } func (x *Contact) GetEmail() string { if x != nil { return x.Email } return "" } // `License` is a representation of OpenAPI v2 specification's License object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // ... // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // ... // }; // ... // }; type License struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The license name used for the API. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A URL to the license used for the API. MUST be in the format of a URL. Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` } func (x *License) Reset() { *x = License{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *License) String() string { return protoimpl.X.MessageStringOf(x) } func (*License) ProtoMessage() {} func (x *License) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 License.ProtoReflect.Descriptor instead. func (*License) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{8} } func (x *License) GetName() string { if x != nil { return x.Name } return "" } func (x *License) GetUrl() string { if x != nil { return x.Url } return "" } // `ExternalDocumentation` is a representation of OpenAPI v2 specification's // ExternalDocumentation object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // ... // external_docs: { // description: "More about gRPC-Gateway"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // } // ... // }; type ExternalDocumentation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // A short description of the target documentation. GFM syntax can be used for // rich text representation. Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // The URL for the target documentation. Value MUST be in the format // of a URL. Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` } func (x *ExternalDocumentation) Reset() { *x = ExternalDocumentation{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ExternalDocumentation) String() string { return protoimpl.X.MessageStringOf(x) } func (*ExternalDocumentation) ProtoMessage() {} func (x *ExternalDocumentation) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 ExternalDocumentation.ProtoReflect.Descriptor instead. func (*ExternalDocumentation) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{9} } func (x *ExternalDocumentation) GetDescription() string { if x != nil { return x.Description } return "" } func (x *ExternalDocumentation) GetUrl() string { if x != nil { return x.Url } return "" } // `Schema` is a representation of OpenAPI v2 specification's Schema object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject type Schema struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` // Adds support for polymorphism. The discriminator is the schema property // name that is used to differentiate between other schema that inherit this // schema. The property name used MUST be defined at this schema and it MUST // be in the required property list. When used, the value MUST be the name of // this schema or any schema that inherits it. Discriminator string `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"` // Relevant only for Schema "properties" definitions. Declares the property as // "read only". This means that it MAY be sent as part of a response but MUST // NOT be sent as part of the request. Properties marked as readOnly being // true SHOULD NOT be in the required list of the defined schema. Default // value is false. ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` // Additional external documentation for this schema. ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` // A free-form property to include an example of an instance for this schema in JSON. // This is copied verbatim to the output. Example string `protobuf:"bytes,6,opt,name=example,proto3" json:"example,omitempty"` } func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Schema) String() string { return protoimpl.X.MessageStringOf(x) } func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Schema.ProtoReflect.Descriptor instead. func (*Schema) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{10} } func (x *Schema) GetJsonSchema() *JSONSchema { if x != nil { return x.JsonSchema } return nil } func (x *Schema) GetDiscriminator() string { if x != nil { return x.Discriminator } return "" } func (x *Schema) GetReadOnly() bool { if x != nil { return x.ReadOnly } return false } func (x *Schema) GetExternalDocs() *ExternalDocumentation { if x != nil { return x.ExternalDocs } return nil } func (x *Schema) GetExample() string { if x != nil { return x.Example } return "" } // `JSONSchema` represents properties from JSON Schema taken, and as used, in // the OpenAPI v2 spec. // // This includes changes made by OpenAPI v2. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject // // See also: https://cswr.github.io/JsonSchema/spec/basic_types/, // https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json // // Example: // // message SimpleMessage { // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { // json_schema: { // title: "SimpleMessage" // description: "A simple message." // required: ["id"] // } // }; // // // Id represents the message identifier. // string id = 1; [ // (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { // description: "The unique identifier of the simple message." // }]; // } type JSONSchema struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Ref is used to define an external reference to include in the message. // This could be a fully qualified proto message reference, and that type must // be imported into the protofile. If no message is identified, the Ref will // be used verbatim in the output. // For example: // // `ref: ".google.protobuf.Timestamp"`. Ref string `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"` // The title of the schema. Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // A short description of the schema. Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` Default string `protobuf:"bytes,7,opt,name=default,proto3" json:"default,omitempty"` ReadOnly bool `protobuf:"varint,8,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` // A free-form property to include a JSON example of this field. This is copied // verbatim to the output swagger.json. Quotes must be escaped. // This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject Example string `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` // Maximum represents an inclusive upper limit for a numeric instance. The // value of MUST be a number, Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` // minimum represents an inclusive lower limit for a numeric instance. The // value of MUST be a number, Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` Required []string `protobuf:"bytes,26,rep,name=required,proto3" json:"required,omitempty"` // Items in 'array' must be unique. Array []string `protobuf:"bytes,34,rep,name=array,proto3" json:"array,omitempty"` Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` // `Format` Format string `protobuf:"bytes,36,opt,name=format,proto3" json:"format,omitempty"` // Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 Enum []string `protobuf:"bytes,46,rep,name=enum,proto3" json:"enum,omitempty"` // Additional field level properties used when generating the OpenAPI v2 file. FieldConfiguration *JSONSchema_FieldConfiguration `protobuf:"bytes,1001,opt,name=field_configuration,json=fieldConfiguration,proto3" json:"field_configuration,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,48,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *JSONSchema) Reset() { *x = JSONSchema{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *JSONSchema) String() string { return protoimpl.X.MessageStringOf(x) } func (*JSONSchema) ProtoMessage() {} func (x *JSONSchema) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 JSONSchema.ProtoReflect.Descriptor instead. func (*JSONSchema) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{11} } func (x *JSONSchema) GetRef() string { if x != nil { return x.Ref } return "" } func (x *JSONSchema) GetTitle() string { if x != nil { return x.Title } return "" } func (x *JSONSchema) GetDescription() string { if x != nil { return x.Description } return "" } func (x *JSONSchema) GetDefault() string { if x != nil { return x.Default } return "" } func (x *JSONSchema) GetReadOnly() bool { if x != nil { return x.ReadOnly } return false } func (x *JSONSchema) GetExample() string { if x != nil { return x.Example } return "" } func (x *JSONSchema) GetMultipleOf() float64 { if x != nil { return x.MultipleOf } return 0 } func (x *JSONSchema) GetMaximum() float64 { if x != nil { return x.Maximum } return 0 } func (x *JSONSchema) GetExclusiveMaximum() bool { if x != nil { return x.ExclusiveMaximum } return false } func (x *JSONSchema) GetMinimum() float64 { if x != nil { return x.Minimum } return 0 } func (x *JSONSchema) GetExclusiveMinimum() bool { if x != nil { return x.ExclusiveMinimum } return false } func (x *JSONSchema) GetMaxLength() uint64 { if x != nil { return x.MaxLength } return 0 } func (x *JSONSchema) GetMinLength() uint64 { if x != nil { return x.MinLength } return 0 } func (x *JSONSchema) GetPattern() string { if x != nil { return x.Pattern } return "" } func (x *JSONSchema) GetMaxItems() uint64 { if x != nil { return x.MaxItems } return 0 } func (x *JSONSchema) GetMinItems() uint64 { if x != nil { return x.MinItems } return 0 } func (x *JSONSchema) GetUniqueItems() bool { if x != nil { return x.UniqueItems } return false } func (x *JSONSchema) GetMaxProperties() uint64 { if x != nil { return x.MaxProperties } return 0 } func (x *JSONSchema) GetMinProperties() uint64 { if x != nil { return x.MinProperties } return 0 } func (x *JSONSchema) GetRequired() []string { if x != nil { return x.Required } return nil } func (x *JSONSchema) GetArray() []string { if x != nil { return x.Array } return nil } func (x *JSONSchema) GetType() []JSONSchema_JSONSchemaSimpleTypes { if x != nil { return x.Type } return nil } func (x *JSONSchema) GetFormat() string { if x != nil { return x.Format } return "" } func (x *JSONSchema) GetEnum() []string { if x != nil { return x.Enum } return nil } func (x *JSONSchema) GetFieldConfiguration() *JSONSchema_FieldConfiguration { if x != nil { return x.FieldConfiguration } return nil } func (x *JSONSchema) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `Tag` is a representation of OpenAPI v2 specification's Tag object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject type Tag struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The name of the tag. Use it to allow override of the name of a // global Tag object, then use that name to reference the tag throughout the // OpenAPI file. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A short description for the tag. GFM syntax can be used for rich text // representation. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // Additional external documentation for this tag. ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,4,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Tag) Reset() { *x = Tag{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Tag) String() string { return protoimpl.X.MessageStringOf(x) } func (*Tag) ProtoMessage() {} func (x *Tag) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_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 Tag.ProtoReflect.Descriptor instead. func (*Tag) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{12} } func (x *Tag) GetName() string { if x != nil { return x.Name } return "" } func (x *Tag) GetDescription() string { if x != nil { return x.Description } return "" } func (x *Tag) GetExternalDocs() *ExternalDocumentation { if x != nil { return x.ExternalDocs } return nil } func (x *Tag) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `SecurityDefinitions` is a representation of OpenAPI v2 specification's // Security Definitions object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject // // A declaration of the security schemes available to be used in the // specification. This does not enforce the security schemes on the operations // and only serves to provide the relevant details for each scheme. type SecurityDefinitions struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // A single security scheme definition, mapping a "name" to the scheme it // defines. Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security,proto3" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SecurityDefinitions) Reset() { *x = SecurityDefinitions{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SecurityDefinitions) String() string { return protoimpl.X.MessageStringOf(x) } func (*SecurityDefinitions) ProtoMessage() {} func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[13] 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 SecurityDefinitions.ProtoReflect.Descriptor instead. func (*SecurityDefinitions) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{13} } func (x *SecurityDefinitions) GetSecurity() map[string]*SecurityScheme { if x != nil { return x.Security } return nil } // `SecurityScheme` is a representation of OpenAPI v2 specification's // Security Scheme object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject // // Allows the definition of a security scheme that can be used by the // operations. Supported schemes are basic authentication, an API key (either as // a header or as a query parameter) and OAuth2's common flows (implicit, // password, application and access code). type SecurityScheme struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme_Type" json:"type,omitempty"` // A short description for security scheme. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // The name of the header or query parameter to be used. // Valid for apiKey. Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // The location of the API key. Valid values are "query" or // "header". // Valid for apiKey. In SecurityScheme_In `protobuf:"varint,4,opt,name=in,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme_In" json:"in,omitempty"` // The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". // Valid for oauth2. Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,proto3,enum=grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme_Flow" json:"flow,omitempty"` // The authorization URL to be used for this flow. This SHOULD be in // the form of a URL. // Valid for oauth2/implicit and oauth2/accessCode. AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` // The token URL to be used for this flow. This SHOULD be in the // form of a URL. // Valid for oauth2/password, oauth2/application and oauth2/accessCode. TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` // The available scopes for the OAuth2 security scheme. // Valid for oauth2. Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ Extensions map[string]*structpb.Value `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SecurityScheme) Reset() { *x = SecurityScheme{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SecurityScheme) String() string { return protoimpl.X.MessageStringOf(x) } func (*SecurityScheme) ProtoMessage() {} func (x *SecurityScheme) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[14] 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 SecurityScheme.ProtoReflect.Descriptor instead. func (*SecurityScheme) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{14} } func (x *SecurityScheme) GetType() SecurityScheme_Type { if x != nil { return x.Type } return SecurityScheme_TYPE_INVALID } func (x *SecurityScheme) GetDescription() string { if x != nil { return x.Description } return "" } func (x *SecurityScheme) GetName() string { if x != nil { return x.Name } return "" } func (x *SecurityScheme) GetIn() SecurityScheme_In { if x != nil { return x.In } return SecurityScheme_IN_INVALID } func (x *SecurityScheme) GetFlow() SecurityScheme_Flow { if x != nil { return x.Flow } return SecurityScheme_FLOW_INVALID } func (x *SecurityScheme) GetAuthorizationUrl() string { if x != nil { return x.AuthorizationUrl } return "" } func (x *SecurityScheme) GetTokenUrl() string { if x != nil { return x.TokenUrl } return "" } func (x *SecurityScheme) GetScopes() *Scopes { if x != nil { return x.Scopes } return nil } func (x *SecurityScheme) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } return nil } // `SecurityRequirement` is a representation of OpenAPI v2 specification's // Security Requirement object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject // // Lists the required security schemes to execute this operation. The object can // have multiple security schemes declared in it which are all required (that // is, there is a logical AND between the schemes). // // The name used for each property MUST correspond to a security scheme // declared in the Security Definitions. type SecurityRequirement struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Each name must correspond to a security scheme which is declared in // the Security Definitions. If the security scheme is of type "oauth2", // then the value is a list of scope names required for the execution. // For other security scheme types, the array MUST be empty. SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement,proto3" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SecurityRequirement) Reset() { *x = SecurityRequirement{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SecurityRequirement) String() string { return protoimpl.X.MessageStringOf(x) } func (*SecurityRequirement) ProtoMessage() {} func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[15] 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 SecurityRequirement.ProtoReflect.Descriptor instead. func (*SecurityRequirement) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{15} } func (x *SecurityRequirement) GetSecurityRequirement() map[string]*SecurityRequirement_SecurityRequirementValue { if x != nil { return x.SecurityRequirement } return nil } // `Scopes` is a representation of OpenAPI v2 specification's Scopes object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject // // Lists the available scopes for an OAuth2 security scheme. type Scopes struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Maps between a name of a scope to a short description of it (as the value // of the property). Scope map[string]string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Scopes) Reset() { *x = Scopes{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Scopes) String() string { return protoimpl.X.MessageStringOf(x) } func (*Scopes) ProtoMessage() {} func (x *Scopes) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[16] 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 Scopes.ProtoReflect.Descriptor instead. func (*Scopes) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{16} } func (x *Scopes) GetScope() map[string]string { if x != nil { return x.Scope } return nil } // 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file. // These properties are not defined by OpenAPIv2, but they are used to control the generation. type JSONSchema_FieldConfiguration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Alternative parameter name when used as path parameter. If set, this will // be used as the complete parameter name when this field is used as a path // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. PathParamName string `protobuf:"bytes,47,opt,name=path_param_name,json=pathParamName,proto3" json:"path_param_name,omitempty"` } func (x *JSONSchema_FieldConfiguration) Reset() { *x = JSONSchema_FieldConfiguration{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *JSONSchema_FieldConfiguration) String() string { return protoimpl.X.MessageStringOf(x) } func (*JSONSchema_FieldConfiguration) ProtoMessage() {} func (x *JSONSchema_FieldConfiguration) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[25] 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 JSONSchema_FieldConfiguration.ProtoReflect.Descriptor instead. func (*JSONSchema_FieldConfiguration) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{11, 0} } func (x *JSONSchema_FieldConfiguration) GetPathParamName() string { if x != nil { return x.PathParamName } return "" } // If the security scheme is of type "oauth2", then the value is a list of // scope names required for the execution. For other security scheme types, // the array MUST be empty. type SecurityRequirement_SecurityRequirementValue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Scope []string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty"` } func (x *SecurityRequirement_SecurityRequirementValue) Reset() { *x = SecurityRequirement_SecurityRequirementValue{} if protoimpl.UnsafeEnabled { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SecurityRequirement_SecurityRequirementValue) String() string { return protoimpl.X.MessageStringOf(x) } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (x *SecurityRequirement_SecurityRequirementValue) ProtoReflect() protoreflect.Message { mi := &file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[30] 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 SecurityRequirement_SecurityRequirementValue.ProtoReflect.Descriptor instead. func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP(), []int{15, 0} } func (x *SecurityRequirement_SecurityRequirementValue) GetScope() []string { if x != nil { return x.Scope } return nil } var File_protoc_gen_openapiv2_options_openapiv2_proto protoreflect.FileDescriptor var file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = []byte{ 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x08, 0x0a, 0x07, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4b, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x71, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x65, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x62, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x71, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x49, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xd6, 0x07, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x65, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x61, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x5a, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x64, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x71, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x49, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x22, 0x62, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x54, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0xa3, 0x02, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x53, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x45, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x22, 0xd8, 0x01, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x4a, 0x04, 0x08, 0x0e, 0x10, 0x0f, 0x4a, 0x04, 0x08, 0x0f, 0x10, 0x10, 0x4a, 0x04, 0x08, 0x10, 0x10, 0x11, 0x4a, 0x04, 0x08, 0x11, 0x10, 0x12, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0x9a, 0x05, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5a, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x63, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6d, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x47, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd6, 0x03, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x4c, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5f, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x45, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x2f, 0x0a, 0x07, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x4b, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0xaa, 0x02, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x56, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0xd7, 0x0a, 0x0a, 0x0a, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x19, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x22, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x12, 0x5f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x4b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x2e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x7a, 0x0a, 0x13, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x65, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x30, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3c, 0x0a, 0x12, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x77, 0x0a, 0x15, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x55, 0x4c, 0x4c, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x4a, 0x04, 0x08, 0x13, 0x10, 0x14, 0x4a, 0x04, 0x08, 0x17, 0x10, 0x18, 0x4a, 0x04, 0x08, 0x1b, 0x10, 0x1c, 0x4a, 0x04, 0x08, 0x1c, 0x10, 0x1d, 0x4a, 0x04, 0x08, 0x1d, 0x10, 0x1e, 0x4a, 0x04, 0x08, 0x1e, 0x10, 0x22, 0x4a, 0x04, 0x08, 0x25, 0x10, 0x2a, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x2b, 0x10, 0x2e, 0x22, 0xd9, 0x02, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x65, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x5e, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x54, 0x61, 0x67, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x68, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x1a, 0x76, 0x0a, 0x0d, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xff, 0x06, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x4c, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2e, 0x49, 0x6e, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x52, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x69, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x49, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4b, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x50, 0x49, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x41, 0x55, 0x54, 0x48, 0x32, 0x10, 0x03, 0x22, 0x31, 0x0a, 0x02, 0x49, 0x6e, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x02, 0x22, 0x6a, 0x0a, 0x04, 0x46, 0x6c, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x57, 0x4f, 0x52, 0x44, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x04, 0x22, 0xf6, 0x02, 0x0a, 0x13, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x8a, 0x01, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x30, 0x0a, 0x18, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x1a, 0x9f, 0x01, 0x0a, 0x18, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x6d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x96, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x52, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x1a, 0x38, 0x0a, 0x0a, 0x53, 0x63, 0x6f, 0x70, 0x65, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x3b, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x53, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x53, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x57, 0x53, 0x53, 0x10, 0x04, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescOnce sync.Once file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescData = file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc ) func file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescGZIP() []byte { file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescOnce.Do(func() { file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescData) }) return file_protoc_gen_openapiv2_options_openapiv2_proto_rawDescData } var file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes = make([]protoimpl.MessageInfo, 33) var file_protoc_gen_openapiv2_options_openapiv2_proto_goTypes = []interface{}{ (Scheme)(0), // 0: grpc.gateway.protoc_gen_openapiv2.options.Scheme (HeaderParameter_Type)(0), // 1: grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter.Type (JSONSchema_JSONSchemaSimpleTypes)(0), // 2: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.JSONSchemaSimpleTypes (SecurityScheme_Type)(0), // 3: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Type (SecurityScheme_In)(0), // 4: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.In (SecurityScheme_Flow)(0), // 5: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Flow (*Swagger)(nil), // 6: grpc.gateway.protoc_gen_openapiv2.options.Swagger (*Operation)(nil), // 7: grpc.gateway.protoc_gen_openapiv2.options.Operation (*Parameters)(nil), // 8: grpc.gateway.protoc_gen_openapiv2.options.Parameters (*HeaderParameter)(nil), // 9: grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter (*Header)(nil), // 10: grpc.gateway.protoc_gen_openapiv2.options.Header (*Response)(nil), // 11: grpc.gateway.protoc_gen_openapiv2.options.Response (*Info)(nil), // 12: grpc.gateway.protoc_gen_openapiv2.options.Info (*Contact)(nil), // 13: grpc.gateway.protoc_gen_openapiv2.options.Contact (*License)(nil), // 14: grpc.gateway.protoc_gen_openapiv2.options.License (*ExternalDocumentation)(nil), // 15: grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation (*Schema)(nil), // 16: grpc.gateway.protoc_gen_openapiv2.options.Schema (*JSONSchema)(nil), // 17: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema (*Tag)(nil), // 18: grpc.gateway.protoc_gen_openapiv2.options.Tag (*SecurityDefinitions)(nil), // 19: grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions (*SecurityScheme)(nil), // 20: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme (*SecurityRequirement)(nil), // 21: grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement (*Scopes)(nil), // 22: grpc.gateway.protoc_gen_openapiv2.options.Scopes nil, // 23: grpc.gateway.protoc_gen_openapiv2.options.Swagger.ResponsesEntry nil, // 24: grpc.gateway.protoc_gen_openapiv2.options.Swagger.ExtensionsEntry nil, // 25: grpc.gateway.protoc_gen_openapiv2.options.Operation.ResponsesEntry nil, // 26: grpc.gateway.protoc_gen_openapiv2.options.Operation.ExtensionsEntry nil, // 27: grpc.gateway.protoc_gen_openapiv2.options.Response.HeadersEntry nil, // 28: grpc.gateway.protoc_gen_openapiv2.options.Response.ExamplesEntry nil, // 29: grpc.gateway.protoc_gen_openapiv2.options.Response.ExtensionsEntry nil, // 30: grpc.gateway.protoc_gen_openapiv2.options.Info.ExtensionsEntry (*JSONSchema_FieldConfiguration)(nil), // 31: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.FieldConfiguration nil, // 32: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.ExtensionsEntry nil, // 33: grpc.gateway.protoc_gen_openapiv2.options.Tag.ExtensionsEntry nil, // 34: grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions.SecurityEntry nil, // 35: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.ExtensionsEntry (*SecurityRequirement_SecurityRequirementValue)(nil), // 36: grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementValue nil, // 37: grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementEntry nil, // 38: grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntry (*structpb.Value)(nil), // 39: google.protobuf.Value } var file_protoc_gen_openapiv2_options_openapiv2_proto_depIdxs = []int32{ 12, // 0: grpc.gateway.protoc_gen_openapiv2.options.Swagger.info:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Info 0, // 1: grpc.gateway.protoc_gen_openapiv2.options.Swagger.schemes:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Scheme 23, // 2: grpc.gateway.protoc_gen_openapiv2.options.Swagger.responses:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Swagger.ResponsesEntry 19, // 3: grpc.gateway.protoc_gen_openapiv2.options.Swagger.security_definitions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions 21, // 4: grpc.gateway.protoc_gen_openapiv2.options.Swagger.security:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement 18, // 5: grpc.gateway.protoc_gen_openapiv2.options.Swagger.tags:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Tag 15, // 6: grpc.gateway.protoc_gen_openapiv2.options.Swagger.external_docs:type_name -> grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation 24, // 7: grpc.gateway.protoc_gen_openapiv2.options.Swagger.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Swagger.ExtensionsEntry 15, // 8: grpc.gateway.protoc_gen_openapiv2.options.Operation.external_docs:type_name -> grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation 25, // 9: grpc.gateway.protoc_gen_openapiv2.options.Operation.responses:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Operation.ResponsesEntry 0, // 10: grpc.gateway.protoc_gen_openapiv2.options.Operation.schemes:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Scheme 21, // 11: grpc.gateway.protoc_gen_openapiv2.options.Operation.security:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement 26, // 12: grpc.gateway.protoc_gen_openapiv2.options.Operation.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Operation.ExtensionsEntry 8, // 13: grpc.gateway.protoc_gen_openapiv2.options.Operation.parameters:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Parameters 9, // 14: grpc.gateway.protoc_gen_openapiv2.options.Parameters.headers:type_name -> grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter 1, // 15: grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter.type:type_name -> grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter.Type 16, // 16: grpc.gateway.protoc_gen_openapiv2.options.Response.schema:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Schema 27, // 17: grpc.gateway.protoc_gen_openapiv2.options.Response.headers:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Response.HeadersEntry 28, // 18: grpc.gateway.protoc_gen_openapiv2.options.Response.examples:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Response.ExamplesEntry 29, // 19: grpc.gateway.protoc_gen_openapiv2.options.Response.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Response.ExtensionsEntry 13, // 20: grpc.gateway.protoc_gen_openapiv2.options.Info.contact:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Contact 14, // 21: grpc.gateway.protoc_gen_openapiv2.options.Info.license:type_name -> grpc.gateway.protoc_gen_openapiv2.options.License 30, // 22: grpc.gateway.protoc_gen_openapiv2.options.Info.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Info.ExtensionsEntry 17, // 23: grpc.gateway.protoc_gen_openapiv2.options.Schema.json_schema:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema 15, // 24: grpc.gateway.protoc_gen_openapiv2.options.Schema.external_docs:type_name -> grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation 2, // 25: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.type:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.JSONSchemaSimpleTypes 31, // 26: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.field_configuration:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.FieldConfiguration 32, // 27: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.ExtensionsEntry 15, // 28: grpc.gateway.protoc_gen_openapiv2.options.Tag.external_docs:type_name -> grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation 33, // 29: grpc.gateway.protoc_gen_openapiv2.options.Tag.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Tag.ExtensionsEntry 34, // 30: grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions.security:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions.SecurityEntry 3, // 31: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.type:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Type 4, // 32: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.in:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.In 5, // 33: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.flow:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Flow 22, // 34: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.scopes:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Scopes 35, // 35: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.extensions:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.ExtensionsEntry 37, // 36: grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.security_requirement:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementEntry 38, // 37: grpc.gateway.protoc_gen_openapiv2.options.Scopes.scope:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntry 11, // 38: grpc.gateway.protoc_gen_openapiv2.options.Swagger.ResponsesEntry.value:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Response 39, // 39: grpc.gateway.protoc_gen_openapiv2.options.Swagger.ExtensionsEntry.value:type_name -> google.protobuf.Value 11, // 40: grpc.gateway.protoc_gen_openapiv2.options.Operation.ResponsesEntry.value:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Response 39, // 41: grpc.gateway.protoc_gen_openapiv2.options.Operation.ExtensionsEntry.value:type_name -> google.protobuf.Value 10, // 42: grpc.gateway.protoc_gen_openapiv2.options.Response.HeadersEntry.value:type_name -> grpc.gateway.protoc_gen_openapiv2.options.Header 39, // 43: grpc.gateway.protoc_gen_openapiv2.options.Response.ExtensionsEntry.value:type_name -> google.protobuf.Value 39, // 44: grpc.gateway.protoc_gen_openapiv2.options.Info.ExtensionsEntry.value:type_name -> google.protobuf.Value 39, // 45: grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.ExtensionsEntry.value:type_name -> google.protobuf.Value 39, // 46: grpc.gateway.protoc_gen_openapiv2.options.Tag.ExtensionsEntry.value:type_name -> google.protobuf.Value 20, // 47: grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions.SecurityEntry.value:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme 39, // 48: grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.ExtensionsEntry.value:type_name -> google.protobuf.Value 36, // 49: grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementEntry.value:type_name -> grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementValue 50, // [50:50] is the sub-list for method output_type 50, // [50:50] is the sub-list for method input_type 50, // [50:50] is the sub-list for extension type_name 50, // [50:50] is the sub-list for extension extendee 0, // [0:50] is the sub-list for field type_name } func init() { file_protoc_gen_openapiv2_options_openapiv2_proto_init() } func file_protoc_gen_openapiv2_options_openapiv2_proto_init() { if File_protoc_gen_openapiv2_options_openapiv2_proto != nil { return } if !protoimpl.UnsafeEnabled { file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Swagger); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Operation); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Parameters); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeaderParameter); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Response); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Info); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Contact); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*License); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExternalDocumentation); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Schema); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*JSONSchema); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Tag); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecurityDefinitions); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecurityScheme); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecurityRequirement); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Scopes); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*JSONSchema_FieldConfiguration); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecurityRequirement_SecurityRequirementValue); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc, NumEnums: 6, NumMessages: 33, NumExtensions: 0, NumServices: 0, }, GoTypes: file_protoc_gen_openapiv2_options_openapiv2_proto_goTypes, DependencyIndexes: file_protoc_gen_openapiv2_options_openapiv2_proto_depIdxs, EnumInfos: file_protoc_gen_openapiv2_options_openapiv2_proto_enumTypes, MessageInfos: file_protoc_gen_openapiv2_options_openapiv2_proto_msgTypes, }.Build() File_protoc_gen_openapiv2_options_openapiv2_proto = out.File file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = nil file_protoc_gen_openapiv2_options_openapiv2_proto_goTypes = nil file_protoc_gen_openapiv2_options_openapiv2_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/openapiv2.proto000066400000000000000000000700601465037340600323300ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.protoc_gen_openapiv2.options; import "google/protobuf/struct.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; // Scheme describes the schemes supported by the OpenAPI Swagger // and Operation objects. enum Scheme { UNKNOWN = 0; HTTP = 1; HTTPS = 2; WS = 3; WSS = 4; } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // title: "Echo API"; // version: "1.0"; // description: ""; // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // }; // schemes: HTTPS; // consumes: "application/json"; // produces: "application/json"; // }; // message Swagger { // Specifies the OpenAPI Specification version being used. It can be // used by the OpenAPI UI and other clients to interpret the API listing. The // value MUST be "2.0". string swagger = 1; // Provides metadata about the API. The metadata can be used by the // clients if needed. Info info = 2; // The host (name or ip) serving the API. This MUST be the host only and does // not include the scheme nor sub-paths. It MAY include a port. If the host is // not included, the host serving the documentation is to be used (including // the port). The host does not support path templating. string host = 3; // The base path on which the API is served, which is relative to the host. If // it is not included, the API is served directly under the host. The value // MUST start with a leading slash (/). The basePath does not support path // templating. // Note that using `base_path` does not change the endpoint paths that are // generated in the resulting OpenAPI file. If you wish to use `base_path` // with relatively generated OpenAPI paths, the `base_path` prefix must be // manually removed from your `google.api.http` paths and your code changed to // serve the API from the `base_path`. string base_path = 4; // The transfer protocol of the API. Values MUST be from the list: "http", // "https", "ws", "wss". If the schemes is not included, the default scheme to // be used is the one used to access the OpenAPI definition itself. repeated Scheme schemes = 5; // A list of MIME types the APIs can consume. This is global to all APIs but // can be overridden on specific API calls. Value MUST be as described under // Mime Types. repeated string consumes = 6; // A list of MIME types the APIs can produce. This is global to all APIs but // can be overridden on specific API calls. Value MUST be as described under // Mime Types. repeated string produces = 7; // field 8 is reserved for 'paths'. reserved 8; // field 9 is reserved for 'definitions', which at this time are already // exposed as and customizable as proto messages. reserved 9; // An object to hold responses that can be used across operations. This // property does not define global responses for all operations. map responses = 10; // Security scheme definitions that can be used across the specification. SecurityDefinitions security_definitions = 11; // A declaration of which security schemes are applied for the API as a whole. // The list of values describes alternative security schemes that can be used // (that is, there is a logical OR between the security requirements). // Individual operations can override this definition. repeated SecurityRequirement security = 12; // A list of tags for API documentation control. Tags can be used for logical // grouping of operations by resources or any other qualifier. repeated Tag tags = 13; // Additional external documentation. ExternalDocumentation external_docs = 14; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 15; } // `Operation` is a representation of OpenAPI v2 specification's Operation object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject // // Example: // // service EchoService { // rpc Echo(SimpleMessage) returns (SimpleMessage) { // option (google.api.http) = { // get: "/v1/example/echo/{id}" // }; // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { // summary: "Get a message."; // operation_id: "getMessage"; // tags: "echo"; // responses: { // key: "200" // value: { // description: "OK"; // } // } // }; // } // } message Operation { // A list of tags for API documentation control. Tags can be used for logical // grouping of operations by resources or any other qualifier. repeated string tags = 1; // A short summary of what the operation does. For maximum readability in the // swagger-ui, this field SHOULD be less than 120 characters. string summary = 2; // A verbose explanation of the operation behavior. GFM syntax can be used for // rich text representation. string description = 3; // Additional external documentation for this operation. ExternalDocumentation external_docs = 4; // Unique string used to identify the operation. The id MUST be unique among // all operations described in the API. Tools and libraries MAY use the // operationId to uniquely identify an operation, therefore, it is recommended // to follow common programming naming conventions. string operation_id = 5; // A list of MIME types the operation can consume. This overrides the consumes // definition at the OpenAPI Object. An empty value MAY be used to clear the // global definition. Value MUST be as described under Mime Types. repeated string consumes = 6; // A list of MIME types the operation can produce. This overrides the produces // definition at the OpenAPI Object. An empty value MAY be used to clear the // global definition. Value MUST be as described under Mime Types. repeated string produces = 7; // field 8 is reserved for 'parameters'. reserved 8; // The list of possible responses as they are returned from executing this // operation. map responses = 9; // The transfer protocol for the operation. Values MUST be from the list: // "http", "https", "ws", "wss". The value overrides the OpenAPI Object // schemes definition. repeated Scheme schemes = 10; // Declares this operation to be deprecated. Usage of the declared operation // should be refrained. Default value is false. bool deprecated = 11; // A declaration of which security schemes are applied for this operation. The // list of values describes alternative security schemes that can be used // (that is, there is a logical OR between the security requirements). This // definition overrides any declared top-level security. To remove a top-level // security declaration, an empty array can be used. repeated SecurityRequirement security = 12; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 13; // Custom parameters such as HTTP request headers. // See: https://swagger.io/docs/specification/2-0/describing-parameters/ // and https://swagger.io/specification/v2/#parameter-object. Parameters parameters = 14; } // `Parameters` is a representation of OpenAPI v2 specification's parameters object. // Note: This technically breaks compatibility with the OpenAPI 2 definition structure as we only // allow header parameters to be set here since we do not want users specifying custom non-header // parameters beyond those inferred from the Protobuf schema. // See: https://swagger.io/specification/v2/#parameter-object message Parameters { // `Headers` is one or more HTTP header parameter. // See: https://swagger.io/docs/specification/2-0/describing-parameters/#header-parameters repeated HeaderParameter headers = 1; } // `HeaderParameter` a HTTP header parameter. // See: https://swagger.io/specification/v2/#parameter-object message HeaderParameter { // `Type` is a supported HTTP header type. // See https://swagger.io/specification/v2/#parameterType. enum Type { UNKNOWN = 0; STRING = 1; NUMBER = 2; INTEGER = 3; BOOLEAN = 4; } // `Name` is the header name. string name = 1; // `Description` is a short description of the header. string description = 2; // `Type` is the type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. // See: https://swagger.io/specification/v2/#parameterType. Type type = 3; // `Format` The extending format for the previously mentioned type. string format = 4; // `Required` indicates if the header is optional bool required = 5; // field 6 is reserved for 'items', but in OpenAPI-specific way. reserved 6; // field 7 is reserved `Collection Format`. Determines the format of the array if type array is used. reserved 7; } // `Header` is a representation of OpenAPI v2 specification's Header object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject // message Header { // `Description` is a short description of the header. string description = 1; // The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. string type = 2; // `Format` The extending format for the previously mentioned type. string format = 3; // field 4 is reserved for 'items', but in OpenAPI-specific way. reserved 4; // field 5 is reserved `Collection Format` Determines the format of the array if type array is used. reserved 5; // `Default` Declares the value of the header that the server will use if none is provided. // See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. // Unlike JSON Schema this value MUST conform to the defined type for the header. string default = 6; // field 7 is reserved for 'maximum'. reserved 7; // field 8 is reserved for 'exclusiveMaximum'. reserved 8; // field 9 is reserved for 'minimum'. reserved 9; // field 10 is reserved for 'exclusiveMinimum'. reserved 10; // field 11 is reserved for 'maxLength'. reserved 11; // field 12 is reserved for 'minLength'. reserved 12; // 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. string pattern = 13; // field 14 is reserved for 'maxItems'. reserved 14; // field 15 is reserved for 'minItems'. reserved 15; // field 16 is reserved for 'uniqueItems'. reserved 16; // field 17 is reserved for 'enum'. reserved 17; // field 18 is reserved for 'multipleOf'. reserved 18; } // `Response` is a representation of OpenAPI v2 specification's Response object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject // message Response { // `Description` is a short description of the response. // GFM syntax can be used for rich text representation. string description = 1; // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. Schema schema = 2; // `Headers` A list of headers that are sent with the response. // `Header` name is expected to be a string in the canonical format of the MIME header key // See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey map headers = 3; // `Examples` gives per-mimetype response examples. // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object map examples = 4; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 5; } // `Info` is a representation of OpenAPI v2 specification's Info object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // title: "Echo API"; // version: "1.0"; // description: ""; // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // }; // ... // }; // message Info { // The title of the application. string title = 1; // A short description of the application. GFM syntax can be used for rich // text representation. string description = 2; // The Terms of Service for the API. string terms_of_service = 3; // The contact information for the exposed API. Contact contact = 4; // The license information for the exposed API. License license = 5; // Provides the version of the application API (not to be confused // with the specification version). string version = 6; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 7; } // `Contact` is a representation of OpenAPI v2 specification's Contact object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // ... // contact: { // name: "gRPC-Gateway project"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // email: "none@example.com"; // }; // ... // }; // ... // }; // message Contact { // The identifying name of the contact person/organization. string name = 1; // The URL pointing to the contact information. MUST be in the format of a // URL. string url = 2; // The email address of the contact person/organization. MUST be in the format // of an email address. string email = 3; } // `License` is a representation of OpenAPI v2 specification's License object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // info: { // ... // license: { // name: "BSD 3-Clause License"; // url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; // }; // ... // }; // ... // }; // message License { // The license name used for the API. string name = 1; // A URL to the license used for the API. MUST be in the format of a URL. string url = 2; } // `ExternalDocumentation` is a representation of OpenAPI v2 specification's // ExternalDocumentation object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject // // Example: // // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { // ... // external_docs: { // description: "More about gRPC-Gateway"; // url: "https://github.com/grpc-ecosystem/grpc-gateway"; // } // ... // }; // message ExternalDocumentation { // A short description of the target documentation. GFM syntax can be used for // rich text representation. string description = 1; // The URL for the target documentation. Value MUST be in the format // of a URL. string url = 2; } // `Schema` is a representation of OpenAPI v2 specification's Schema object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject // message Schema { JSONSchema json_schema = 1; // Adds support for polymorphism. The discriminator is the schema property // name that is used to differentiate between other schema that inherit this // schema. The property name used MUST be defined at this schema and it MUST // be in the required property list. When used, the value MUST be the name of // this schema or any schema that inherits it. string discriminator = 2; // Relevant only for Schema "properties" definitions. Declares the property as // "read only". This means that it MAY be sent as part of a response but MUST // NOT be sent as part of the request. Properties marked as readOnly being // true SHOULD NOT be in the required list of the defined schema. Default // value is false. bool read_only = 3; // field 4 is reserved for 'xml'. reserved 4; // Additional external documentation for this schema. ExternalDocumentation external_docs = 5; // A free-form property to include an example of an instance for this schema in JSON. // This is copied verbatim to the output. string example = 6; } // `JSONSchema` represents properties from JSON Schema taken, and as used, in // the OpenAPI v2 spec. // // This includes changes made by OpenAPI v2. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject // // See also: https://cswr.github.io/JsonSchema/spec/basic_types/, // https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json // // Example: // // message SimpleMessage { // option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { // json_schema: { // title: "SimpleMessage" // description: "A simple message." // required: ["id"] // } // }; // // // Id represents the message identifier. // string id = 1; [ // (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { // description: "The unique identifier of the simple message." // }]; // } // message JSONSchema { // field 1 is reserved for '$id', omitted from OpenAPI v2. reserved 1; // field 2 is reserved for '$schema', omitted from OpenAPI v2. reserved 2; // Ref is used to define an external reference to include in the message. // This could be a fully qualified proto message reference, and that type must // be imported into the protofile. If no message is identified, the Ref will // be used verbatim in the output. // For example: // `ref: ".google.protobuf.Timestamp"`. string ref = 3; // field 4 is reserved for '$comment', omitted from OpenAPI v2. reserved 4; // The title of the schema. string title = 5; // A short description of the schema. string description = 6; string default = 7; bool read_only = 8; // A free-form property to include a JSON example of this field. This is copied // verbatim to the output swagger.json. Quotes must be escaped. // This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject string example = 9; double multiple_of = 10; // Maximum represents an inclusive upper limit for a numeric instance. The // value of MUST be a number, double maximum = 11; bool exclusive_maximum = 12; // minimum represents an inclusive lower limit for a numeric instance. The // value of MUST be a number, double minimum = 13; bool exclusive_minimum = 14; uint64 max_length = 15; uint64 min_length = 16; string pattern = 17; // field 18 is reserved for 'additionalItems', omitted from OpenAPI v2. reserved 18; // field 19 is reserved for 'items', but in OpenAPI-specific way. // TODO(ivucica): add 'items'? reserved 19; uint64 max_items = 20; uint64 min_items = 21; bool unique_items = 22; // field 23 is reserved for 'contains', omitted from OpenAPI v2. reserved 23; uint64 max_properties = 24; uint64 min_properties = 25; repeated string required = 26; // field 27 is reserved for 'additionalProperties', but in OpenAPI-specific // way. TODO(ivucica): add 'additionalProperties'? reserved 27; // field 28 is reserved for 'definitions', omitted from OpenAPI v2. reserved 28; // field 29 is reserved for 'properties', but in OpenAPI-specific way. // TODO(ivucica): add 'additionalProperties'? reserved 29; // following fields are reserved, as the properties have been omitted from // OpenAPI v2: // patternProperties, dependencies, propertyNames, const reserved 30 to 33; // Items in 'array' must be unique. repeated string array = 34; enum JSONSchemaSimpleTypes { UNKNOWN = 0; ARRAY = 1; BOOLEAN = 2; INTEGER = 3; NULL = 4; NUMBER = 5; OBJECT = 6; STRING = 7; } repeated JSONSchemaSimpleTypes type = 35; // `Format` string format = 36; // following fields are reserved, as the properties have been omitted from // OpenAPI v2: contentMediaType, contentEncoding, if, then, else reserved 37 to 41; // field 42 is reserved for 'allOf', but in OpenAPI-specific way. // TODO(ivucica): add 'allOf'? reserved 42; // following fields are reserved, as the properties have been omitted from // OpenAPI v2: // anyOf, oneOf, not reserved 43 to 45; // Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 repeated string enum = 46; // Additional field level properties used when generating the OpenAPI v2 file. FieldConfiguration field_configuration = 1001; // 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file. // These properties are not defined by OpenAPIv2, but they are used to control the generation. message FieldConfiguration { // Alternative parameter name when used as path parameter. If set, this will // be used as the complete parameter name when this field is used as a path // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. string path_param_name = 47; } // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 48; } // `Tag` is a representation of OpenAPI v2 specification's Tag object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject // message Tag { // The name of the tag. Use it to allow override of the name of a // global Tag object, then use that name to reference the tag throughout the // OpenAPI file. string name = 1; // A short description for the tag. GFM syntax can be used for rich text // representation. string description = 2; // Additional external documentation for this tag. ExternalDocumentation external_docs = 3; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 4; } // `SecurityDefinitions` is a representation of OpenAPI v2 specification's // Security Definitions object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject // // A declaration of the security schemes available to be used in the // specification. This does not enforce the security schemes on the operations // and only serves to provide the relevant details for each scheme. message SecurityDefinitions { // A single security scheme definition, mapping a "name" to the scheme it // defines. map security = 1; } // `SecurityScheme` is a representation of OpenAPI v2 specification's // Security Scheme object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject // // Allows the definition of a security scheme that can be used by the // operations. Supported schemes are basic authentication, an API key (either as // a header or as a query parameter) and OAuth2's common flows (implicit, // password, application and access code). message SecurityScheme { // The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". enum Type { TYPE_INVALID = 0; TYPE_BASIC = 1; TYPE_API_KEY = 2; TYPE_OAUTH2 = 3; } // The location of the API key. Valid values are "query" or "header". enum In { IN_INVALID = 0; IN_QUERY = 1; IN_HEADER = 2; } // The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". enum Flow { FLOW_INVALID = 0; FLOW_IMPLICIT = 1; FLOW_PASSWORD = 2; FLOW_APPLICATION = 3; FLOW_ACCESS_CODE = 4; } // The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". Type type = 1; // A short description for security scheme. string description = 2; // The name of the header or query parameter to be used. // Valid for apiKey. string name = 3; // The location of the API key. Valid values are "query" or // "header". // Valid for apiKey. In in = 4; // The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". // Valid for oauth2. Flow flow = 5; // The authorization URL to be used for this flow. This SHOULD be in // the form of a URL. // Valid for oauth2/implicit and oauth2/accessCode. string authorization_url = 6; // The token URL to be used for this flow. This SHOULD be in the // form of a URL. // Valid for oauth2/password, oauth2/application and oauth2/accessCode. string token_url = 7; // The available scopes for the OAuth2 security scheme. // Valid for oauth2. Scopes scopes = 8; // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. // See: https://swagger.io/docs/specification/2-0/swagger-extensions/ map extensions = 9; } // `SecurityRequirement` is a representation of OpenAPI v2 specification's // Security Requirement object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject // // Lists the required security schemes to execute this operation. The object can // have multiple security schemes declared in it which are all required (that // is, there is a logical AND between the schemes). // // The name used for each property MUST correspond to a security scheme // declared in the Security Definitions. message SecurityRequirement { // If the security scheme is of type "oauth2", then the value is a list of // scope names required for the execution. For other security scheme types, // the array MUST be empty. message SecurityRequirementValue { repeated string scope = 1; } // Each name must correspond to a security scheme which is declared in // the Security Definitions. If the security scheme is of type "oauth2", // then the value is a list of scope names required for the execution. // For other security scheme types, the array MUST be empty. map security_requirement = 1; } // `Scopes` is a representation of OpenAPI v2 specification's Scopes object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject // // Lists the available scopes for an OAuth2 security scheme. message Scopes { // Maps between a name of a scope to a short description of it (as the value // of the property). map scope = 1; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/protoc-gen-openapiv2/options/openapiv2.swagger.json000066400000000000000000000014721465037340600335750ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "protoc-gen-openapiv2/options/openapiv2.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/renovate.json000066400000000000000000000020621465037340600244020ustar00rootroot00000000000000{ "extends": [ "config:base", "helpers:pinGitHubActionDigests" ], "baseBranches": [ "main" ], "postUpdateOptions": [ "gomodTidy" ], "packageRules": [ { "updateTypes": [ "minor", "patch", "pin", "digest" ], "automerge": true }, { "baseBranchList": [ "main" ], "packageNames": [ "github.com/golang/protobuf", "google.golang.org/protobuf" ], "groupName": "golang/protobuf" }, { "packagePatterns": [ "jekyll.*", "github-pages" ], "enabled": false }, { "matchManagers": [ "github-actions" ], "matchPackageNames": [ "slsa-framework/slsa-github-generator" ], "pinDigests": false } ] } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/repositories.bzl000066400000000000000000002120461465037340600251310ustar00rootroot00000000000000load("@bazel_gazelle//:deps.bzl", "go_repository") def go_repositories(): go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=", version = "v0.0.0-20190523083050-ea95bdfd59fc", ) go_repository( name = "com_github_alecthomas_template", importpath = "github.com/alecthomas/template", sum = "h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=", version = "v0.0.0-20160405071501-a0175ee3bccc", ) go_repository( name = "com_github_alecthomas_units", importpath = "github.com/alecthomas/units", sum = "h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=", version = "v0.0.0-20151022065526-2efee857e7cf", ) go_repository( name = "com_github_antihax_optional", importpath = "github.com/antihax/optional", sum = "h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=", version = "v1.0.0", ) go_repository( name = "com_github_armon_circbuf", importpath = "github.com/armon/circbuf", sum = "h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA=", version = "v0.0.0-20150827004946-bbbad097214e", ) go_repository( name = "com_github_armon_go_metrics", importpath = "github.com/armon/go-metrics", sum = "h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=", version = "v0.0.0-20180917152333-f0300d1749da", ) go_repository( name = "com_github_armon_go_radix", importpath = "github.com/armon/go-radix", sum = "h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to=", version = "v0.0.0-20180808171621-7fddfc383310", ) go_repository( name = "com_github_beorn7_perks", importpath = "github.com/beorn7/perks", sum = "h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=", version = "v1.0.0", ) go_repository( name = "com_github_bgentry_go_netrc", importpath = "github.com/bgentry/go-netrc", sum = "h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=", version = "v0.0.0-20140422174119-9fd32a8b3d3d", ) go_repository( name = "com_github_bgentry_speakeasy", importpath = "github.com/bgentry/speakeasy", sum = "h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=", version = "v0.1.0", ) go_repository( name = "com_github_bketelsen_crypt", importpath = "github.com/bketelsen/crypt", sum = "h1:+0HFd5KSZ/mm3JmhmrDukiId5iR6w4+BdFtfSy4yWIc=", version = "v0.0.3-0.20200106085610-5cbc8cc4026c", ) go_repository( name = "com_github_bufbuild_buf", importpath = "github.com/bufbuild/buf", sum = "h1:11zJVA0D4uJVGOC9h+oOVHrKKoBgMYIqJJ0d1Xt6oeQ=", version = "v0.37.0", ) go_repository( name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", version = "v0.3.1", ) go_repository( name = "com_github_burntsushi_xgb", importpath = "github.com/BurntSushi/xgb", sum = "h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=", version = "v0.0.0-20160522181843-27f122750802", ) go_repository( name = "com_github_census_instrumentation_opencensus_proto", importpath = "github.com/census-instrumentation/opencensus-proto", sum = "h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=", version = "v0.4.1", ) go_repository( name = "com_github_cespare_xxhash", importpath = "github.com/cespare/xxhash", sum = "h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=", version = "v1.1.0", ) go_repository( name = "com_github_cespare_xxhash_v2", importpath = "github.com/cespare/xxhash/v2", sum = "h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=", version = "v2.2.0", ) go_repository( name = "com_github_chzyer_logex", importpath = "github.com/chzyer/logex", sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", version = "v1.1.10", ) go_repository( name = "com_github_chzyer_readline", importpath = "github.com/chzyer/readline", sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", version = "v0.0.0-20180603132655-2972be24d48e", ) go_repository( name = "com_github_chzyer_test", importpath = "github.com/chzyer/test", sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", version = "v0.0.0-20180213035817-a1ea475d72b1", ) go_repository( name = "com_github_client9_misspell", importpath = "github.com/client9/misspell", sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) go_repository( name = "com_github_cncf_udpa_go", importpath = "github.com/cncf/udpa/go", sum = "h1:QQ3GSy+MqSHxm/d8nCtnAiZdYFd45cYZPs8vOOIYKfk=", version = "v0.0.0-20220112060539-c52dc94e7fbe", ) go_repository( name = "com_github_cncf_xds_go", importpath = "github.com/cncf/xds/go", sum = "h1:DBmgJDC9dTfkVyGgipamEh2BpGYxScCH1TOF1LL1cXc=", version = "v0.0.0-20240318125728-8a4994d93e50", ) go_repository( name = "com_github_coreos_bbolt", importpath = "github.com/coreos/bbolt", sum = "h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s=", version = "v1.3.2", ) go_repository( name = "com_github_coreos_etcd", importpath = "github.com/coreos/etcd", sum = "h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=", version = "v3.3.13+incompatible", ) go_repository( name = "com_github_coreos_go_semver", importpath = "github.com/coreos/go-semver", sum = "h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=", version = "v0.3.0", ) go_repository( name = "com_github_coreos_go_systemd", importpath = "github.com/coreos/go-systemd", sum = "h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=", version = "v0.0.0-20190321100706-95778dfbb74e", ) go_repository( name = "com_github_coreos_pkg", importpath = "github.com/coreos/pkg", sum = "h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=", version = "v0.0.0-20180928190104-399ea9e2e55f", ) go_repository( name = "com_github_cpuguy83_go_md2man_v2", importpath = "github.com/cpuguy83/go-md2man/v2", sum = "h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=", version = "v2.0.0", ) go_repository( name = "com_github_creack_pty", importpath = "github.com/creack/pty", sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=", version = "v1.1.9", ) go_repository( name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", sum = "h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=", version = "v1.1.0", ) go_repository( name = "com_github_dgrijalva_jwt_go", importpath = "github.com/dgrijalva/jwt-go", sum = "h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=", version = "v3.2.0+incompatible", ) go_repository( name = "com_github_dgryski_go_sip13", importpath = "github.com/dgryski/go-sip13", sum = "h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4=", version = "v0.0.0-20181026042036-e10d5fee7954", ) go_repository( name = "com_github_envoyproxy_go_control_plane", importpath = "github.com/envoyproxy/go-control-plane", sum = "h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI=", version = "v0.12.0", ) go_repository( name = "com_github_envoyproxy_protoc_gen_validate", importpath = "github.com/envoyproxy/protoc-gen-validate", sum = "h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=", version = "v1.0.4", ) go_repository( name = "com_github_fatih_color", importpath = "github.com/fatih/color", sum = "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=", version = "v1.7.0", ) go_repository( name = "com_github_fsnotify_fsnotify", importpath = "github.com/fsnotify/fsnotify", sum = "h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=", version = "v1.4.7", ) go_repository( name = "com_github_ghodss_yaml", importpath = "github.com/ghodss/yaml", sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", version = "v1.0.0", ) go_repository( name = "com_github_go_gl_glfw", importpath = "github.com/go-gl/glfw", sum = "h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=", version = "v0.0.0-20190409004039-e6da0acd62b1", ) go_repository( name = "com_github_go_gl_glfw_v3_3_glfw", importpath = "github.com/go-gl/glfw/v3.3/glfw", sum = "h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=", version = "v0.0.0-20200222043503-6f7a984d4dc4", ) go_repository( name = "com_github_go_kit_kit", importpath = "github.com/go-kit/kit", sum = "h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=", version = "v0.8.0", ) go_repository( name = "com_github_go_logfmt_logfmt", importpath = "github.com/go-logfmt/logfmt", sum = "h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=", version = "v0.4.0", ) go_repository( name = "com_github_go_stack_stack", importpath = "github.com/go-stack/stack", sum = "h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=", version = "v1.8.0", ) go_repository( name = "com_github_gofrs_flock", importpath = "github.com/gofrs/flock", sum = "h1:MSdYClljsF3PbENUUEx85nkWfJSGfzYI9yEBZOJz6CY=", version = "v0.8.0", ) go_repository( name = "com_github_gofrs_uuid", importpath = "github.com/gofrs/uuid", sum = "h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=", version = "v4.0.0+incompatible", ) go_repository( name = "com_github_gogo_protobuf", importpath = "github.com/gogo/protobuf", sum = "h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=", version = "v1.2.1", ) go_repository( name = "com_github_golang_glog", importpath = "github.com/golang/glog", sum = "h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=", version = "v1.2.0", ) go_repository( name = "com_github_golang_groupcache", importpath = "github.com/golang/groupcache", sum = "h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=", version = "v0.0.0-20200121045136-8c9f03a8e57e", ) go_repository( name = "com_github_golang_mock", importpath = "github.com/golang/mock", sum = "h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=", version = "v1.1.1", ) go_repository( name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", sum = "h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=", version = "v1.5.4", ) go_repository( name = "com_github_google_btree", importpath = "github.com/google/btree", sum = "h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=", version = "v1.0.0", ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", sum = "h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=", version = "v0.6.0", ) go_repository( name = "com_github_google_martian", importpath = "github.com/google/martian", sum = "h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=", version = "v2.1.0+incompatible", ) go_repository( name = "com_github_google_martian_v3", importpath = "github.com/google/martian/v3", sum = "h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs=", version = "v3.0.0", ) go_repository( name = "com_github_google_pprof", importpath = "github.com/google/pprof", sum = "h1:Ak8CrdlwwXwAZxzS66vgPt4U8yUZX7JwLvVR58FN5jM=", version = "v0.0.0-20200708004538-1a94d8640e99", ) go_repository( name = "com_github_google_renameio", importpath = "github.com/google/renameio", sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=", version = "v0.1.0", ) go_repository( name = "com_github_google_uuid", importpath = "github.com/google/uuid", sum = "h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=", version = "v1.6.0", ) go_repository( name = "com_github_googleapis_gax_go_v2", importpath = "github.com/googleapis/gax-go/v2", sum = "h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=", version = "v2.0.5", ) go_repository( name = "com_github_gopherjs_gopherjs", importpath = "github.com/gopherjs/gopherjs", sum = "h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=", version = "v0.0.0-20181017120253-0766667cb4d1", ) go_repository( name = "com_github_gordonklaus_ineffassign", importpath = "github.com/gordonklaus/ineffassign", sum = "h1:vc7Dmrk4JwS0ZPS6WZvWlwDflgDTA26jItmbSj83nug=", version = "v0.0.0-20200309095847-7953dde2c7bf", ) go_repository( name = "com_github_gorilla_websocket", importpath = "github.com/gorilla/websocket", sum = "h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=", version = "v1.4.2", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_middleware", importpath = "github.com/grpc-ecosystem/go-grpc-middleware", sum = "h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c=", version = "v1.0.0", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_prometheus", importpath = "github.com/grpc-ecosystem/go-grpc-prometheus", sum = "h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=", version = "v1.2.0", ) go_repository( name = "com_github_grpc_ecosystem_grpc_gateway", importpath = "github.com/grpc-ecosystem/grpc-gateway", sum = "h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=", version = "v1.16.0", ) go_repository( name = "com_github_hashicorp_consul_api", importpath = "github.com/hashicorp/consul/api", sum = "h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA=", version = "v1.1.0", ) go_repository( name = "com_github_hashicorp_consul_sdk", importpath = "github.com/hashicorp/consul/sdk", sum = "h1:LnuDWGNsoajlhGyHJvuWW6FVqRl8JOTPqS6CPTsYjhY=", version = "v0.1.1", ) go_repository( name = "com_github_hashicorp_errwrap", importpath = "github.com/hashicorp/errwrap", sum = "h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_cleanhttp", importpath = "github.com/hashicorp/go-cleanhttp", sum = "h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=", version = "v0.5.1", ) go_repository( name = "com_github_hashicorp_go_immutable_radix", importpath = "github.com/hashicorp/go-immutable-radix", sum = "h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_msgpack", importpath = "github.com/hashicorp/go-msgpack", sum = "h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4=", version = "v0.5.3", ) go_repository( name = "com_github_hashicorp_go_multierror", importpath = "github.com/hashicorp/go-multierror", sum = "h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_net", importpath = "github.com/hashicorp/go.net", sum = "h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw=", version = "v0.0.1", ) go_repository( name = "com_github_hashicorp_go_rootcerts", importpath = "github.com/hashicorp/go-rootcerts", sum = "h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_sockaddr", importpath = "github.com/hashicorp/go-sockaddr", sum = "h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_syslog", importpath = "github.com/hashicorp/go-syslog", sum = "h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_go_uuid", importpath = "github.com/hashicorp/go-uuid", sum = "h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=", version = "v1.0.1", ) go_repository( name = "com_github_hashicorp_golang_lru", importpath = "github.com/hashicorp/golang-lru", sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", version = "v0.5.1", ) go_repository( name = "com_github_hashicorp_hcl", importpath = "github.com/hashicorp/hcl", sum = "h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_logutils", importpath = "github.com/hashicorp/logutils", sum = "h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_mdns", importpath = "github.com/hashicorp/mdns", sum = "h1:WhIgCr5a7AaVH6jPUwjtRuuE7/RDufnUvzIr48smyxs=", version = "v1.0.0", ) go_repository( name = "com_github_hashicorp_memberlist", importpath = "github.com/hashicorp/memberlist", sum = "h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M=", version = "v0.1.3", ) go_repository( name = "com_github_hashicorp_serf", importpath = "github.com/hashicorp/serf", sum = "h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0=", version = "v0.8.2", ) go_repository( name = "com_github_ianlancetaylor_demangle", importpath = "github.com/ianlancetaylor/demangle", sum = "h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=", version = "v0.0.0-20181102032728-5e5cf60278f6", ) go_repository( name = "com_github_inconshreveable_mousetrap", importpath = "github.com/inconshreveable/mousetrap", sum = "h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=", version = "v1.0.0", ) go_repository( name = "com_github_jhump_protoreflect", importpath = "github.com/jhump/protoreflect", sum = "h1:z7Ciiz3Bz37zSd485fbiTW8ABafIasyOWZI0N9EUUdo=", version = "v1.8.1", ) go_repository( name = "com_github_jonboulle_clockwork", importpath = "github.com/jonboulle/clockwork", sum = "h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=", version = "v0.1.0", ) go_repository( name = "com_github_json_iterator_go", importpath = "github.com/json-iterator/go", sum = "h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=", version = "v1.1.6", ) go_repository( name = "com_github_jstemmer_go_junit_report", importpath = "github.com/jstemmer/go-junit-report", sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=", version = "v0.9.1", ) go_repository( name = "com_github_jtolds_gls", importpath = "github.com/jtolds/gls", sum = "h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=", version = "v4.20.0+incompatible", ) go_repository( name = "com_github_julienschmidt_httprouter", importpath = "github.com/julienschmidt/httprouter", sum = "h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g=", version = "v1.2.0", ) go_repository( name = "com_github_kisielk_errcheck", importpath = "github.com/kisielk/errcheck", sum = "h1:ZqfnKyx9KGpRcW04j5nnPDgRgoXUeLh2YFBeFzphcA0=", version = "v1.1.0", ) go_repository( name = "com_github_kisielk_gotool", importpath = "github.com/kisielk/gotool", sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", version = "v1.0.0", ) go_repository( name = "com_github_klauspost_compress", importpath = "github.com/klauspost/compress", sum = "h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg=", version = "v1.11.7", ) go_repository( name = "com_github_klauspost_pgzip", importpath = "github.com/klauspost/pgzip", sum = "h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=", version = "v1.2.5", ) go_repository( name = "com_github_konsorten_go_windows_terminal_sequences", importpath = "github.com/konsorten/go-windows-terminal-sequences", sum = "h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=", version = "v1.0.1", ) go_repository( name = "com_github_kr_logfmt", importpath = "github.com/kr/logfmt", sum = "h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=", version = "v0.0.0-20140226030751-b84e30acd515", ) go_repository( name = "com_github_kr_pretty", importpath = "github.com/kr/pretty", sum = "h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=", version = "v0.3.1", ) go_repository( name = "com_github_kr_pty", importpath = "github.com/kr/pty", sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", version = "v1.1.1", ) go_repository( name = "com_github_kr_text", importpath = "github.com/kr/text", sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=", version = "v0.2.0", ) go_repository( name = "com_github_magiconair_properties", importpath = "github.com/magiconair/properties", sum = "h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=", version = "v1.8.1", ) go_repository( name = "com_github_mattn_go_colorable", importpath = "github.com/mattn/go-colorable", sum = "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=", version = "v0.0.9", ) go_repository( name = "com_github_mattn_go_isatty", importpath = "github.com/mattn/go-isatty", sum = "h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=", version = "v0.0.3", ) go_repository( name = "com_github_matttproud_golang_protobuf_extensions", importpath = "github.com/matttproud/golang_protobuf_extensions", sum = "h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=", version = "v1.0.1", ) go_repository( name = "com_github_miekg_dns", importpath = "github.com/miekg/dns", sum = "h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA=", version = "v1.0.14", ) go_repository( name = "com_github_mitchellh_cli", importpath = "github.com/mitchellh/cli", sum = "h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y=", version = "v1.0.0", ) go_repository( name = "com_github_mitchellh_go_homedir", importpath = "github.com/mitchellh/go-homedir", sum = "h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=", version = "v1.1.0", ) go_repository( name = "com_github_mitchellh_go_testing_interface", importpath = "github.com/mitchellh/go-testing-interface", sum = "h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0=", version = "v1.0.0", ) go_repository( name = "com_github_mitchellh_gox", importpath = "github.com/mitchellh/gox", sum = "h1:lfGJxY7ToLJQjHHwi0EX6uYBdK78egf954SQl13PQJc=", version = "v0.4.0", ) go_repository( name = "com_github_mitchellh_iochan", importpath = "github.com/mitchellh/iochan", sum = "h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=", version = "v1.0.0", ) go_repository( name = "com_github_mitchellh_mapstructure", importpath = "github.com/mitchellh/mapstructure", sum = "h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=", version = "v1.1.2", ) go_repository( name = "com_github_modern_go_concurrent", importpath = "github.com/modern-go/concurrent", sum = "h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=", version = "v0.0.0-20180306012644-bacd9c7ef1dd", ) go_repository( name = "com_github_modern_go_reflect2", importpath = "github.com/modern-go/reflect2", sum = "h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=", version = "v1.0.1", ) go_repository( name = "com_github_mwitkow_go_conntrack", importpath = "github.com/mwitkow/go-conntrack", sum = "h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=", version = "v0.0.0-20161129095857-cc309e4a2223", ) go_repository( name = "com_github_nishanths_predeclared", importpath = "github.com/nishanths/predeclared", sum = "h1:3f0nxAmdj/VoCGN/ijdMy7bj6SBagaqYg1B0hu8clMA=", version = "v0.0.0-20200524104333-86fad755b4d3", ) go_repository( name = "com_github_oklog_ulid", importpath = "github.com/oklog/ulid", sum = "h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=", version = "v1.3.1", ) go_repository( name = "com_github_oneofone_xxhash", importpath = "github.com/OneOfOne/xxhash", sum = "h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=", version = "v1.2.2", ) go_repository( name = "com_github_pascaldekloe_goe", importpath = "github.com/pascaldekloe/goe", sum = "h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=", version = "v0.0.0-20180627143212-57f6aae5913c", ) go_repository( name = "com_github_pelletier_go_toml", importpath = "github.com/pelletier/go-toml", sum = "h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=", version = "v1.2.0", ) go_repository( name = "com_github_pkg_diff", importpath = "github.com/pkg/diff", sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=", version = "v0.0.0-20210226163009-20ebb0f2a09e", ) go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", version = "v0.9.1", ) go_repository( name = "com_github_pkg_profile", importpath = "github.com/pkg/profile", sum = "h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug=", version = "v1.5.0", ) go_repository( name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", version = "v1.0.0", ) go_repository( name = "com_github_posener_complete", importpath = "github.com/posener/complete", sum = "h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w=", version = "v1.1.1", ) go_repository( name = "com_github_prometheus_client_golang", importpath = "github.com/prometheus/client_golang", sum = "h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=", version = "v0.9.3", ) go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", version = "v0.0.0-20190812154241-14fe0d1b01d4", ) go_repository( name = "com_github_prometheus_common", importpath = "github.com/prometheus/common", sum = "h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=", version = "v0.4.0", ) go_repository( name = "com_github_prometheus_procfs", importpath = "github.com/prometheus/procfs", sum = "h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY=", version = "v0.0.0-20190507164030-5867b95ac084", ) go_repository( name = "com_github_prometheus_tsdb", importpath = "github.com/prometheus/tsdb", sum = "h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=", version = "v0.7.1", ) go_repository( name = "com_github_rogpeppe_fastuuid", importpath = "github.com/rogpeppe/fastuuid", sum = "h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=", version = "v1.2.0", ) go_repository( name = "com_github_rogpeppe_go_internal", importpath = "github.com/rogpeppe/go-internal", sum = "h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=", version = "v1.9.0", ) go_repository( name = "com_github_russross_blackfriday_v2", importpath = "github.com/russross/blackfriday/v2", sum = "h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=", version = "v2.0.1", ) go_repository( name = "com_github_ryanuber_columnize", importpath = "github.com/ryanuber/columnize", sum = "h1:UFr9zpz4xgTnIE5yIMtWAMngCdZ9p/+q6lTbgelo80M=", version = "v0.0.0-20160712163229-9b3edd62028f", ) go_repository( name = "com_github_sean_seed", importpath = "github.com/sean-/seed", sum = "h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=", version = "v0.0.0-20170313163322-e2103e2c3529", ) go_repository( name = "com_github_shurcool_sanitized_anchor_name", importpath = "github.com/shurcooL/sanitized_anchor_name", sum = "h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=", version = "v1.0.0", ) go_repository( name = "com_github_sirupsen_logrus", importpath = "github.com/sirupsen/logrus", sum = "h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=", version = "v1.2.0", ) go_repository( name = "com_github_smartystreets_assertions", importpath = "github.com/smartystreets/assertions", sum = "h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=", version = "v0.0.0-20180927180507-b2de0cb4f26d", ) go_repository( name = "com_github_smartystreets_goconvey", importpath = "github.com/smartystreets/goconvey", sum = "h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=", version = "v1.6.4", ) go_repository( name = "com_github_soheilhy_cmux", importpath = "github.com/soheilhy/cmux", sum = "h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=", version = "v0.1.4", ) go_repository( name = "com_github_spaolacci_murmur3", importpath = "github.com/spaolacci/murmur3", sum = "h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=", version = "v0.0.0-20180118202830-f09979ecbc72", ) go_repository( name = "com_github_spf13_afero", importpath = "github.com/spf13/afero", sum = "h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=", version = "v1.1.2", ) go_repository( name = "com_github_spf13_cast", importpath = "github.com/spf13/cast", sum = "h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=", version = "v1.3.0", ) go_repository( name = "com_github_spf13_cobra", importpath = "github.com/spf13/cobra", sum = "h1:O63eWlXlvyw4YdsuatjRIU6emvJ2fqz+PTdMEoxIT2s=", version = "v1.0.1-0.20201006035406-b97b5ead31f7", ) go_repository( name = "com_github_spf13_jwalterweatherman", importpath = "github.com/spf13/jwalterweatherman", sum = "h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=", version = "v1.0.0", ) go_repository( name = "com_github_spf13_pflag", importpath = "github.com/spf13/pflag", sum = "h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=", version = "v1.0.5", ) go_repository( name = "com_github_spf13_viper", importpath = "github.com/spf13/viper", sum = "h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=", version = "v1.7.0", ) go_repository( name = "com_github_stretchr_objx", importpath = "github.com/stretchr/objx", sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=", version = "v0.1.0", ) go_repository( name = "com_github_stretchr_testify", importpath = "github.com/stretchr/testify", sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=", version = "v1.7.0", ) go_repository( name = "com_github_subosito_gotenv", importpath = "github.com/subosito/gotenv", sum = "h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=", version = "v1.2.0", ) go_repository( name = "com_github_tmc_grpc_websocket_proxy", importpath = "github.com/tmc/grpc-websocket-proxy", sum = "h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=", version = "v0.0.0-20190109142713-0ad062ec5ee5", ) go_repository( name = "com_github_twitchtv_twirp", importpath = "github.com/twitchtv/twirp", sum = "h1:3fNSDoSPyq+fTrifIvGue9XM/tptzuhiGY83rxPVNUg=", version = "v7.1.0+incompatible", ) go_repository( name = "com_github_xiang90_probing", importpath = "github.com/xiang90/probing", sum = "h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=", version = "v0.0.0-20190116061207-43a291ad63a2", ) go_repository( name = "com_github_yuin_goldmark", importpath = "github.com/yuin/goldmark", sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", version = "v1.4.13", ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", sum = "h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM=", version = "v0.112.0", ) go_repository( name = "com_google_cloud_go_accessapproval", importpath = "cloud.google.com/go/accessapproval", sum = "h1:uzmAMSgYcnlHa9X9YSQZ4Q1wlfl4NNkZyQgho1Z6p04=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_accesscontextmanager", importpath = "cloud.google.com/go/accesscontextmanager", sum = "h1:2GLNaNu9KRJhJBFTIVRoPwk6xE5mUDgD47abBq4Zp/I=", version = "v1.8.5", ) go_repository( name = "com_google_cloud_go_aiplatform", importpath = "cloud.google.com/go/aiplatform", sum = "h1:0cSrii1ZeLr16MbBoocyy5KVnrSdiQ3KN/vtrTe7RqE=", version = "v1.60.0", ) go_repository( name = "com_google_cloud_go_analytics", importpath = "cloud.google.com/go/analytics", sum = "h1:Q+y94XH84jM8SK8O7qiY/PJRexb6n7dRbQ6PiUa4YGM=", version = "v0.23.0", ) go_repository( name = "com_google_cloud_go_apigateway", importpath = "cloud.google.com/go/apigateway", sum = "h1:sPXnpk+6TneKIrjCjcpX5YGsAKy3PTdpIchoj8/74OE=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_apigeeconnect", importpath = "cloud.google.com/go/apigeeconnect", sum = "h1:CrfIKv9Go3fh/QfQgisU3MeP90Ww7l/sVGmr3TpECo8=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_apigeeregistry", importpath = "cloud.google.com/go/apigeeregistry", sum = "h1:C+QU2K+DzDjk4g074ouwHQGkoff1h5OMQp6sblCVreQ=", version = "v0.8.3", ) go_repository( name = "com_google_cloud_go_apikeys", importpath = "cloud.google.com/go/apikeys", sum = "h1:B9CdHFZTFjVti89tmyXXrO+7vSNo2jvZuHG8zD5trdQ=", version = "v0.6.0", ) go_repository( name = "com_google_cloud_go_appengine", importpath = "cloud.google.com/go/appengine", sum = "h1:l2SviT44zWQiOv8bPoMBzW0vOcMO22iO0s+nVtVhdts=", version = "v1.8.5", ) go_repository( name = "com_google_cloud_go_area120", importpath = "cloud.google.com/go/area120", sum = "h1:vTs08KPLN/iMzTbxpu5ciL06KcsrVPMjz4IwcQyZ4uY=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_artifactregistry", importpath = "cloud.google.com/go/artifactregistry", sum = "h1:W9sVlyb1VRcUf83w7aM3yMsnp4HS4PoyGqYQNG0O5lI=", version = "v1.14.7", ) go_repository( name = "com_google_cloud_go_asset", importpath = "cloud.google.com/go/asset", sum = "h1:xgFnBP3luSbUcC9RWJvb3Zkt+y/wW6PKwPHr3ssnIP8=", version = "v1.17.2", ) go_repository( name = "com_google_cloud_go_assuredworkloads", importpath = "cloud.google.com/go/assuredworkloads", sum = "h1:gCrN3IyvqY3cP0wh2h43d99CgH3G+WYs9CeuFVKChR8=", version = "v1.11.5", ) go_repository( name = "com_google_cloud_go_automl", importpath = "cloud.google.com/go/automl", sum = "h1:ijiJy9sYWh75WrqImXsfWc1e3HR3iO+ef9fvW03Ig/4=", version = "v1.13.5", ) go_repository( name = "com_google_cloud_go_baremetalsolution", importpath = "cloud.google.com/go/baremetalsolution", sum = "h1:LFydisRmS7hQk9P/YhekwuZGqb45TW4QavcrMToWo5A=", version = "v1.2.4", ) go_repository( name = "com_google_cloud_go_batch", importpath = "cloud.google.com/go/batch", sum = "h1:2HK4JerwVaIcCh/lJiHwh6+uswPthiMMWhiSWLELayk=", version = "v1.8.0", ) go_repository( name = "com_google_cloud_go_beyondcorp", importpath = "cloud.google.com/go/beyondcorp", sum = "h1:qs0J0O9Ol2h1yA0AU+r7l3hOCPzs2MjE1d6d/kaHIKo=", version = "v1.0.4", ) go_repository( name = "com_google_cloud_go_bigquery", importpath = "cloud.google.com/go/bigquery", sum = "h1:CpT+/njKuKT3CEmswm6IbhNu9u35zt5dO4yPDLW+nG4=", version = "v1.59.1", ) go_repository( name = "com_google_cloud_go_billing", importpath = "cloud.google.com/go/billing", sum = "h1:oWUEQvuC4JvtnqLZ35zgzdbuHt4Itbftvzbe6aEyFdE=", version = "v1.18.2", ) go_repository( name = "com_google_cloud_go_binaryauthorization", importpath = "cloud.google.com/go/binaryauthorization", sum = "h1:1jcyh2uIUwSZkJ/JmL8kd5SUkL/Krbv8zmYLEbAz6kY=", version = "v1.8.1", ) go_repository( name = "com_google_cloud_go_certificatemanager", importpath = "cloud.google.com/go/certificatemanager", sum = "h1:UMBr/twXvH3jcT5J5/YjRxf2tvwTYIfrpemTebe0txc=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_channel", importpath = "cloud.google.com/go/channel", sum = "h1:/omiBnyFjm4S1ETHoOmJbL7LH7Ljcei4rYG6Sj3hc80=", version = "v1.17.5", ) go_repository( name = "com_google_cloud_go_cloudbuild", importpath = "cloud.google.com/go/cloudbuild", sum = "h1:ZB6oOmJo+MTov9n629fiCrO9YZPOg25FZvQ7gIHu5ng=", version = "v1.15.1", ) go_repository( name = "com_google_cloud_go_clouddms", importpath = "cloud.google.com/go/clouddms", sum = "h1:Sr0Zo5EAcPQiCBgHWICg3VGkcdS/LLP1d9SR7qQBM/s=", version = "v1.7.4", ) go_repository( name = "com_google_cloud_go_cloudtasks", importpath = "cloud.google.com/go/cloudtasks", sum = "h1:EUt1hIZ9bLv8Iz9yWaCrqgMnIU+Tdh0yXM1MMVGhjfE=", version = "v1.12.6", ) go_repository( name = "com_google_cloud_go_compute", importpath = "cloud.google.com/go/compute", sum = "h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU=", version = "v1.25.1", ) go_repository( name = "com_google_cloud_go_compute_metadata", importpath = "cloud.google.com/go/compute/metadata", sum = "h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=", version = "v0.3.0", ) go_repository( name = "com_google_cloud_go_contactcenterinsights", importpath = "cloud.google.com/go/contactcenterinsights", sum = "h1:6Vs/YnDG5STGjlWMEjN/xtmft7MrOTOnOZYUZtGTx0w=", version = "v1.13.0", ) go_repository( name = "com_google_cloud_go_container", importpath = "cloud.google.com/go/container", sum = "h1:MAaNH7VRNPWEhvqOypq2j+7ONJKrKzon4v9nS3nLZe0=", version = "v1.31.0", ) go_repository( name = "com_google_cloud_go_containeranalysis", importpath = "cloud.google.com/go/containeranalysis", sum = "h1:doJ0M1ljS4hS0D2UbHywlHGwB7sQLNrt9vFk9Zyi7vY=", version = "v0.11.4", ) go_repository( name = "com_google_cloud_go_datacatalog", importpath = "cloud.google.com/go/datacatalog", sum = "h1:A0vKYCQdxQuV4Pi0LL9p39Vwvg4jH5yYveMv50gU5Tw=", version = "v1.19.3", ) go_repository( name = "com_google_cloud_go_dataflow", importpath = "cloud.google.com/go/dataflow", sum = "h1:RYHtcPhmE664+F0Je46p+NvFbG8z//KCXp+uEqB4jZU=", version = "v0.9.5", ) go_repository( name = "com_google_cloud_go_dataform", importpath = "cloud.google.com/go/dataform", sum = "h1:5e4eqGrd0iDTCg4Q+VlAao5j2naKAA7xRurNtwmUknU=", version = "v0.9.2", ) go_repository( name = "com_google_cloud_go_datafusion", importpath = "cloud.google.com/go/datafusion", sum = "h1:HQ/BUOP8OIGJxuztpYvNvlb+/U+/Bfs9SO8tQbh61fk=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_datalabeling", importpath = "cloud.google.com/go/datalabeling", sum = "h1:GpIFRdm0qIZNsxqURFJwHt0ZBJZ0nF/mUVEigR7PH/8=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_dataplex", importpath = "cloud.google.com/go/dataplex", sum = "h1:fxIfdU8fxzR3clhOoNI7XFppvAmndxDu1AMH+qX9WKQ=", version = "v1.14.2", ) go_repository( name = "com_google_cloud_go_dataproc", importpath = "cloud.google.com/go/dataproc", sum = "h1:W47qHL3W4BPkAIbk4SWmIERwsWBaNnWm0P2sdx3YgGU=", version = "v1.12.0", ) go_repository( name = "com_google_cloud_go_dataproc_v2", importpath = "cloud.google.com/go/dataproc/v2", sum = "h1:/u81Fd+BvCLp+xjctI1DiWVJn6cn9/s3Akc8xPH02yk=", version = "v2.4.0", ) go_repository( name = "com_google_cloud_go_dataqna", importpath = "cloud.google.com/go/dataqna", sum = "h1:9ybXs3nr9BzxSGC04SsvtuXaHY0qmJSLIpIAbZo9GqQ=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_datastore", importpath = "cloud.google.com/go/datastore", sum = "h1:0P9WcsQeTWjuD1H14JIY7XQscIPQ4Laje8ti96IC5vg=", version = "v1.15.0", ) go_repository( name = "com_google_cloud_go_datastream", importpath = "cloud.google.com/go/datastream", sum = "h1:o1QDKMo/hk0FN7vhoUQURREuA0rgKmnYapB+1M+7Qz4=", version = "v1.10.4", ) go_repository( name = "com_google_cloud_go_deploy", importpath = "cloud.google.com/go/deploy", sum = "h1:m27Ojwj03gvpJqCbodLYiVmE9x4/LrHGGMjzc0LBfM4=", version = "v1.17.1", ) go_repository( name = "com_google_cloud_go_dialogflow", importpath = "cloud.google.com/go/dialogflow", sum = "h1:KqG0oxGE71qo0lRVyAoeBozefCvsMfcDzDjoLYSY0F4=", version = "v1.49.0", ) go_repository( name = "com_google_cloud_go_dlp", importpath = "cloud.google.com/go/dlp", sum = "h1:lTipOuJaSjlYnnotPMbEhKURLC6GzCMDDzVbJAEbmYM=", version = "v1.11.2", ) go_repository( name = "com_google_cloud_go_documentai", importpath = "cloud.google.com/go/documentai", sum = "h1:lI62GMEEPO6vXJI9hj+G9WjOvnR0hEjvjokrnex4cxA=", version = "v1.25.0", ) go_repository( name = "com_google_cloud_go_domains", importpath = "cloud.google.com/go/domains", sum = "h1:Mml/R6s3vQQvFPpi/9oX3O5dRirgjyJ8cksK8N19Y7g=", version = "v0.9.5", ) go_repository( name = "com_google_cloud_go_edgecontainer", importpath = "cloud.google.com/go/edgecontainer", sum = "h1:tBY32km78ScpK2aOP84JoW/+wtpx5WluyPUSEE3270U=", version = "v1.1.5", ) go_repository( name = "com_google_cloud_go_errorreporting", importpath = "cloud.google.com/go/errorreporting", sum = "h1:kj1XEWMu8P0qlLhm3FwcaFsUvXChV/OraZwA70trRR0=", version = "v0.3.0", ) go_repository( name = "com_google_cloud_go_essentialcontacts", importpath = "cloud.google.com/go/essentialcontacts", sum = "h1:13eHn5qBnsawxI7mIrv4jRIEmQ1xg0Ztqw5ZGqtUNfA=", version = "v1.6.6", ) go_repository( name = "com_google_cloud_go_eventarc", importpath = "cloud.google.com/go/eventarc", sum = "h1:ORkd6/UV5FIdA8KZQDLNZYKS7BBOrj0p01DXPmT4tE4=", version = "v1.13.4", ) go_repository( name = "com_google_cloud_go_filestore", importpath = "cloud.google.com/go/filestore", sum = "h1:X5G4y/vrUo1B8Nsz93qSWTMAcM8LXbGUldq33OdcdCw=", version = "v1.8.1", ) go_repository( name = "com_google_cloud_go_firestore", importpath = "cloud.google.com/go/firestore", sum = "h1:8aLcKnMPoldYU3YHgu4t2exrKhLQkqaXAGqT0ljrFVw=", version = "v1.14.0", ) go_repository( name = "com_google_cloud_go_functions", importpath = "cloud.google.com/go/functions", sum = "h1:IWVylmK5F6hJ3R5zaRW7jI5PrWhCvtBVU4axQLmXSo4=", version = "v1.16.0", ) go_repository( name = "com_google_cloud_go_gaming", importpath = "cloud.google.com/go/gaming", sum = "h1:5qZmZEWzMf8GEFgm9NeC3bjFRpt7x4S6U7oLbxaf7N8=", version = "v1.10.1", ) go_repository( name = "com_google_cloud_go_gkebackup", importpath = "cloud.google.com/go/gkebackup", sum = "h1:iuE8KNtTsPOc79qeWoNS8zOWoXPD9SAdOmwgxtlCmh8=", version = "v1.3.5", ) go_repository( name = "com_google_cloud_go_gkeconnect", importpath = "cloud.google.com/go/gkeconnect", sum = "h1:17d+ZSSXKqG/RwZCq3oFMIWLPI8Zw3b8+a9/BEVlwH0=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_gkehub", importpath = "cloud.google.com/go/gkehub", sum = "h1:RboLNFzf9wEMSo7DrKVBlf+YhK/A/jrLN454L5Tz99Q=", version = "v0.14.5", ) go_repository( name = "com_google_cloud_go_gkemulticloud", importpath = "cloud.google.com/go/gkemulticloud", sum = "h1:rsSZAGLhyjyE/bE2ToT5fqo1qSW7S+Ubsc9jFOcbhSI=", version = "v1.1.1", ) go_repository( name = "com_google_cloud_go_gsuiteaddons", importpath = "cloud.google.com/go/gsuiteaddons", sum = "h1:CZEbaBwmbYdhFw21Fwbo+C35HMe36fTE0FBSR4KSfWg=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_iam", importpath = "cloud.google.com/go/iam", sum = "h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc=", version = "v1.1.6", ) go_repository( name = "com_google_cloud_go_iap", importpath = "cloud.google.com/go/iap", sum = "h1:94zirc2r4t6KzhAMW0R6Dme005eTP6yf7g6vN4IhRrA=", version = "v1.9.4", ) go_repository( name = "com_google_cloud_go_ids", importpath = "cloud.google.com/go/ids", sum = "h1:xd4U7pgl3GHV+MABnv1BF4/Vy/zBF7CYC8XngkOLzag=", version = "v1.4.5", ) go_repository( name = "com_google_cloud_go_iot", importpath = "cloud.google.com/go/iot", sum = "h1:munTeBlbqI33iuTYgXy7S8lW2TCgi5l1hA4roSIY+EE=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_kms", importpath = "cloud.google.com/go/kms", sum = "h1:7caV9K3yIxvlQPAcaFffhlT7d1qpxjB1wHBtjWa13SM=", version = "v1.15.7", ) go_repository( name = "com_google_cloud_go_language", importpath = "cloud.google.com/go/language", sum = "h1:iaJZg6K4j/2PvZZVcjeO/btcWWIllVRBhuTFjGO4LXs=", version = "v1.12.3", ) go_repository( name = "com_google_cloud_go_lifesciences", importpath = "cloud.google.com/go/lifesciences", sum = "h1:gXvN70m2p+4zgJFzaz6gMKaxTuF9WJ0USYoMLWAOm8g=", version = "v0.9.5", ) go_repository( name = "com_google_cloud_go_logging", importpath = "cloud.google.com/go/logging", sum = "h1:iEIOXFO9EmSiTjDmfpbRjOxECO7R8C7b8IXUGOj7xZw=", version = "v1.9.0", ) go_repository( name = "com_google_cloud_go_longrunning", importpath = "cloud.google.com/go/longrunning", sum = "h1:GOE6pZFdSrTb4KAiKnXsJBtlE6mEyaW44oKyMILWnOg=", version = "v0.5.5", ) go_repository( name = "com_google_cloud_go_managedidentities", importpath = "cloud.google.com/go/managedidentities", sum = "h1:+bpih1piZVLxla/XBqeSUzJBp8gv9plGHIMAI7DLpDM=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_maps", importpath = "cloud.google.com/go/maps", sum = "h1:EVCZAiDvog9So46460BGbCasPhi613exoaQbpilMVlk=", version = "v1.6.4", ) go_repository( name = "com_google_cloud_go_mediatranslation", importpath = "cloud.google.com/go/mediatranslation", sum = "h1:c76KdIXljQHSCb/Cy47S8H4s05A4zbK3pAFGzwcczZo=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_memcache", importpath = "cloud.google.com/go/memcache", sum = "h1:yeDv5qxRedFosvpMSEswrqUsJM5OdWvssPHFliNFTc4=", version = "v1.10.5", ) go_repository( name = "com_google_cloud_go_metastore", importpath = "cloud.google.com/go/metastore", sum = "h1:dR7vqWXlK6IYR8Wbu9mdFfwlVjodIBhd1JRrpZftTEg=", version = "v1.13.4", ) go_repository( name = "com_google_cloud_go_monitoring", importpath = "cloud.google.com/go/monitoring", sum = "h1:NfkDLQDG2UR3WYZVQE8kwSbUIEyIqJUPl+aOQdFH1T4=", version = "v1.18.0", ) go_repository( name = "com_google_cloud_go_networkconnectivity", importpath = "cloud.google.com/go/networkconnectivity", sum = "h1:GBfXFhLyPspnaBE3nI/BRjdhW8vcbpT9QjE/4kDCDdc=", version = "v1.14.4", ) go_repository( name = "com_google_cloud_go_networkmanagement", importpath = "cloud.google.com/go/networkmanagement", sum = "h1:aLV5GcosBNmd6M8+a0ekB0XlLRexv4fvnJJrYnqeBcg=", version = "v1.9.4", ) go_repository( name = "com_google_cloud_go_networksecurity", importpath = "cloud.google.com/go/networksecurity", sum = "h1:+caSxBTj0E8OYVh/5wElFdjEMO1S/rZtE1152Cepchc=", version = "v0.9.5", ) go_repository( name = "com_google_cloud_go_notebooks", importpath = "cloud.google.com/go/notebooks", sum = "h1:FH48boYmrWVQ6k0Mx/WrnNafXncT5iSYxA8CNyWTgy0=", version = "v1.11.3", ) go_repository( name = "com_google_cloud_go_optimization", importpath = "cloud.google.com/go/optimization", sum = "h1:63NZaWyN+5rZEKHPX4ACpw3BjgyeuY8+rCehiCMaGPY=", version = "v1.6.3", ) go_repository( name = "com_google_cloud_go_orchestration", importpath = "cloud.google.com/go/orchestration", sum = "h1:YHgWMlrPttIVGItgGfuvO2KM7x+y9ivN/Yk92pMm1a4=", version = "v1.8.5", ) go_repository( name = "com_google_cloud_go_orgpolicy", importpath = "cloud.google.com/go/orgpolicy", sum = "h1:2JbXigqBJVp8Dx5dONUttFqewu4fP0p3pgOdIZAhpYU=", version = "v1.12.1", ) go_repository( name = "com_google_cloud_go_osconfig", importpath = "cloud.google.com/go/osconfig", sum = "h1:Mo5jGAxOMKH/PmDY7fgY19yFcVbvwREb5D5zMPQjFfo=", version = "v1.12.5", ) go_repository( name = "com_google_cloud_go_oslogin", importpath = "cloud.google.com/go/oslogin", sum = "h1:1K4nOT5VEZNt7XkhaTXupBYos5HjzvJMfhvyD2wWdFs=", version = "v1.13.1", ) go_repository( name = "com_google_cloud_go_phishingprotection", importpath = "cloud.google.com/go/phishingprotection", sum = "h1:DH3WFLzEoJdW/6xgsmoDqOwT1xddFi7gKu0QGZQhpGU=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_policytroubleshooter", importpath = "cloud.google.com/go/policytroubleshooter", sum = "h1:c0WOzC6hz964QWNBkyKfna8A2jOIx1zzZa43Gx/P09o=", version = "v1.10.3", ) go_repository( name = "com_google_cloud_go_privatecatalog", importpath = "cloud.google.com/go/privatecatalog", sum = "h1:UZ0assTnATXSggoxUIh61RjTQ4P9zCMk/kEMbn0nMYA=", version = "v0.9.5", ) go_repository( name = "com_google_cloud_go_pubsub", importpath = "cloud.google.com/go/pubsub", sum = "h1:dfEPuGCHGbWUhaMCTHUFjfroILEkx55iUmKBZTP5f+Y=", version = "v1.36.1", ) go_repository( name = "com_google_cloud_go_pubsublite", importpath = "cloud.google.com/go/pubsublite", sum = "h1:pX+idpWMIH30/K7c0epN6V703xpIcMXWRjKJsz0tYGY=", version = "v1.8.1", ) go_repository( name = "com_google_cloud_go_recaptchaenterprise_v2", importpath = "cloud.google.com/go/recaptchaenterprise/v2", sum = "h1:U3Wfq12X9cVMuTpsWDSURnXF0Z9hSPTHj+xsnXDRLsw=", version = "v2.9.2", ) go_repository( name = "com_google_cloud_go_recommendationengine", importpath = "cloud.google.com/go/recommendationengine", sum = "h1:ineqLswaCSBY0csYv5/wuXJMBlxATK6Xc5jJkpiTEdM=", version = "v0.8.5", ) go_repository( name = "com_google_cloud_go_recommender", importpath = "cloud.google.com/go/recommender", sum = "h1:LVLYS3r3u0MSCxQSDUtLSkporEGi9OAE6hGvayrZNPs=", version = "v1.12.1", ) go_repository( name = "com_google_cloud_go_redis", importpath = "cloud.google.com/go/redis", sum = "h1:QF0maEdVv0Fj/2roU8sX3NpiDBzP9ICYTO+5F32gQNo=", version = "v1.14.2", ) go_repository( name = "com_google_cloud_go_resourcemanager", importpath = "cloud.google.com/go/resourcemanager", sum = "h1:AZWr1vWVDKGwfLsVhcN+vcwOz3xqqYxtmMa0aABCMms=", version = "v1.9.5", ) go_repository( name = "com_google_cloud_go_resourcesettings", importpath = "cloud.google.com/go/resourcesettings", sum = "h1:BTr5MVykJwClASci/7Og4Qfx70aQ4n3epsNLj94ZYgw=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_retail", importpath = "cloud.google.com/go/retail", sum = "h1:Fn1GuAua1c6crCGqfJ1qMxG1Xh10Tg/x5EUODEHMqkw=", version = "v1.16.0", ) go_repository( name = "com_google_cloud_go_run", importpath = "cloud.google.com/go/run", sum = "h1:m9WDA7DzTpczhZggwYlZcBWgCRb+kgSIisWn1sbw2rQ=", version = "v1.3.4", ) go_repository( name = "com_google_cloud_go_scheduler", importpath = "cloud.google.com/go/scheduler", sum = "h1:5U8iXLoQ03qOB+ZXlAecU7fiE33+u3QiM9nh4cd0eTE=", version = "v1.10.6", ) go_repository( name = "com_google_cloud_go_secretmanager", importpath = "cloud.google.com/go/secretmanager", sum = "h1:82fpF5vBBvu9XW4qj0FU2C6qVMtj1RM/XHwKXUEAfYY=", version = "v1.11.5", ) go_repository( name = "com_google_cloud_go_security", importpath = "cloud.google.com/go/security", sum = "h1:wTKJQ10j8EYgvE8Y+KhovxDRVDk2iv/OsxZ6GrLP3kE=", version = "v1.15.5", ) go_repository( name = "com_google_cloud_go_securitycenter", importpath = "cloud.google.com/go/securitycenter", sum = "h1:/5jjkZ+uGe8hZ7pvd7pO30VW/a+pT2MrrdgOqjyucKQ=", version = "v1.24.4", ) go_repository( name = "com_google_cloud_go_servicecontrol", importpath = "cloud.google.com/go/servicecontrol", sum = "h1:d0uV7Qegtfaa7Z2ClDzr9HJmnbJW7jn0WhZ7wOX6hLE=", version = "v1.11.1", ) go_repository( name = "com_google_cloud_go_servicedirectory", importpath = "cloud.google.com/go/servicedirectory", sum = "h1:da7HFI1229kyzIyuVEzHXip0cw0d+E0s8mjQby0WN+k=", version = "v1.11.4", ) go_repository( name = "com_google_cloud_go_servicemanagement", importpath = "cloud.google.com/go/servicemanagement", sum = "h1:fopAQI/IAzlxnVeiKn/8WiV6zKndjFkvi+gzu+NjywY=", version = "v1.8.0", ) go_repository( name = "com_google_cloud_go_serviceusage", importpath = "cloud.google.com/go/serviceusage", sum = "h1:rXyq+0+RSIm3HFypctp7WoXxIA563rn206CfMWdqXX4=", version = "v1.6.0", ) go_repository( name = "com_google_cloud_go_shell", importpath = "cloud.google.com/go/shell", sum = "h1:3Fq2hzO0ZSyaqBboJrFkwwf/qMufDtqwwA6ep8EZxEI=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_spanner", importpath = "cloud.google.com/go/spanner", sum = "h1:o/Cv7/zZ1WgRXVCd5g3Nc23ZI39p/1pWFqFwvg6Wcu8=", version = "v1.56.0", ) go_repository( name = "com_google_cloud_go_speech", importpath = "cloud.google.com/go/speech", sum = "h1:nuFc+Kj5B8de75nN4FdPyUbI2SiBoHZG6BLurXL56Q0=", version = "v1.21.1", ) go_repository( name = "com_google_cloud_go_storage", importpath = "cloud.google.com/go/storage", sum = "h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA=", version = "v1.10.0", ) go_repository( name = "com_google_cloud_go_storagetransfer", importpath = "cloud.google.com/go/storagetransfer", sum = "h1:dy4fL3wO0VABvzM05ycMUPFHxTPbJz9Em8ikAJVqSbI=", version = "v1.10.4", ) go_repository( name = "com_google_cloud_go_talent", importpath = "cloud.google.com/go/talent", sum = "h1:JssV0CE3FNujuSWn7SkosOzg7qrMxVnt6txOfGcMSa4=", version = "v1.6.6", ) go_repository( name = "com_google_cloud_go_texttospeech", importpath = "cloud.google.com/go/texttospeech", sum = "h1:dxY2Q5mHCbrGa3oPR2O3PCicdnvKa1JmwGQK36EFLOw=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_tpu", importpath = "cloud.google.com/go/tpu", sum = "h1:C8YyYda8WtNdBoCgFwwBzZd+S6+EScHOxM/z1h0NNp8=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_trace", importpath = "cloud.google.com/go/trace", sum = "h1:0pr4lIKJ5XZFYD9GtxXEWr0KkVeigc3wlGpZco0X1oA=", version = "v1.10.5", ) go_repository( name = "com_google_cloud_go_translate", importpath = "cloud.google.com/go/translate", sum = "h1:upovZ0wRMdzZvXnu+RPam41B0mRJ+coRXFP2cYFJ7ew=", version = "v1.10.1", ) go_repository( name = "com_google_cloud_go_video", importpath = "cloud.google.com/go/video", sum = "h1:TXwotxkShP1OqgKsbd+b8N5hrIHavSyLGvYnLGCZ7xc=", version = "v1.20.4", ) go_repository( name = "com_google_cloud_go_videointelligence", importpath = "cloud.google.com/go/videointelligence", sum = "h1:mYaWH8uhUCXLJCN3gdXswKzRa2+lK0zN6/KsIubm6pE=", version = "v1.11.5", ) go_repository( name = "com_google_cloud_go_vision_v2", importpath = "cloud.google.com/go/vision/v2", sum = "h1:W52z1b6LdGI66MVhE70g/NFty9zCYYcjdKuycqmlhtg=", version = "v2.8.0", ) go_repository( name = "com_google_cloud_go_vmmigration", importpath = "cloud.google.com/go/vmmigration", sum = "h1:5v9RT2vWyuw3pK2ox0HQpkoftO7Q7/8591dTxxQc79g=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_vmwareengine", importpath = "cloud.google.com/go/vmwareengine", sum = "h1:EGdDi9QbqThfZq3ILcDK5g+m9jTevc34AY5tACx5v7k=", version = "v1.1.1", ) go_repository( name = "com_google_cloud_go_vpcaccess", importpath = "cloud.google.com/go/vpcaccess", sum = "h1:XyL6hTLtEM/eE4F1GEge8xUN9ZCkiVWn44K/YA7z1rQ=", version = "v1.7.5", ) go_repository( name = "com_google_cloud_go_webrisk", importpath = "cloud.google.com/go/webrisk", sum = "h1:251MvGuC8wisNN7+jqu9DDDZAi38KiMXxOpA/EWy4dE=", version = "v1.9.5", ) go_repository( name = "com_google_cloud_go_websecurityscanner", importpath = "cloud.google.com/go/websecurityscanner", sum = "h1:YqWZrZYabG88TZt7364XWRJGhxmxhony2ZUyZEYMF2k=", version = "v1.6.5", ) go_repository( name = "com_google_cloud_go_workflows", importpath = "cloud.google.com/go/workflows", sum = "h1:uHNmUiatTbPQ4H1pabwfzpfEYD4BBnqDHqMm2IesOh4=", version = "v1.12.4", ) go_repository( name = "com_shuralyov_dmitri_gpu_mtl", importpath = "dmitri.shuralyov.com/gpu/mtl", sum = "h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=", version = "v0.0.0-20190408044501-666a987793e9", ) go_repository( name = "in_gopkg_alecthomas_kingpin_v2", importpath = "gopkg.in/alecthomas/kingpin.v2", sum = "h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=", version = "v2.2.6", ) go_repository( name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", sum = "h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=", version = "v1.0.0-20201130134442-10cb98267c6c", ) go_repository( name = "in_gopkg_errgo_v2", importpath = "gopkg.in/errgo.v2", sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=", version = "v2.1.0", ) go_repository( name = "in_gopkg_ini_v1", importpath = "gopkg.in/ini.v1", sum = "h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=", version = "v1.51.0", ) go_repository( name = "in_gopkg_resty_v1", importpath = "gopkg.in/resty.v1", sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", version = "v1.12.0", ) go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", sum = "h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI=", version = "v2.2.3", ) go_repository( name = "in_gopkg_yaml_v3", importpath = "gopkg.in/yaml.v3", sum = "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=", version = "v3.0.1", ) go_repository( name = "io_etcd_go_bbolt", importpath = "go.etcd.io/bbolt", sum = "h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk=", version = "v1.3.2", ) go_repository( name = "io_opencensus_go", importpath = "go.opencensus.io", sum = "h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto=", version = "v0.22.4", ) go_repository( name = "io_opentelemetry_go_proto_otlp", importpath = "go.opentelemetry.io/proto/otlp", sum = "h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzcdGg8=", version = "v0.7.0", ) go_repository( name = "io_rsc_binaryregexp", importpath = "rsc.io/binaryregexp", sum = "h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=", version = "v0.2.0", ) go_repository( name = "io_rsc_quote_v3", importpath = "rsc.io/quote/v3", sum = "h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=", version = "v3.1.0", ) go_repository( name = "io_rsc_sampler", importpath = "rsc.io/sampler", sum = "h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=", version = "v1.3.0", ) go_repository( name = "org_golang_google_api", importpath = "google.golang.org/api", sum = "h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=", version = "v0.30.0", ) go_repository( name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", sum = "h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=", version = "v1.6.8", ) go_repository( name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", sum = "h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY=", version = "v0.0.0-20240227224415-6ceb2ff114de", ) go_repository( name = "org_golang_google_genproto_googleapis_api", importpath = "google.golang.org/genproto/googleapis/api", sum = "h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No=", version = "v0.0.0-20240513163218-0867130af1f8", ) go_repository( name = "org_golang_google_genproto_googleapis_rpc", importpath = "google.golang.org/genproto/googleapis/rpc", sum = "h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA=", version = "v0.0.0-20240513163218-0867130af1f8", ) go_repository( name = "org_golang_google_grpc", importpath = "google.golang.org/grpc", sum = "h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=", version = "v1.64.0", ) go_repository( name = "org_golang_google_grpc_cmd_protoc_gen_go_grpc", importpath = "google.golang.org/grpc/cmd/protoc-gen-go-grpc", sum = "h1:lQ+dE99pFsb8osbJB3oRfE5eW4Hx6a/lZQr8Jh+eoT4=", version = "v1.0.0", ) go_repository( name = "org_golang_google_protobuf", importpath = "google.golang.org/protobuf", sum = "h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=", version = "v1.34.1", ) go_repository( name = "org_golang_x_crypto", importpath = "golang.org/x/crypto", sum = "h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=", version = "v0.21.0", ) go_repository( name = "org_golang_x_exp", importpath = "golang.org/x/exp", sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=", version = "v0.0.0-20190121172915-509febef88a4", ) go_repository( name = "org_golang_x_image", importpath = "golang.org/x/image", sum = "h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=", version = "v0.0.0-20190802002840-cff245a6509b", ) go_repository( name = "org_golang_x_lint", importpath = "golang.org/x/lint", sum = "h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=", version = "v0.0.0-20190313153728-d0100b6bd8b3", ) go_repository( name = "org_golang_x_mobile", importpath = "golang.org/x/mobile", sum = "h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=", version = "v0.0.0-20190719004257-d2bd2a29d028", ) go_repository( name = "org_golang_x_mod", importpath = "golang.org/x/mod", sum = "h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=", version = "v0.8.0", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", sum = "h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=", version = "v0.23.0", ) go_repository( name = "org_golang_x_oauth2", importpath = "golang.org/x/oauth2", sum = "h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=", version = "v0.20.0", ) go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", sum = "h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=", version = "v0.6.0", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", sum = "h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=", version = "v0.18.0", ) go_repository( name = "org_golang_x_term", importpath = "golang.org/x/term", sum = "h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=", version = "v0.18.0", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", sum = "h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=", version = "v0.15.0", ) go_repository( name = "org_golang_x_time", importpath = "golang.org/x/time", sum = "h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=", version = "v0.0.0-20191024005414-555d28b269f0", ) go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", sum = "h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=", version = "v0.6.0", ) go_repository( name = "org_golang_x_xerrors", importpath = "golang.org/x/xerrors", sum = "h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=", version = "v0.0.0-20191204190536-9bdfabe68543", ) go_repository( name = "org_uber_go_atomic", importpath = "go.uber.org/atomic", sum = "h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=", version = "v1.7.0", ) go_repository( name = "org_uber_go_multierr", importpath = "go.uber.org/multierr", sum = "h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=", version = "v1.6.0", ) go_repository( name = "org_uber_go_tools", importpath = "go.uber.org/tools", sum = "h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=", version = "v0.0.0-20190618225709-2cfd321de3ee", ) go_repository( name = "org_uber_go_zap", importpath = "go.uber.org/zap", sum = "h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM=", version = "v1.16.0", ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/000077500000000000000000000000001465037340600233475ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/BUILD.bazel000066400000000000000000000064501465037340600252320ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) go_library( name = "runtime", srcs = [ "context.go", "convert.go", "doc.go", "errors.go", "fieldmask.go", "handler.go", "marshal_httpbodyproto.go", "marshal_json.go", "marshal_jsonpb.go", "marshal_proto.go", "marshaler.go", "marshaler_registry.go", "mux.go", "pattern.go", "proto2_convert.go", "query.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", deps = [ "//internal/httprule", "//utilities", "@org_golang_google_genproto_googleapis_api//httpbody", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//health/grpc_health_v1", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//reflect/protoregistry", "@org_golang_google_protobuf//types/known/durationpb", "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/known/timestamppb", "@org_golang_google_protobuf//types/known/wrapperspb", ], ) go_test( name = "runtime_test", size = "small", srcs = [ "context_test.go", "convert_test.go", "errors_test.go", "fieldmask_test.go", "handler_test.go", "marshal_httpbodyproto_test.go", "marshal_json_test.go", "marshal_jsonpb_test.go", "marshal_proto_test.go", "marshaler_registry_test.go", "mux_internal_test.go", "mux_test.go", "pattern_test.go", "query_fuzz_test.go", "query_test.go", ], embed = [":runtime"], deps = [ "//runtime/internal/examplepb", "//utilities", "@com_github_google_go_cmp//cmp", "@com_github_google_go_cmp//cmp/cmpopts", "@org_golang_google_genproto_googleapis_api//httpbody", "@org_golang_google_genproto_googleapis_rpc//errdetails", "@org_golang_google_genproto_googleapis_rpc//status", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//health/grpc_health_v1", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//encoding/protojson", "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//testing/protocmp", "@org_golang_google_protobuf//types/known/durationpb", "@org_golang_google_protobuf//types/known/emptypb", "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/known/timestamppb", "@org_golang_google_protobuf//types/known/wrapperspb", ], ) alias( name = "go_default_library", actual = ":runtime", visibility = ["//visibility:public"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/context.go000066400000000000000000000264771465037340600254020ustar00rootroot00000000000000package runtime import ( "context" "encoding/base64" "fmt" "net" "net/http" "net/textproto" "strconv" "strings" "sync" "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) // MetadataHeaderPrefix is the http prefix that represents custom metadata // parameters to or from a gRPC call. const MetadataHeaderPrefix = "Grpc-Metadata-" // MetadataPrefix is prepended to permanent HTTP header keys (as specified // by the IANA) when added to the gRPC context. const MetadataPrefix = "grpcgateway-" // MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to // HTTP headers in a response handled by grpc-gateway const MetadataTrailerPrefix = "Grpc-Trailer-" const metadataGrpcTimeout = "Grpc-Timeout" const metadataHeaderBinarySuffix = "-Bin" const xForwardedFor = "X-Forwarded-For" const xForwardedHost = "X-Forwarded-Host" // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound // header isn't present. If the value is 0 the sent `context` will not have a timeout. var DefaultContextTimeout = 0 * time.Second // malformedHTTPHeaders lists the headers that the gRPC server may reject outright as malformed. // See https://github.com/grpc/grpc-go/pull/4803#issuecomment-986093310 for more context. var malformedHTTPHeaders = map[string]struct{}{ "connection": {}, } type ( rpcMethodKey struct{} httpPathPatternKey struct{} AnnotateContextOption func(ctx context.Context) context.Context ) func WithHTTPPathPattern(pattern string) AnnotateContextOption { return func(ctx context.Context) context.Context { return withHTTPPathPattern(ctx, pattern) } } func decodeBinHeader(v string) ([]byte, error) { if len(v)%4 == 0 { // Input was padded, or padding was not necessary. return base64.StdEncoding.DecodeString(v) } return base64.RawStdEncoding.DecodeString(v) } /* AnnotateContext adds context information such as metadata from the request. At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For", except that the forwarded destination is not another HTTP service but rather a gRPC service. */ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcMethodName string, options ...AnnotateContextOption) (context.Context, error) { ctx, md, err := annotateContext(ctx, mux, req, rpcMethodName, options...) if err != nil { return nil, err } if md == nil { return ctx, nil } return metadata.NewOutgoingContext(ctx, md), nil } // AnnotateIncomingContext adds context information such as metadata from the request. // Attach metadata as incoming context. func AnnotateIncomingContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcMethodName string, options ...AnnotateContextOption) (context.Context, error) { ctx, md, err := annotateContext(ctx, mux, req, rpcMethodName, options...) if err != nil { return nil, err } if md == nil { return ctx, nil } return metadata.NewIncomingContext(ctx, md), nil } func isValidGRPCMetadataKey(key string) bool { // Must be a valid gRPC "Header-Name" as defined here: // https://github.com/grpc/grpc/blob/4b05dc88b724214d0c725c8e7442cbc7a61b1374/doc/PROTOCOL-HTTP2.md // This means 0-9 a-z _ - . // Only lowercase letters are valid in the wire protocol, but the client library will normalize // uppercase ASCII to lowercase, so uppercase ASCII is also acceptable. bytes := []byte(key) // gRPC validates strings on the byte level, not Unicode. for _, ch := range bytes { validLowercaseLetter := ch >= 'a' && ch <= 'z' validUppercaseLetter := ch >= 'A' && ch <= 'Z' validDigit := ch >= '0' && ch <= '9' validOther := ch == '.' || ch == '-' || ch == '_' if !validLowercaseLetter && !validUppercaseLetter && !validDigit && !validOther { return false } } return true } func isValidGRPCMetadataTextValue(textValue string) bool { // Must be a valid gRPC "ASCII-Value" as defined here: // https://github.com/grpc/grpc/blob/4b05dc88b724214d0c725c8e7442cbc7a61b1374/doc/PROTOCOL-HTTP2.md // This means printable ASCII (including/plus spaces); 0x20 to 0x7E inclusive. bytes := []byte(textValue) // gRPC validates strings on the byte level, not Unicode. for _, ch := range bytes { if ch < 0x20 || ch > 0x7E { return false } } return true } func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcMethodName string, options ...AnnotateContextOption) (context.Context, metadata.MD, error) { ctx = withRPCMethod(ctx, rpcMethodName) for _, o := range options { ctx = o(ctx) } timeout := DefaultContextTimeout if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { var err error timeout, err = timeoutDecode(tm) if err != nil { return nil, nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) } } var pairs []string for key, vals := range req.Header { key = textproto.CanonicalMIMEHeaderKey(key) switch key { case xForwardedFor, xForwardedHost: // Handled separately below continue } for _, val := range vals { // For backwards-compatibility, pass through 'authorization' header with no prefix. if key == "Authorization" { pairs = append(pairs, "authorization", val) } if h, ok := mux.incomingHeaderMatcher(key); ok { if !isValidGRPCMetadataKey(h) { grpclog.Errorf("HTTP header name %q is not valid as gRPC metadata key; skipping", h) continue } // Handles "-bin" metadata in grpc, since grpc will do another base64 // encode before sending to server, we need to decode it first. if strings.HasSuffix(key, metadataHeaderBinarySuffix) { b, err := decodeBinHeader(val) if err != nil { return nil, nil, status.Errorf(codes.InvalidArgument, "invalid binary header %s: %s", key, err) } val = string(b) } else if !isValidGRPCMetadataTextValue(val) { grpclog.Errorf("Value of HTTP header %q contains non-ASCII value (not valid as gRPC metadata): skipping", h) continue } pairs = append(pairs, h, val) } } } if host := req.Header.Get(xForwardedHost); host != "" { pairs = append(pairs, strings.ToLower(xForwardedHost), host) } else if req.Host != "" { pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) } xff := req.Header.Values(xForwardedFor) if addr := req.RemoteAddr; addr != "" { if remoteIP, _, err := net.SplitHostPort(addr); err == nil { xff = append(xff, remoteIP) } } if len(xff) > 0 { pairs = append(pairs, strings.ToLower(xForwardedFor), strings.Join(xff, ", ")) } if timeout != 0 { ctx, _ = context.WithTimeout(ctx, timeout) } if len(pairs) == 0 { return ctx, nil, nil } md := metadata.Pairs(pairs...) for _, mda := range mux.metadataAnnotators { md = metadata.Join(md, mda(ctx, req)) } return ctx, md, nil } // ServerMetadata consists of metadata sent from gRPC server. type ServerMetadata struct { HeaderMD metadata.MD TrailerMD metadata.MD } type serverMetadataKey struct{} // NewServerMetadataContext creates a new context with ServerMetadata func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { if ctx == nil { ctx = context.Background() } return context.WithValue(ctx, serverMetadataKey{}, md) } // ServerMetadataFromContext returns the ServerMetadata in ctx func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { if ctx == nil { return md, false } md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) return } // ServerTransportStream implements grpc.ServerTransportStream. // It should only be used by the generated files to support grpc.SendHeader // outside of gRPC server use. type ServerTransportStream struct { mu sync.Mutex header metadata.MD trailer metadata.MD } // Method returns the method for the stream. func (s *ServerTransportStream) Method() string { return "" } // Header returns the header metadata of the stream. func (s *ServerTransportStream) Header() metadata.MD { s.mu.Lock() defer s.mu.Unlock() return s.header.Copy() } // SetHeader sets the header metadata. func (s *ServerTransportStream) SetHeader(md metadata.MD) error { if md.Len() == 0 { return nil } s.mu.Lock() s.header = metadata.Join(s.header, md) s.mu.Unlock() return nil } // SendHeader sets the header metadata. func (s *ServerTransportStream) SendHeader(md metadata.MD) error { return s.SetHeader(md) } // Trailer returns the cached trailer metadata. func (s *ServerTransportStream) Trailer() metadata.MD { s.mu.Lock() defer s.mu.Unlock() return s.trailer.Copy() } // SetTrailer sets the trailer metadata. func (s *ServerTransportStream) SetTrailer(md metadata.MD) error { if md.Len() == 0 { return nil } s.mu.Lock() s.trailer = metadata.Join(s.trailer, md) s.mu.Unlock() return nil } func timeoutDecode(s string) (time.Duration, error) { size := len(s) if size < 2 { return 0, fmt.Errorf("timeout string is too short: %q", s) } d, ok := timeoutUnitToDuration(s[size-1]) if !ok { return 0, fmt.Errorf("timeout unit is not recognized: %q", s) } t, err := strconv.ParseInt(s[:size-1], 10, 64) if err != nil { return 0, err } return d * time.Duration(t), nil } func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { switch u { case 'H': return time.Hour, true case 'M': return time.Minute, true case 'S': return time.Second, true case 'm': return time.Millisecond, true case 'u': return time.Microsecond, true case 'n': return time.Nanosecond, true default: return } } // isPermanentHTTPHeader checks whether hdr belongs to the list of // permanent request headers maintained by IANA. // http://www.iana.org/assignments/message-headers/message-headers.xml func isPermanentHTTPHeader(hdr string) bool { switch hdr { case "Accept", "Accept-Charset", "Accept-Language", "Accept-Ranges", "Authorization", "Cache-Control", "Content-Type", "Cookie", "Date", "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match", "If-Schedule-Tag-Match", "If-Unmodified-Since", "Max-Forwards", "Origin", "Pragma", "Referer", "User-Agent", "Via", "Warning": return true } return false } // isMalformedHTTPHeader checks whether header belongs to the list of // "malformed headers" and would be rejected by the gRPC server. func isMalformedHTTPHeader(header string) bool { _, isMalformed := malformedHTTPHeaders[strings.ToLower(header)] return isMalformed } // RPCMethod returns the method string for the server context. The returned // string is in the format of "/package.service/method". func RPCMethod(ctx context.Context) (string, bool) { m := ctx.Value(rpcMethodKey{}) if m == nil { return "", false } ms, ok := m.(string) if !ok { return "", false } return ms, true } func withRPCMethod(ctx context.Context, rpcMethodName string) context.Context { return context.WithValue(ctx, rpcMethodKey{}, rpcMethodName) } // HTTPPathPattern returns the HTTP path pattern string relating to the HTTP handler, if one exists. // The format of the returned string is defined by the google.api.http path template type. func HTTPPathPattern(ctx context.Context) (string, bool) { m := ctx.Value(httpPathPatternKey{}) if m == nil { return "", false } ms, ok := m.(string) if !ok { return "", false } return ms, true } func withHTTPPathPattern(ctx context.Context, httpPathPattern string) context.Context { return context.WithValue(ctx, httpPathPatternKey{}, httpPathPattern) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/context_test.go000066400000000000000000000613521465037340600264300ustar00rootroot00000000000000package runtime_test import ( "context" "encoding/base64" "net/http" "reflect" "testing" "time" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc/metadata" ) const ( emptyForwardMetaCount = 1 ) func TestAnnotateContext_WorksWithEmpty(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" expectedHTTPPathPattern := "/v1" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com/v1", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } request.Header.Add("Some-Irrelevant-Header", "some value") annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName, runtime.WithHTTPPathPattern(expectedHTTPPathPattern)) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) } } func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" expectedHTTPPathPattern := "/v1" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com/v1", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } request.Header.Add("Some-Irrelevant-Header", "some value") request.Header.Add("Grpc-Metadata-FooBar", "Value1") request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") request.Header.Add("Authorization", "Token 1234567890") annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName, runtime.WithHTTPPathPattern(expectedHTTPPathPattern)) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromOutgoingContext(annotated) if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { t.Errorf("metadata items in context = %d want %d: %v", got, want, md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-foobar"] = %q; want %q`, got, want) } if got, want := md["foo-baz"], []string{"Value2", "Value3"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-foo-baz"] = %q want %q`, got, want) } if got, want := md["grpcgateway-authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-authorization"] = %q want %q`, got, want) } if got, want := md["authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["authorization"] = %q want %q`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } if m, ok := runtime.HTTPPathPattern(annotated); !ok { t.Errorf("runtime.HTTPPathPattern(annotated) failed with no value; want %s", expectedHTTPPathPattern) } else if m != expectedHTTPPathPattern { t.Errorf("runtime.HTTPPathPattern(annotated) failed with %s; want %s", m, expectedHTTPPathPattern) } } func TestAnnotateContext_ForwardGrpcBinaryMetadata(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } binData := []byte("\x00test-binary-data") request.Header.Add("Grpc-Metadata-Test-Bin", base64.StdEncoding.EncodeToString(binData)) annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["test-bin"], []string{string(binData)}; !reflect.DeepEqual(got, want) { t.Errorf(`md["test-bin"] = %q want %q`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateContext_AddsXForwardedHeaders(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://bar.foo.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) } request.RemoteAddr = "192.0.2.100:12345" // client serveMux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { return key, true })) annotated, err := runtime.AnnotateContext(ctx, serveMux, request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["host"] = %v; want %v`, got, want) } if got, want := md["x-forwarded-for"], []string{"192.0.2.100"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateContext_AppendsToExistingXForwardedHeaders(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://bar.foo.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) } request.Header.Add("X-Forwarded-Host", "qux.example.com") request.Header.Add("X-Forwarded-For", "192.0.2.100") // client request.Header.Add("X-Forwarded-For", "192.0.2.101, 192.0.2.102") // intermediate proxies request.RemoteAddr = "192.0.2.200:12345" // final proxy serveMux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { return key, true })) annotated, err := runtime.AnnotateContext(ctx, serveMux, request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["x-forwarded-host"], []string{"qux.example.com"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["host"] = %v; want %v`, got, want) } // Note: it must be in order client, proxy1, proxy2 if got, want := md["x-forwarded-for"], []string{"192.0.2.100, 192.0.2.101, 192.0.2.102, 192.0.2.200"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateContext_SupportsTimeouts(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) if err != nil { t.Fatalf(`http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) failed with %v; want success`, err) } annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } if _, ok := annotated.Deadline(); ok { // no deadline by default t.Errorf("annotated.Deadline() = _, true; want _, false") } const acceptableError = 50 * time.Millisecond runtime.DefaultContextTimeout = 10 * time.Second annotated, err = runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } deadline, ok := annotated.Deadline() if !ok { t.Errorf("annotated.Deadline() = _, false; want _, true") } if got, want := time.Until(deadline), runtime.DefaultContextTimeout; got-want > acceptableError || got-want < -acceptableError { t.Errorf("time.Until(deadline) = %v; want %v; with error %v", got, want, acceptableError) } for _, spec := range []struct { timeout string want time.Duration }{ { timeout: "17H", want: 17 * time.Hour, }, { timeout: "19M", want: 19 * time.Minute, }, { timeout: "23S", want: 23 * time.Second, }, { timeout: "1009m", want: 1009 * time.Millisecond, }, { timeout: "1000003u", want: 1000003 * time.Microsecond, }, { timeout: "100000007n", want: 100000007 * time.Nanosecond, }, } { request.Header.Set("Grpc-Timeout", spec.timeout) annotated, err = runtime.AnnotateContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } deadline, ok := annotated.Deadline() if !ok { t.Errorf("annotated.Deadline() = _, false; want _, true; timeout = %q", spec.timeout) } if got, want := time.Until(deadline), spec.want; got-want > acceptableError || got-want < -acceptableError { t.Errorf("time.Until(deadline) = %v; want %v; with error %v; timeout= %q", got, want, acceptableError, spec.timeout) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } } func TestAnnotateContext_SupportsCustomAnnotators(t *testing.T) { ctx := context.Background() md1 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"foo": "bar"}) } md2 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"baz": "qux"}) } expected := metadata.New(map[string]string{"foo": "bar", "baz": "qux"}) expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) if err != nil { t.Fatalf(`http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) failed with %v; want success`, err) } annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(runtime.WithMetadata(md1), runtime.WithMetadata(md2)), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } actual, _ := metadata.FromOutgoingContext(annotated) for key, e := range expected { if a, ok := actual[key]; !ok || !reflect.DeepEqual(e, a) { t.Errorf("metadata.MD[%s] = %v; want %v", key, a, e) } } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateIncomingContext_WorksWithEmpty(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" expectedHTTPPathPattern := "/v1" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com/v1", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } request.Header.Add("Some-Irrelevant-Header", "some value") annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName, runtime.WithHTTPPathPattern(expectedHTTPPathPattern)) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateIncomingContext_ForwardsGrpcMetadata(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" expectedHTTPPathPattern := "/v1" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com/v1", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } request.Header.Add("Some-Irrelevant-Header", "some value") request.Header.Add("Grpc-Metadata-FooBar", "Value1") request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") request.Header.Add("Authorization", "Token 1234567890") annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName, runtime.WithHTTPPathPattern(expectedHTTPPathPattern)) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromIncomingContext(annotated) if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { t.Errorf("metadata items in context = %d want %d: %v", got, want, md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-foobar"] = %q; want %q`, got, want) } if got, want := md["foo-baz"], []string{"Value2", "Value3"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-foo-baz"] = %q want %q`, got, want) } if got, want := md["grpcgateway-authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["grpcgateway-authorization"] = %q want %q`, got, want) } if got, want := md["authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["authorization"] = %q want %q`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } if m, ok := runtime.HTTPPathPattern(annotated); !ok { t.Errorf("runtime.HTTPPathPattern(annotated) failed with no value; want %s", expectedHTTPPathPattern) } else if m != expectedHTTPPathPattern { t.Errorf("runtime.HTTPPathPattern(annotated) failed with %s; want %s", m, expectedHTTPPathPattern) } } func TestAnnotateIncomingContext_ForwardGrpcBinaryMetadata(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://www.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } binData := []byte("\x00test-binary-data") request.Header.Add("Grpc-Metadata-Test-Bin", base64.StdEncoding.EncodeToString(binData)) annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["test-bin"], []string{string(binData)}; !reflect.DeepEqual(got, want) { t.Errorf(`md["test-bin"] = %q want %q`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateIncomingContext_AddsXForwardedHeaders(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://bar.foo.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) } request.RemoteAddr = "192.0.2.100:12345" // client serveMux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { return key, true })) annotated, err := runtime.AnnotateIncomingContext(ctx, serveMux, request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["host"] = %v; want %v`, got, want) } if got, want := md["x-forwarded-for"], []string{"192.0.2.100"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateIncomingContext_AppendsToExistingXForwardedHeaders(t *testing.T) { ctx := context.Background() expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://bar.foo.example.com", nil) if err != nil { t.Fatalf("http.NewRequestWithContext(ctx, %q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) } request.Header.Add("X-Forwarded-Host", "qux.example.com") request.Header.Add("X-Forwarded-For", "192.0.2.100") // client request.Header.Add("X-Forwarded-For", "192.0.2.101, 192.0.2.102") // intermediate proxies request.RemoteAddr = "192.0.2.200:12345" // final proxy serveMux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) { return key, true })) annotated, err := runtime.AnnotateIncomingContext(ctx, serveMux, request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["x-forwarded-host"], []string{"qux.example.com"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["host"] = %v; want %v`, got, want) } // Note: it must be in order client, proxy1, proxy2 if got, want := md["x-forwarded-for"], []string{"192.0.2.100, 192.0.2.101, 192.0.2.102, 192.0.2.200"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } func TestAnnotateIncomingContext_SupportsTimeouts(t *testing.T) { // While run all test, TestAnnotateContext_SupportsTimeouts() will change the DefaultContextTimeout, so reset it to zero. runtime.DefaultContextTimeout = 0 * time.Second expectedRPCName := "/example.Example/Example" ctx := context.Background() request, err := http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) if err != nil { t.Fatalf(`http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) failed with %v; want success`, err) } annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } if _, ok := annotated.Deadline(); ok { // no deadline by default t.Errorf("annotated.Deadline() = _, true; want _, false") } const acceptableError = 50 * time.Millisecond runtime.DefaultContextTimeout = 10 * time.Second annotated, err = runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } deadline, ok := annotated.Deadline() if !ok { t.Errorf("annotated.Deadline() = _, false; want _, true") } if got, want := time.Until(deadline), runtime.DefaultContextTimeout; got-want > acceptableError || got-want < -acceptableError { t.Errorf("time.Until(deadline) = %v; want %v; with error %v", got, want, acceptableError) } for _, spec := range []struct { timeout string want time.Duration }{ { timeout: "17H", want: 17 * time.Hour, }, { timeout: "19M", want: 19 * time.Minute, }, { timeout: "23S", want: 23 * time.Second, }, { timeout: "1009m", want: 1009 * time.Millisecond, }, { timeout: "1000003u", want: 1000003 * time.Microsecond, }, { timeout: "100000007n", want: 100000007 * time.Nanosecond, }, } { request.Header.Set("Grpc-Timeout", spec.timeout) annotated, err = runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } deadline, ok := annotated.Deadline() if !ok { t.Errorf("annotated.Deadline() = _, false; want _, true; timeout = %q", spec.timeout) } if got, want := time.Until(deadline), spec.want; got-want > acceptableError || got-want < -acceptableError { t.Errorf("time.Until(deadline) = %v; want %v; with error %v; timeout= %q", got, want, acceptableError, spec.timeout) } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } } func TestAnnotateIncomingContext_SupportsCustomAnnotators(t *testing.T) { ctx := context.Background() md1 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"foo": "bar"}) } md2 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"baz": "qux"}) } expected := metadata.New(map[string]string{"foo": "bar", "baz": "qux"}) expectedRPCName := "/example.Example/Example" request, err := http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) if err != nil { t.Fatalf(`http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) failed with %v; want success`, err) } annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(runtime.WithMetadata(md1), runtime.WithMetadata(md2)), request, expectedRPCName) if err != nil { t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) return } actual, _ := metadata.FromIncomingContext(annotated) for key, e := range expected { if a, ok := actual[key]; !ok || !reflect.DeepEqual(e, a) { t.Errorf("metadata.MD[%s] = %v; want %v", key, a, e) } } if m, ok := runtime.RPCMethod(annotated); !ok { t.Errorf("runtime.RPCMethod(annotated) failed with no value; want %s", expectedRPCName) } else if m != expectedRPCName { t.Errorf("runtime.RPCMethod(annotated) failed with %s; want %s", m, expectedRPCName) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/convert.go000066400000000000000000000211311465037340600253540ustar00rootroot00000000000000package runtime import ( "encoding/base64" "fmt" "strconv" "strings" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) // String just returns the given string. // It is just for compatibility to other types. func String(val string) (string, error) { return val, nil } // StringSlice converts 'val' where individual strings are separated by // 'sep' into a string slice. func StringSlice(val, sep string) ([]string, error) { return strings.Split(val, sep), nil } // Bool converts the given string representation of a boolean value into bool. func Bool(val string) (bool, error) { return strconv.ParseBool(val) } // BoolSlice converts 'val' where individual booleans are separated by // 'sep' into a bool slice. func BoolSlice(val, sep string) ([]bool, error) { s := strings.Split(val, sep) values := make([]bool, len(s)) for i, v := range s { value, err := Bool(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Float64 converts the given string representation into representation of a floating point number into float64. func Float64(val string) (float64, error) { return strconv.ParseFloat(val, 64) } // Float64Slice converts 'val' where individual floating point numbers are separated by // 'sep' into a float64 slice. func Float64Slice(val, sep string) ([]float64, error) { s := strings.Split(val, sep) values := make([]float64, len(s)) for i, v := range s { value, err := Float64(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Float32 converts the given string representation of a floating point number into float32. func Float32(val string) (float32, error) { f, err := strconv.ParseFloat(val, 32) if err != nil { return 0, err } return float32(f), nil } // Float32Slice converts 'val' where individual floating point numbers are separated by // 'sep' into a float32 slice. func Float32Slice(val, sep string) ([]float32, error) { s := strings.Split(val, sep) values := make([]float32, len(s)) for i, v := range s { value, err := Float32(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Int64 converts the given string representation of an integer into int64. func Int64(val string) (int64, error) { return strconv.ParseInt(val, 0, 64) } // Int64Slice converts 'val' where individual integers are separated by // 'sep' into a int64 slice. func Int64Slice(val, sep string) ([]int64, error) { s := strings.Split(val, sep) values := make([]int64, len(s)) for i, v := range s { value, err := Int64(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Int32 converts the given string representation of an integer into int32. func Int32(val string) (int32, error) { i, err := strconv.ParseInt(val, 0, 32) if err != nil { return 0, err } return int32(i), nil } // Int32Slice converts 'val' where individual integers are separated by // 'sep' into a int32 slice. func Int32Slice(val, sep string) ([]int32, error) { s := strings.Split(val, sep) values := make([]int32, len(s)) for i, v := range s { value, err := Int32(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Uint64 converts the given string representation of an integer into uint64. func Uint64(val string) (uint64, error) { return strconv.ParseUint(val, 0, 64) } // Uint64Slice converts 'val' where individual integers are separated by // 'sep' into a uint64 slice. func Uint64Slice(val, sep string) ([]uint64, error) { s := strings.Split(val, sep) values := make([]uint64, len(s)) for i, v := range s { value, err := Uint64(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Uint32 converts the given string representation of an integer into uint32. func Uint32(val string) (uint32, error) { i, err := strconv.ParseUint(val, 0, 32) if err != nil { return 0, err } return uint32(i), nil } // Uint32Slice converts 'val' where individual integers are separated by // 'sep' into a uint32 slice. func Uint32Slice(val, sep string) ([]uint32, error) { s := strings.Split(val, sep) values := make([]uint32, len(s)) for i, v := range s { value, err := Uint32(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Bytes converts the given string representation of a byte sequence into a slice of bytes // A bytes sequence is encoded in URL-safe base64 without padding func Bytes(val string) ([]byte, error) { b, err := base64.StdEncoding.DecodeString(val) if err != nil { b, err = base64.URLEncoding.DecodeString(val) if err != nil { return nil, err } } return b, nil } // BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe // base64 without padding, are separated by 'sep' into a slice of bytes slices slice. func BytesSlice(val, sep string) ([][]byte, error) { s := strings.Split(val, sep) values := make([][]byte, len(s)) for i, v := range s { value, err := Bytes(v) if err != nil { return nil, err } values[i] = value } return values, nil } // Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp. func Timestamp(val string) (*timestamppb.Timestamp, error) { var r timestamppb.Timestamp val = strconv.Quote(strings.Trim(val, `"`)) unmarshaler := &protojson.UnmarshalOptions{} if err := unmarshaler.Unmarshal([]byte(val), &r); err != nil { return nil, err } return &r, nil } // Duration converts the given string into a timestamp.Duration. func Duration(val string) (*durationpb.Duration, error) { var r durationpb.Duration val = strconv.Quote(strings.Trim(val, `"`)) unmarshaler := &protojson.UnmarshalOptions{} if err := unmarshaler.Unmarshal([]byte(val), &r); err != nil { return nil, err } return &r, nil } // Enum converts the given string into an int32 that should be type casted into the // correct enum proto type. func Enum(val string, enumValMap map[string]int32) (int32, error) { e, ok := enumValMap[val] if ok { return e, nil } i, err := Int32(val) if err != nil { return 0, fmt.Errorf("%s is not valid", val) } for _, v := range enumValMap { if v == i { return i, nil } } return 0, fmt.Errorf("%s is not valid", val) } // EnumSlice converts 'val' where individual enums are separated by 'sep' // into a int32 slice. Each individual int32 should be type casted into the // correct enum proto type. func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error) { s := strings.Split(val, sep) values := make([]int32, len(s)) for i, v := range s { value, err := Enum(v, enumValMap) if err != nil { return nil, err } values[i] = value } return values, nil } // Support for google.protobuf.wrappers on top of primitive types // StringValue well-known type support as wrapper around string type func StringValue(val string) (*wrapperspb.StringValue, error) { return wrapperspb.String(val), nil } // FloatValue well-known type support as wrapper around float32 type func FloatValue(val string) (*wrapperspb.FloatValue, error) { parsedVal, err := Float32(val) return wrapperspb.Float(parsedVal), err } // DoubleValue well-known type support as wrapper around float64 type func DoubleValue(val string) (*wrapperspb.DoubleValue, error) { parsedVal, err := Float64(val) return wrapperspb.Double(parsedVal), err } // BoolValue well-known type support as wrapper around bool type func BoolValue(val string) (*wrapperspb.BoolValue, error) { parsedVal, err := Bool(val) return wrapperspb.Bool(parsedVal), err } // Int32Value well-known type support as wrapper around int32 type func Int32Value(val string) (*wrapperspb.Int32Value, error) { parsedVal, err := Int32(val) return wrapperspb.Int32(parsedVal), err } // UInt32Value well-known type support as wrapper around uint32 type func UInt32Value(val string) (*wrapperspb.UInt32Value, error) { parsedVal, err := Uint32(val) return wrapperspb.UInt32(parsedVal), err } // Int64Value well-known type support as wrapper around int64 type func Int64Value(val string) (*wrapperspb.Int64Value, error) { parsedVal, err := Int64(val) return wrapperspb.Int64(parsedVal), err } // UInt64Value well-known type support as wrapper around uint64 type func UInt64Value(val string) (*wrapperspb.UInt64Value, error) { parsedVal, err := Uint64(val) return wrapperspb.UInt64(parsedVal), err } // BytesValue well-known type support as wrapper around bytes[] type func BytesValue(val string) (*wrapperspb.BytesValue, error) { parsedVal, err := Bytes(val) return wrapperspb.Bytes(parsedVal), err } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/convert_test.go000066400000000000000000000053601465037340600264210ustar00rootroot00000000000000package runtime_test import ( "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" ) func TestConvertTimestamp(t *testing.T) { specs := []struct { name string input string output *timestamppb.Timestamp wanterr bool }{ { name: "a valid RFC3339 timestamp", input: `"2016-05-10T10:19:13.123Z"`, output: ×tamppb.Timestamp{ Seconds: 1462875553, Nanos: 123000000, }, wanterr: false, }, { name: "a valid RFC3339 timestamp without double quotation", input: "2016-05-10T10:19:13.123Z", output: ×tamppb.Timestamp{ Seconds: 1462875553, Nanos: 123000000, }, wanterr: false, }, { name: "invalid timestamp", input: `"05-10-2016T10:19:13.123Z"`, output: nil, wanterr: true, }, { name: "JSON number", input: "123", output: nil, wanterr: true, }, { name: "JSON bool", input: "true", output: nil, wanterr: true, }, } for _, spec := range specs { t.Run(spec.name, func(t *testing.T) { ts, err := runtime.Timestamp(spec.input) switch { case err != nil && !spec.wanterr: t.Errorf("got unexpected error\n%#v", err) case err == nil && spec.wanterr: t.Errorf("did not error when expecte") case !proto.Equal(ts, spec.output): t.Errorf( "when testing %s; got\n%#v\nexpected\n%#v", spec.name, ts, spec.output, ) } }) } } func TestConvertDuration(t *testing.T) { specs := []struct { name string input string output *durationpb.Duration wanterr bool }{ { name: "a valid duration", input: `"123.456s"`, output: &durationpb.Duration{ Seconds: 123, Nanos: 456000000, }, wanterr: false, }, { name: "a valid duration without double quotation", input: "123.456s", output: &durationpb.Duration{ Seconds: 123, Nanos: 456000000, }, wanterr: false, }, { name: "invalid duration", input: `"123years"`, output: nil, wanterr: true, }, { name: "JSON number", input: "123", output: nil, wanterr: true, }, { name: "JSON bool", input: "true", output: nil, wanterr: true, }, } for _, spec := range specs { t.Run(spec.name, func(t *testing.T) { ts, err := runtime.Duration(spec.input) switch { case err != nil && !spec.wanterr: t.Errorf("got unexpected error\n%#v", err) case err == nil && spec.wanterr: t.Errorf("did not error when expecte") case !proto.Equal(ts, spec.output): t.Errorf( "when testing %s; got\n%#v\nexpected\n%#v", spec.name, ts, spec.output, ) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/doc.go000066400000000000000000000002011465037340600244340ustar00rootroot00000000000000/* Package runtime contains runtime helper functions used by servers which protoc-gen-grpc-gateway generates. */ package runtime golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/errors.go000066400000000000000000000141751465037340600252220ustar00rootroot00000000000000package runtime import ( "context" "errors" "io" "net/http" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" ) // ErrorHandlerFunc is the signature used to configure error handling. type ErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, error) // StreamErrorHandlerFunc is the signature used to configure stream error handling. type StreamErrorHandlerFunc func(context.Context, error) *status.Status // RoutingErrorHandlerFunc is the signature used to configure error handling for routing errors. type RoutingErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, int) // HTTPStatusError is the error to use when needing to provide a different HTTP status code for an error // passed to the DefaultRoutingErrorHandler. type HTTPStatusError struct { HTTPStatus int Err error } func (e *HTTPStatusError) Error() string { return e.Err.Error() } // HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. // See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto func HTTPStatusFromCode(code codes.Code) int { switch code { case codes.OK: return http.StatusOK case codes.Canceled: return 499 case codes.Unknown: return http.StatusInternalServerError case codes.InvalidArgument: return http.StatusBadRequest case codes.DeadlineExceeded: return http.StatusGatewayTimeout case codes.NotFound: return http.StatusNotFound case codes.AlreadyExists: return http.StatusConflict case codes.PermissionDenied: return http.StatusForbidden case codes.Unauthenticated: return http.StatusUnauthorized case codes.ResourceExhausted: return http.StatusTooManyRequests case codes.FailedPrecondition: // Note, this deliberately doesn't translate to the similarly named '412 Precondition Failed' HTTP response status. return http.StatusBadRequest case codes.Aborted: return http.StatusConflict case codes.OutOfRange: return http.StatusBadRequest case codes.Unimplemented: return http.StatusNotImplemented case codes.Internal: return http.StatusInternalServerError case codes.Unavailable: return http.StatusServiceUnavailable case codes.DataLoss: return http.StatusInternalServerError default: grpclog.Warningf("Unknown gRPC error code: %v", code) return http.StatusInternalServerError } } // HTTPError uses the mux-configured error handler. func HTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, err error) { mux.errorHandler(ctx, mux, marshaler, w, r, err) } // DefaultHTTPErrorHandler is the default error handler. // If "err" is a gRPC Status, the function replies with the status code mapped by HTTPStatusFromCode. // If "err" is a HTTPStatusError, the function replies with the status code provide by that struct. This is // intended to allow passing through of specific statuses via the function set via WithRoutingErrorHandler // for the ServeMux constructor to handle edge cases which the standard mappings in HTTPStatusFromCode // are insufficient for. // If otherwise, it replies with http.StatusInternalServerError. // // The response body written by this function is a Status message marshaled by the Marshaler. func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, err error) { // return Internal when Marshal failed const fallback = `{"code": 13, "message": "failed to marshal error message"}` var customStatus *HTTPStatusError if errors.As(err, &customStatus) { err = customStatus.Err } s := status.Convert(err) pb := s.Proto() w.Header().Del("Trailer") w.Header().Del("Transfer-Encoding") contentType := marshaler.ContentType(pb) w.Header().Set("Content-Type", contentType) if s.Code() == codes.Unauthenticated { w.Header().Set("WWW-Authenticate", s.Message()) } buf, merr := marshaler.Marshal(pb) if merr != nil { grpclog.Errorf("Failed to marshal error message %q: %v", s, merr) w.WriteHeader(http.StatusInternalServerError) if _, err := io.WriteString(w, fallback); err != nil { grpclog.Errorf("Failed to write response: %v", err) } return } md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Error("Failed to extract ServerMetadata from context") } handleForwardResponseServerMetadata(w, mux, md) // RFC 7230 https://tools.ietf.org/html/rfc7230#section-4.1.2 // Unless the request includes a TE header field indicating "trailers" // is acceptable, as described in Section 4.3, a server SHOULD NOT // generate trailer fields that it believes are necessary for the user // agent to receive. doForwardTrailers := requestAcceptsTrailers(r) if doForwardTrailers { handleForwardResponseTrailerHeader(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") } st := HTTPStatusFromCode(s.Code()) if customStatus != nil { st = customStatus.HTTPStatus } w.WriteHeader(st) if _, err := w.Write(buf); err != nil { grpclog.Errorf("Failed to write response: %v", err) } if doForwardTrailers { handleForwardResponseTrailer(w, mux, md) } } func DefaultStreamErrorHandler(_ context.Context, err error) *status.Status { return status.Convert(err) } // DefaultRoutingErrorHandler is our default handler for routing errors. // By default http error codes mapped on the following error codes: // // NotFound -> grpc.NotFound // StatusBadRequest -> grpc.InvalidArgument // MethodNotAllowed -> grpc.Unimplemented // Other -> grpc.Internal, method is not expecting to be called for anything else func DefaultRoutingErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, httpStatus int) { sterr := status.Error(codes.Internal, "Unexpected routing error") switch httpStatus { case http.StatusBadRequest: sterr = status.Error(codes.InvalidArgument, http.StatusText(httpStatus)) case http.StatusMethodNotAllowed: sterr = status.Error(codes.Unimplemented, http.StatusText(httpStatus)) case http.StatusNotFound: sterr = status.Error(codes.NotFound, http.StatusText(httpStatus)) } mux.errorHandler(ctx, mux, marshaler, w, r, sterr) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/errors_test.go000066400000000000000000000063111465037340600262520ustar00rootroot00000000000000package runtime_test import ( "context" "errors" "net/http" "net/http/httptest" "strconv" "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/genproto/googleapis/rpc/errdetails" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) func TestDefaultHTTPError(t *testing.T) { ctx := context.Background() statusWithDetails, _ := status.New(codes.FailedPrecondition, "failed precondition").WithDetails( &errdetails.PreconditionFailure{}, ) for i, spec := range []struct { err error status int msg string marshaler runtime.Marshaler contentType string details string }{ { err: errors.New("example error"), status: http.StatusInternalServerError, marshaler: &runtime.JSONPb{}, contentType: "application/json", msg: "example error", }, { err: status.Error(codes.NotFound, "no such resource"), status: http.StatusNotFound, marshaler: &runtime.JSONPb{}, contentType: "application/json", msg: "no such resource", }, { err: statusWithDetails.Err(), status: http.StatusBadRequest, marshaler: &runtime.JSONPb{}, contentType: "application/json", msg: "failed precondition", details: "type.googleapis.com/google.rpc.PreconditionFailure", }, { err: errors.New("example error"), status: http.StatusInternalServerError, marshaler: &CustomMarshaler{&runtime.JSONPb{}}, contentType: "Custom-Content-Type", msg: "example error", }, { err: &runtime.HTTPStatusError{ HTTPStatus: http.StatusMethodNotAllowed, Err: status.Error(codes.Unimplemented, http.StatusText(http.StatusMethodNotAllowed)), }, status: http.StatusMethodNotAllowed, marshaler: &runtime.JSONPb{}, contentType: "application/json", msg: "Method Not Allowed", }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { w := httptest.NewRecorder() req, _ := http.NewRequestWithContext(ctx, "", "", nil) // Pass in an empty request to match the signature mux := runtime.NewServeMux() marshaler := &runtime.JSONPb{} runtime.HTTPError(ctx, mux, marshaler, w, req, spec.err) if got, want := w.Header().Get("Content-Type"), "application/json"; got != want { t.Errorf(`w.Header().Get("Content-Type") = %q; want %q; on spec.err=%v`, got, want, spec.err) } if got, want := w.Code, spec.status; got != want { t.Errorf("w.Code = %d; want %d", got, want) } var st statuspb.Status if err := marshaler.Unmarshal(w.Body.Bytes(), &st); err != nil { t.Errorf("marshaler.Unmarshal(%q, &body) failed with %v; want success", w.Body.Bytes(), err) return } if got, want := st.Message, spec.msg; !strings.Contains(got, want) { t.Errorf(`st.Message = %q; want %q; on spec.err=%v`, got, want, spec.err) } if spec.details != "" { if len(st.Details) != 1 { t.Errorf(`len(st.Details) = %v; want 1`, len(st.Details)) return } if st.Details[0].TypeUrl != spec.details { t.Errorf(`details.type_url = %s; want %s`, st.Details[0].TypeUrl, spec.details) } } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/fieldmask.go000066400000000000000000000113311465037340600256340ustar00rootroot00000000000000package runtime import ( "encoding/json" "errors" "fmt" "io" "sort" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" ) func getFieldByName(fields protoreflect.FieldDescriptors, name string) protoreflect.FieldDescriptor { fd := fields.ByName(protoreflect.Name(name)) if fd != nil { return fd } return fields.ByJSONName(name) } // FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body. func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.FieldMask, error) { fm := &field_mask.FieldMask{} var root interface{} if err := json.NewDecoder(r).Decode(&root); err != nil { if errors.Is(err, io.EOF) { return fm, nil } return nil, err } queue := []fieldMaskPathItem{{node: root, msg: msg.ProtoReflect()}} for len(queue) > 0 { // dequeue an item item := queue[0] queue = queue[1:] m, ok := item.node.(map[string]interface{}) switch { case ok && len(m) > 0: // if the item is an object, then enqueue all of its children for k, v := range m { if item.msg == nil { return nil, errors.New("JSON structure did not match request type") } fd := getFieldByName(item.msg.Descriptor().Fields(), k) if fd == nil { return nil, fmt.Errorf("could not find field %q in %q", k, item.msg.Descriptor().FullName()) } if isDynamicProtoMessage(fd.Message()) { for _, p := range buildPathsBlindly(string(fd.FullName().Name()), v) { newPath := p if item.path != "" { newPath = item.path + "." + newPath } queue = append(queue, fieldMaskPathItem{path: newPath}) } continue } if isProtobufAnyMessage(fd.Message()) && !fd.IsList() { _, hasTypeField := v.(map[string]interface{})["@type"] if hasTypeField { queue = append(queue, fieldMaskPathItem{path: k}) continue } else { return nil, fmt.Errorf("could not find field @type in %q in message %q", k, item.msg.Descriptor().FullName()) } } child := fieldMaskPathItem{ node: v, } if item.path == "" { child.path = string(fd.FullName().Name()) } else { child.path = item.path + "." + string(fd.FullName().Name()) } switch { case fd.IsList(), fd.IsMap(): // As per: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto#L85-L86 // Do not recurse into repeated fields. The repeated field goes on the end of the path and we stop. fm.Paths = append(fm.Paths, child.path) case fd.Message() != nil: child.msg = item.msg.Get(fd).Message() fallthrough default: queue = append(queue, child) } } case ok && len(m) == 0: fallthrough case len(item.path) > 0: // otherwise, it's a leaf node so print its path fm.Paths = append(fm.Paths, item.path) } } // Sort for deterministic output in the presence // of repeated fields. sort.Strings(fm.Paths) return fm, nil } func isProtobufAnyMessage(md protoreflect.MessageDescriptor) bool { return md != nil && (md.FullName() == "google.protobuf.Any") } func isDynamicProtoMessage(md protoreflect.MessageDescriptor) bool { return md != nil && (md.FullName() == "google.protobuf.Struct" || md.FullName() == "google.protobuf.Value") } // buildPathsBlindly does not attempt to match proto field names to the // json value keys. Instead it relies completely on the structure of // the unmarshalled json contained within in. // Returns a slice containing all subpaths with the root at the // passed in name and json value. func buildPathsBlindly(name string, in interface{}) []string { m, ok := in.(map[string]interface{}) if !ok { return []string{name} } var paths []string queue := []fieldMaskPathItem{{path: name, node: m}} for len(queue) > 0 { cur := queue[0] queue = queue[1:] m, ok := cur.node.(map[string]interface{}) if !ok { // This should never happen since we should always check that we only add // nodes of type map[string]interface{} to the queue. continue } for k, v := range m { if mi, ok := v.(map[string]interface{}); ok { queue = append(queue, fieldMaskPathItem{path: cur.path + "." + k, node: mi}) } else { // This is not a struct, so there are no more levels to descend. curPath := cur.path + "." + k paths = append(paths, curPath) } } } return paths } // fieldMaskPathItem stores a in-progress deconstruction of a path for a fieldmask type fieldMaskPathItem struct { // the list of prior fields leading up to node connected by dots path string // a generic decoded json object the current item to inspect for further path extraction node interface{} // parent message msg protoreflect.Message } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/fieldmask_test.go000066400000000000000000000237651465037340600267110ustar00rootroot00000000000000package runtime import ( "bytes" "errors" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" ) func newFieldMask(paths ...string) *field_mask.FieldMask { return &field_mask.FieldMask{Paths: paths} } func TestFieldMaskFromRequestBody(t *testing.T) { for _, tc := range []struct { name string input string msg proto.Message expected *field_mask.FieldMask }{ { name: "empty", expected: newFieldMask(), }, { name: "EmptyMessage", msg: &examplepb.ABitOfEverything{}, input: `{"oneof_empty": {}}`, expected: newFieldMask("oneof_empty"), }, { name: "simple", msg: &examplepb.ABitOfEverything{}, input: `{"uuid":"1234", "floatValue":3.14}`, expected: newFieldMask("uuid", "float_value"), }, { name: "NonStandardMessage", msg: &examplepb.NonStandardMessage{}, input: `{"id":"foo", "thing":{"subThing":{"sub_value":"bar"}}}`, expected: newFieldMask("id", "thing.subThing.sub_value"), }, { name: "NonStandardMessageWithJSONNames", msg: &examplepb.NonStandardMessageWithJSONNames{}, input: `{"ID":"foo", "Thingy":{"SubThing":{"sub_Value":"bar"}}}`, expected: newFieldMask("id", "thing.subThing.sub_value"), }, { name: "nested", msg: &examplepb.ABitOfEverything{}, input: `{"single_nested": {"name":"bob", "amount": 2}, "uuid":"1234"}`, expected: newFieldMask("single_nested.name", "single_nested.amount", "uuid"), }, { name: "struct", msg: &examplepb.NonStandardMessage{}, input: `{"struct_field": {"name":{"first": "bob"}, "amount": 2}}`, expected: newFieldMask("struct_field.name.first", "struct_field.amount"), }, { name: "NonStandardMessageWithJSONNamesForStruct", msg: &examplepb.NonStandardMessage{}, input: `{"lineNum": 123, "structField": {"name":"bob"}}`, expected: newFieldMask("line_num", "struct_field.name"), }, { name: "value", msg: &examplepb.NonStandardMessage{}, input: `{"value_field": {"name":{"first": "bob"}, "amount": 2}}`, expected: newFieldMask("value_field.name.first", "value_field.amount"), }, { name: "map", msg: &examplepb.ABitOfEverything{}, input: `{"mapped_string_value": {"a": "x"}}`, expected: newFieldMask("mapped_string_value"), }, { name: "deeply-nested", msg: &examplepb.NestedOuter{}, input: `{"one":{"two":{"three":{"a":true, "b":false}}}}`, expected: newFieldMask("one.two.three.a", "one.two.three.b"), }, { name: "complex", input: ` { "single_nested": { "name": "bar", "amount": 10, "ok": "TRUE" }, "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ { "name": "bar", "amount": 10 }, { "name": "baz", "amount": 20 } ], "float_value": 1.5, "double_value": 2.5, "int64_value": 4294967296, "int64_override_type": 12345, "int32_value": -2147483648, "uint64_value": 9223372036854775807, "uint32_value": 4294967295, "fixed64_value": 9223372036854775807, "fixed32_value": 4294967295, "sfixed64_value": -4611686018427387904, "sfixed32_value": 2147483647, "sint64_value": 4611686018427387903, "sint32_value": 2147483647, "bool_value": true, "string_value": "strprefix/foo", "bytes_value": "132456", "enum_value": "ONE", "oneof_string": "x", "nonConventionalNameValue": "camelCase", "timestamp_value": "2016-05-10T10:19:13.123Z", "enum_value_annotation": "ONE", "nested_annotation": { "name": "hoge", "amount": 10 } } `, msg: &examplepb.ABitOfEverything{}, expected: newFieldMask( "single_nested.name", "single_nested.amount", "single_nested.ok", "uuid", "float_value", "double_value", "int64_value", "int64_override_type", "int32_value", "uint64_value", "uint32_value", "fixed64_value", "fixed32_value", "sfixed64_value", "sfixed32_value", "sint64_value", "sint32_value", "bool_value", "string_value", "bytes_value", "enum_value", "oneof_string", "nonConventionalNameValue", "timestamp_value", "enum_value_annotation", "nested_annotation.name", "nested_annotation.amount", "nested", ), }, { name: "protobuf-any", msg: &examplepb.ABitOfEverything{}, input: `{"anytype":{"@type": "xx.xx/examplepb.NestedOuter", "one":{"two":{"three":{"a":true, "b":false}}}}}`, expected: newFieldMask("anytype"), //going deeper makes no sense }, { name: "repeated-protobuf-any", msg: &examplepb.ABitOfEverything{}, input: `{"repeated_anytype":[{"@type": "xx.xx/examplepb.NestedOuter", "one":{"two":{"three":{"a":true, "b":false}}}}]}`, expected: newFieldMask("repeated_anytype"), //going deeper makes no sense }, } { t.Run(tc.name, func(t *testing.T) { actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input)), tc.msg) if err != nil { t.Fatalf("unexpected error: %v", err) } if diff := cmp.Diff(tc.expected, actual, protocmp.Transform(), cmpopts.SortSlices(func(x, y string) bool { return x < y })); diff != "" { t.Errorf("field masks differed:\n%s", diff) } }) } } func TestFieldMaskRepeatedFieldsLast(t *testing.T) { for _, tc := range []struct { name string input string expected *field_mask.FieldMask }{ { name: "map", input: `{"mapped_string_value": {"a": "x"}, "repeated_string_value": {"b": "y"}, "uuid":"1234"}`, expected: &field_mask.FieldMask{ Paths: []string{ "mapped_string_value", "repeated_string_value", "uuid", }, }, }, { name: "slice", input: ` { "nested": [ { "name": "bar", "amount": 10 }, { "name": "baz", "amount": 20 } ], "nested_annotation": [ { "name": "foo", "amount": 100 }, { "name": "widget", "amount": 200 } ], "uuid":"1234" }`, expected: &field_mask.FieldMask{ Paths: []string{ "nested", "nested_annotation", "uuid", }, }, }, } { t.Run(tc.name, func(t *testing.T) { actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input)), &examplepb.ABitOfEverything{}) if err != nil { t.Fatalf("unexpected error: %v", err) } if diff := cmp.Diff(tc.expected, actual, protocmp.Transform()); diff != "" { t.Errorf("field masks differed:\n%s", diff) } }) } } func TestFieldMaskErrors(t *testing.T) { for _, tc := range []struct { name string input string expectedErr error }{ { name: "object under scalar", input: `{"uuid": {"a": "x"}}`, expectedErr: errors.New("JSON structure did not match request type"), }, } { t.Run(tc.name, func(t *testing.T) { _, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input)), &examplepb.ABitOfEverything{}) if err.Error() != tc.expectedErr.Error() { t.Fatalf("errors did not match: got %q, wanted %q", err, tc.expectedErr) } }) } } // avoid compiler optimising benchmark away var result *field_mask.FieldMask func BenchmarkABEFieldMaskFromRequestBody(b *testing.B) { input := `{` + `"single_nested": {"name": "bar",` + ` "amount": 10,` + ` "ok": "TRUE"},` + `"uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7",` + `"nested": [{"name": "bar",` + ` "amount": 10},` + ` {"name": "baz",` + ` "amount": 20}],` + `"float_value": 1.5,` + `"double_value": 2.5,` + `"int64_value": 4294967296,` + `"uint64_value": 9223372036854775807,` + `"int32_value": -2147483648,` + `"fixed64_value": 9223372036854775807,` + `"fixed32_value": 4294967295,` + `"bool_value": true,` + `"string_value": "strprefix/foo",` + `"bytes_value": "132456",` + `"uint32_value": 4294967295,` + `"enum_value": "ONE",` + `"path_enum_value": "DEF",` + `"nested_path_enum_value": "JKL",` + `"sfixed32_value": 2147483647,` + `"sfixed64_value": -4611686018427387904,` + `"sint32_value": 2147483647,` + `"sint64_value": 4611686018427387903,` + `"repeated_string_value": ["a", "b", "c"],` + `"oneof_value": {"oneof_string":"x"},` + `"map_value": {"a": "ONE",` + ` "b": "ZERO"},` + `"mapped_string_value": {"a": "x",` + ` "b": "y"},` + `"mapped_nested_value": {"a": {"name": "x", "amount": 1},` + ` "b": {"name": "y", "amount": 2}},` + `"nonConventionalNameValue": "camelCase",` + `"timestamp_value": "2016-05-10T10:19:13.123Z",` + `"repeated_enum_value": ["ONE", "ZERO"],` + `"repeated_enum_annotation": ["ONE", "ZERO"],` + `"enum_value_annotation": "ONE",` + `"repeated_string_annotation": ["a", "b"],` + `"repeated_nested_annotation": [{"name": "hoge",` + ` "amount": 10},` + ` {"name": "fuga",` + ` "amount": 20}],` + `"nested_annotation": {"name": "hoge",` + ` "amount": 10},` + `"int64_override_type": 12345` + `}` var r *field_mask.FieldMask var err error for i := 0; i < b.N; i++ { r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), nil) } if err != nil { b.Error(err) } result = r } func BenchmarkNonStandardFieldMaskFromRequestBody(b *testing.B) { input := `{` + `"id": "foo",` + `"Num": 2,` + `"line_num": 3,` + `"langIdent": "bar",` + `"STATUS": "baz"` + `}` var r *field_mask.FieldMask var err error for i := 0; i < b.N; i++ { r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), nil) } if err != nil { b.Error(err) } result = r } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/handler.go000066400000000000000000000156041465037340600253210ustar00rootroot00000000000000package runtime import ( "context" "errors" "io" "net/http" "net/textproto" "strconv" "strings" "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // ForwardResponseStream forwards the stream from gRPC server to REST client. func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { rc := http.NewResponseController(w) md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Error("Failed to extract ServerMetadata from context") http.Error(w, "unexpected error", http.StatusInternalServerError) return } handleForwardResponseServerMetadata(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil { HTTPError(ctx, mux, marshaler, w, req, err) return } var delimiter []byte if d, ok := marshaler.(Delimited); ok { delimiter = d.Delimiter() } else { delimiter = []byte("\n") } var wroteHeader bool for { resp, err := recv() if errors.Is(err, io.EOF) { return } if err != nil { handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } if !wroteHeader { w.Header().Set("Content-Type", marshaler.ContentType(resp)) } var buf []byte httpBody, isHTTPBody := resp.(*httpbody.HttpBody) switch { case resp == nil: buf, err = marshaler.Marshal(errorChunk(status.New(codes.Internal, "empty response"))) case isHTTPBody: buf = httpBody.GetData() default: result := map[string]interface{}{"result": resp} if rb, ok := resp.(responseBody); ok { result["result"] = rb.XXX_ResponseBody() } buf, err = marshaler.Marshal(result) } if err != nil { grpclog.Errorf("Failed to marshal response chunk: %v", err) handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } if _, err := w.Write(buf); err != nil { grpclog.Errorf("Failed to send response chunk: %v", err) return } wroteHeader = true if _, err := w.Write(delimiter); err != nil { grpclog.Errorf("Failed to send delimiter chunk: %v", err) return } err = rc.Flush() if err != nil { if errors.Is(err, http.ErrNotSupported) { grpclog.Errorf("Flush not supported in %T", w) http.Error(w, "unexpected type of web server", http.StatusInternalServerError) return } grpclog.Errorf("Failed to flush response to client: %v", err) return } } } func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k, vs := range md.HeaderMD { if h, ok := mux.outgoingHeaderMatcher(k); ok { for _, v := range vs { w.Header().Add(h, v) } } } } func handleForwardResponseTrailerHeader(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k := range md.TrailerMD { if h, ok := mux.outgoingTrailerMatcher(k); ok { w.Header().Add("Trailer", textproto.CanonicalMIMEHeaderKey(h)) } } } func handleForwardResponseTrailer(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k, vs := range md.TrailerMD { if h, ok := mux.outgoingTrailerMatcher(k); ok { for _, v := range vs { w.Header().Add(h, v) } } } } // responseBody interface contains method for getting field for marshaling to the response body // this method is generated for response struct from the value of `response_body` in the `google.api.HttpRule` type responseBody interface { XXX_ResponseBody() interface{} } // ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Error("Failed to extract ServerMetadata from context") } handleForwardResponseServerMetadata(w, mux, md) // RFC 7230 https://tools.ietf.org/html/rfc7230#section-4.1.2 // Unless the request includes a TE header field indicating "trailers" // is acceptable, as described in Section 4.3, a server SHOULD NOT // generate trailer fields that it believes are necessary for the user // agent to receive. doForwardTrailers := requestAcceptsTrailers(req) if doForwardTrailers { handleForwardResponseTrailerHeader(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") } contentType := marshaler.ContentType(resp) w.Header().Set("Content-Type", contentType) if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { HTTPError(ctx, mux, marshaler, w, req, err) return } var buf []byte var err error if rb, ok := resp.(responseBody); ok { buf, err = marshaler.Marshal(rb.XXX_ResponseBody()) } else { buf, err = marshaler.Marshal(resp) } if err != nil { grpclog.Errorf("Marshal error: %v", err) HTTPError(ctx, mux, marshaler, w, req, err) return } if !doForwardTrailers { w.Header().Set("Content-Length", strconv.Itoa(len(buf))) } if _, err = w.Write(buf); err != nil { grpclog.Errorf("Failed to write response: %v", err) } if doForwardTrailers { handleForwardResponseTrailer(w, mux, md) } } func requestAcceptsTrailers(req *http.Request) bool { te := req.Header.Get("TE") return strings.Contains(strings.ToLower(te), "trailers") } func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, resp proto.Message, opts []func(context.Context, http.ResponseWriter, proto.Message) error) error { if len(opts) == 0 { return nil } for _, opt := range opts { if err := opt(ctx, w, resp); err != nil { grpclog.Errorf("Error handling ForwardResponseOptions: %v", err) return err } } return nil } func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, req *http.Request, mux *ServeMux, err error, delimiter []byte) { st := mux.streamErrorHandler(ctx, err) msg := errorChunk(st) if !wroteHeader { w.Header().Set("Content-Type", marshaler.ContentType(msg)) w.WriteHeader(HTTPStatusFromCode(st.Code())) } buf, err := marshaler.Marshal(msg) if err != nil { grpclog.Errorf("Failed to marshal an error: %v", err) return } if _, err := w.Write(buf); err != nil { grpclog.Errorf("Failed to notify error to client: %v", err) return } if _, err := w.Write(delimiter); err != nil { grpclog.Errorf("Failed to send delimiter chunk: %v", err) return } } func errorChunk(st *status.Status) map[string]proto.Message { return map[string]proto.Message{"error": st.Proto()} } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/handler_test.go000066400000000000000000000327551465037340600263660ustar00rootroot00000000000000package runtime_test import ( "context" "io" "net/http" "net/http/httptest" "reflect" "sort" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" pb "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) type fakeReponseBodyWrapper struct { proto.Message } // XXX_ResponseBody returns id of SimpleMessage func (r fakeReponseBodyWrapper) XXX_ResponseBody() interface{} { resp := r.Message.(*pb.SimpleMessage) return resp.Id } func TestForwardResponseStream(t *testing.T) { type msg struct { pb proto.Message err error } tests := []struct { name string msgs []msg statusCode int responseBody bool }{{ name: "encoding", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {&pb.SimpleMessage{Id: "Two"}, nil}, }, statusCode: http.StatusOK, }, { name: "empty", statusCode: http.StatusOK, }, { name: "error", msgs: []msg{{nil, status.Errorf(codes.OutOfRange, "400")}}, statusCode: http.StatusBadRequest, }, { name: "stream_error", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {nil, status.Errorf(codes.OutOfRange, "400")}, }, statusCode: http.StatusOK, }, { name: "response body stream case", msgs: []msg{ {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "Two"}}, nil}, }, responseBody: true, statusCode: http.StatusOK, }, { name: "response body stream error case", msgs: []msg{ {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, {nil, status.Errorf(codes.OutOfRange, "400")}, }, responseBody: true, statusCode: http.StatusOK, }} newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { var count int return func() (proto.Message, error) { if count == len(msgs) { return nil, io.EOF } else if count > len(msgs) { t.Errorf("recv() called %d times for %d messages", count, len(msgs)) } count++ msg := msgs[count-1] return msg.pb, msg.err } } ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) marshaler := &runtime.JSONPb{} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { recv := newTestRecv(t, tt.msgs) req := httptest.NewRequest("GET", "http://example.com/foo", nil) resp := httptest.NewRecorder() runtime.ForwardResponseStream(ctx, runtime.NewServeMux(), marshaler, resp, req, recv) w := resp.Result() if w.StatusCode != tt.statusCode { t.Errorf("StatusCode %d want %d", w.StatusCode, tt.statusCode) } if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { t.Errorf("ForwardResponseStream missing header chunked") } body, err := io.ReadAll(w.Body) if err != nil { t.Errorf("Failed to read response body with %v", err) } w.Body.Close() if len(body) > 0 && w.Header.Get("Content-Type") != "application/json" { t.Errorf("Content-Type %s want application/json", w.Header.Get("Content-Type")) } var want []byte for i, msg := range tt.msgs { if msg.err != nil { if i == 0 { // Skip non-stream errors t.Skip("checking error encodings") } delimiter := marshaler.Delimiter() st := status.Convert(msg.err) b, err := marshaler.Marshal(map[string]proto.Message{ "error": st.Proto(), }) if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } errBytes := body[len(want):] if string(errBytes) != string(b)+string(delimiter) { t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", errBytes, b) } return } var b []byte if tt.responseBody { // responseBody interface is in runtime package and test is in runtime_test package. hence can't use responseBody directly // So type casting to fakeReponseBodyWrapper struct to verify the data. rb, ok := msg.pb.(fakeReponseBodyWrapper) if !ok { t.Errorf("stream responseBody failed %v", err) } b, err = marshaler.Marshal(map[string]interface{}{"result": rb.XXX_ResponseBody()}) } else { b, err = marshaler.Marshal(map[string]interface{}{"result": msg.pb}) } if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } want = append(want, b...) want = append(want, marshaler.Delimiter()...) } if string(body) != string(want) { t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) } }) } } // A custom marshaler implementation, that doesn't implement the delimited interface type CustomMarshaler struct { m *runtime.JSONPb } func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } func (c *CustomMarshaler) ContentType(v interface{}) string { return "Custom-Content-Type" } func TestForwardResponseStreamCustomMarshaler(t *testing.T) { type msg struct { pb proto.Message err error } tests := []struct { name string msgs []msg statusCode int }{{ name: "encoding", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {&pb.SimpleMessage{Id: "Two"}, nil}, }, statusCode: http.StatusOK, }, { name: "empty", statusCode: http.StatusOK, }, { name: "error", msgs: []msg{{nil, status.Errorf(codes.OutOfRange, "400")}}, statusCode: http.StatusBadRequest, }, { name: "stream_error", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {nil, status.Errorf(codes.OutOfRange, "400")}, }, statusCode: http.StatusOK, }} newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { var count int return func() (proto.Message, error) { if count == len(msgs) { return nil, io.EOF } else if count > len(msgs) { t.Errorf("recv() called %d times for %d messages", count, len(msgs)) } count++ msg := msgs[count-1] return msg.pb, msg.err } } ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) marshaler := &CustomMarshaler{&runtime.JSONPb{}} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { recv := newTestRecv(t, tt.msgs) req := httptest.NewRequest("GET", "http://example.com/foo", nil) resp := httptest.NewRecorder() runtime.ForwardResponseStream(ctx, runtime.NewServeMux(), marshaler, resp, req, recv) w := resp.Result() if w.StatusCode != tt.statusCode { t.Errorf("StatusCode %d want %d", w.StatusCode, tt.statusCode) } if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { t.Errorf("ForwardResponseStream missing header chunked") } body, err := io.ReadAll(w.Body) if err != nil { t.Errorf("Failed to read response body with %v", err) } w.Body.Close() if len(body) > 0 && w.Header.Get("Content-Type") != "Custom-Content-Type" { t.Errorf("Content-Type %s want Custom-Content-Type", w.Header.Get("Content-Type")) } var want []byte for _, msg := range tt.msgs { if msg.err != nil { t.Skip("checking erorr encodings") } b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } want = append(want, b...) want = append(want, "\n"...) } if string(body) != string(want) { t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) } }) } } func TestForwardResponseMessage(t *testing.T) { msg := &pb.SimpleMessage{Id: "One"} tests := []struct { name string marshaler runtime.Marshaler contentType string }{{ name: "standard marshaler", marshaler: &runtime.JSONPb{}, contentType: "application/json", }, { name: "httpbody marshaler", marshaler: &runtime.HTTPBodyMarshaler{&runtime.JSONPb{}}, contentType: "application/json", }, { name: "custom marshaler", marshaler: &CustomMarshaler{&runtime.JSONPb{}}, contentType: "Custom-Content-Type", }} ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { req := httptest.NewRequest("GET", "http://example.com/foo", nil) resp := httptest.NewRecorder() runtime.ForwardResponseMessage(ctx, runtime.NewServeMux(), tt.marshaler, resp, req, msg) w := resp.Result() if w.StatusCode != http.StatusOK { t.Errorf("StatusCode %d want %d", w.StatusCode, http.StatusOK) } if h := w.Header.Get("Content-Type"); h != tt.contentType { t.Errorf("Content-Type %v want %v", h, tt.contentType) } body, err := io.ReadAll(w.Body) if err != nil { t.Errorf("Failed to read response body with %v", err) } w.Body.Close() want, err := tt.marshaler.Marshal(msg) if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } if string(body) != string(want) { t.Errorf("ForwardResponseMessage() = \"%s\" want \"%s\"", body, want) } }) } } func TestOutgoingHeaderMatcher(t *testing.T) { t.Parallel() msg := &pb.SimpleMessage{Id: "foo"} for _, tc := range []struct { name string md runtime.ServerMetadata headers http.Header matcher runtime.HeaderMatcherFunc }{ { name: "default matcher", md: runtime.ServerMetadata{ HeaderMD: metadata.Pairs( "foo", "bar", "baz", "qux", ), }, headers: http.Header{ "Content-Length": []string{"12"}, "Content-Type": []string{"application/json"}, "Grpc-Metadata-Foo": []string{"bar"}, "Grpc-Metadata-Baz": []string{"qux"}, }, }, { name: "custom matcher", md: runtime.ServerMetadata{ HeaderMD: metadata.Pairs( "foo", "bar", "baz", "qux", ), }, headers: http.Header{ "Content-Length": []string{"12"}, "Content-Type": []string{"application/json"}, "Custom-Foo": []string{"bar"}, }, matcher: func(key string) (string, bool) { switch key { case "foo": return "custom-foo", true default: return "", false } }, }, } { tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() ctx := runtime.NewServerMetadataContext(context.Background(), tc.md) req := httptest.NewRequest("GET", "http://example.com/foo", nil) resp := httptest.NewRecorder() runtime.ForwardResponseMessage(ctx, runtime.NewServeMux(runtime.WithOutgoingHeaderMatcher(tc.matcher)), &runtime.JSONPb{}, resp, req, msg) w := resp.Result() defer w.Body.Close() if w.StatusCode != http.StatusOK { t.Fatalf("StatusCode %d want %d", w.StatusCode, http.StatusOK) } if !reflect.DeepEqual(w.Header, tc.headers) { t.Fatalf("Header %v want %v", w.Header, tc.headers) } }) } } func TestOutgoingTrailerMatcher(t *testing.T) { t.Parallel() msg := &pb.SimpleMessage{Id: "foo"} for _, tc := range []struct { name string md runtime.ServerMetadata caller http.Header headers http.Header trailer http.Header matcher runtime.HeaderMatcherFunc }{ { name: "default matcher, caller accepts", md: runtime.ServerMetadata{ TrailerMD: metadata.Pairs( "foo", "bar", "baz", "qux", ), }, caller: http.Header{ "Te": []string{"trailers"}, }, headers: http.Header{ "Transfer-Encoding": []string{"chunked"}, "Content-Type": []string{"application/json"}, "Trailer": []string{"Grpc-Trailer-Baz", "Grpc-Trailer-Foo"}, }, trailer: http.Header{ "Grpc-Trailer-Foo": []string{"bar"}, "Grpc-Trailer-Baz": []string{"qux"}, }, }, { name: "default matcher, caller rejects", md: runtime.ServerMetadata{ TrailerMD: metadata.Pairs( "foo", "bar", "baz", "qux", ), }, headers: http.Header{ "Content-Length": []string{"12"}, "Content-Type": []string{"application/json"}, }, }, { name: "custom matcher", md: runtime.ServerMetadata{ TrailerMD: metadata.Pairs( "foo", "bar", "baz", "qux", ), }, caller: http.Header{ "Te": []string{"trailers"}, }, headers: http.Header{ "Transfer-Encoding": []string{"chunked"}, "Content-Type": []string{"application/json"}, "Trailer": []string{"Custom-Trailer-Foo"}, }, trailer: http.Header{ "Custom-Trailer-Foo": []string{"bar"}, }, matcher: func(key string) (string, bool) { switch key { case "foo": return "custom-trailer-foo", true default: return "", false } }, }, } { tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() ctx := runtime.NewServerMetadataContext(context.Background(), tc.md) req := httptest.NewRequest("GET", "http://example.com/foo", nil) req.Header = tc.caller resp := httptest.NewRecorder() runtime.ForwardResponseMessage(ctx, runtime.NewServeMux(runtime.WithOutgoingTrailerMatcher(tc.matcher)), &runtime.JSONPb{}, resp, req, msg) w := resp.Result() _, _ = io.Copy(io.Discard, w.Body) defer w.Body.Close() if w.StatusCode != http.StatusOK { t.Fatalf("StatusCode %d want %d", w.StatusCode, http.StatusOK) } // Sort to the trailer headers to ensure the test is deterministic sort.Strings(w.Header["Trailer"]) if !reflect.DeepEqual(w.Header, tc.headers) { t.Fatalf("Header %v want %v", w.Header, tc.headers) } if !reflect.DeepEqual(w.Trailer, tc.trailer) { t.Fatalf("Trailer %v want %v", w.Trailer, tc.trailer) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/000077500000000000000000000000001465037340600251635ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/000077500000000000000000000000001465037340600271405ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/BUILD.bazel000066400000000000000000000027021465037340600310170ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") # gazelle:exclude non_standard_names_grpc.pb.go package(default_visibility = ["//visibility:public"]) proto_library( name = "examplepb_proto", srcs = [ "example.proto", "non_standard_names.proto", "proto2.proto", "proto3.proto", ], deps = [ "@com_google_protobuf//:any_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:struct_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", "@googleapis//google/api:annotations_proto", ], ) go_proto_library( name = "examplepb_go_proto", compilers = [ "//:go_apiv2", "//:go_grpc", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb", proto = ":examplepb_proto", deps = [ "@org_golang_google_genproto_googleapis_api//annotations", ], ) go_library( name = "examplepb", embed = [":examplepb_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb", ) alias( name = "go_default_library", actual = ":examplepb", visibility = ["//runtime:__subpackages__"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/example.pb.go000066400000000000000000002177721465037340600315420ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: runtime/internal/examplepb/example.proto package examplepb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" emptypb "google.golang.org/protobuf/types/known/emptypb" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 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) ) // NumericEnum is one or zero. type NumericEnum int32 const ( // ZERO means 0 NumericEnum_ZERO NumericEnum = 0 // ONE means 1 NumericEnum_ONE NumericEnum = 1 ) // Enum value maps for NumericEnum. var ( NumericEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", } NumericEnum_value = map[string]int32{ "ZERO": 0, "ONE": 1, } ) func (x NumericEnum) Enum() *NumericEnum { p := new(NumericEnum) *p = x return p } func (x NumericEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (NumericEnum) Descriptor() protoreflect.EnumDescriptor { return file_runtime_internal_examplepb_example_proto_enumTypes[0].Descriptor() } func (NumericEnum) Type() protoreflect.EnumType { return &file_runtime_internal_examplepb_example_proto_enumTypes[0] } func (x NumericEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use NumericEnum.Descriptor instead. func (NumericEnum) EnumDescriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{0} } // DeepEnum is one or zero. type ABitOfEverything_Nested_DeepEnum int32 const ( // FALSE is false. ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0 // TRUE is true. ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 ) // Enum value maps for ABitOfEverything_Nested_DeepEnum. var ( ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ 0: "FALSE", 1: "TRUE", } ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ "FALSE": 0, "TRUE": 1, } ) func (x ABitOfEverything_Nested_DeepEnum) Enum() *ABitOfEverything_Nested_DeepEnum { p := new(ABitOfEverything_Nested_DeepEnum) *p = x return p } func (x ABitOfEverything_Nested_DeepEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (ABitOfEverything_Nested_DeepEnum) Descriptor() protoreflect.EnumDescriptor { return file_runtime_internal_examplepb_example_proto_enumTypes[1].Descriptor() } func (ABitOfEverything_Nested_DeepEnum) Type() protoreflect.EnumType { return &file_runtime_internal_examplepb_example_proto_enumTypes[1] } func (x ABitOfEverything_Nested_DeepEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use ABitOfEverything_Nested_DeepEnum.Descriptor instead. func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{1, 0, 0} } type RepeatedResponseBodyOut_Response_ResponseType int32 const ( // UNKNOWN RepeatedResponseBodyOut_Response_UNKNOWN RepeatedResponseBodyOut_Response_ResponseType = 0 // A is 1 RepeatedResponseBodyOut_Response_A RepeatedResponseBodyOut_Response_ResponseType = 1 // B is 2 RepeatedResponseBodyOut_Response_B RepeatedResponseBodyOut_Response_ResponseType = 2 ) // Enum value maps for RepeatedResponseBodyOut_Response_ResponseType. var ( RepeatedResponseBodyOut_Response_ResponseType_name = map[int32]string{ 0: "UNKNOWN", 1: "A", 2: "B", } RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ "UNKNOWN": 0, "A": 1, "B": 2, } ) func (x RepeatedResponseBodyOut_Response_ResponseType) Enum() *RepeatedResponseBodyOut_Response_ResponseType { p := new(RepeatedResponseBodyOut_Response_ResponseType) *p = x return p } func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (RepeatedResponseBodyOut_Response_ResponseType) Descriptor() protoreflect.EnumDescriptor { return file_runtime_internal_examplepb_example_proto_enumTypes[2].Descriptor() } func (RepeatedResponseBodyOut_Response_ResponseType) Type() protoreflect.EnumType { return &file_runtime_internal_examplepb_example_proto_enumTypes[2] } func (x RepeatedResponseBodyOut_Response_ResponseType) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use RepeatedResponseBodyOut_Response_ResponseType.Descriptor instead. func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{3, 0, 0} } // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *SimpleMessage) Reset() { *x = SimpleMessage{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SimpleMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*SimpleMessage) ProtoMessage() {} func (x *SimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 SimpleMessage.ProtoReflect.Descriptor instead. func (*SimpleMessage) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{0} } func (x *SimpleMessage) GetId() string { if x != nil { return x.Id } return "" } type ABitOfEverything struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested,proto3" json:"nested,omitempty"` FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value,proto3" json:"fixed64_value,omitempty"` Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value,proto3" json:"fixed32_value,omitempty"` BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"enum_value,omitempty"` Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value,proto3" json:"sint64_value,omitempty"` RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue,proto3" json:"repeated_string_value,omitempty"` // Types that are assignable to OneofValue: // // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum"` MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` TimestampValue *timestamppb.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` // repeated numeric enum comment (This comment is overridden by the field // annotation) RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` // numeric enum comment (This comment is overridden by the field annotation) EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` // repeated string comment (This comment is overridden by the field // annotation) RepeatedStringAnnotation []string `protobuf:"bytes,34,rep,name=repeated_string_annotation,json=repeatedStringAnnotation,proto3" json:"repeated_string_annotation,omitempty"` // repeated nested object comment (This comment is overridden by the field // annotation) RepeatedNestedAnnotation []*ABitOfEverything_Nested `protobuf:"bytes,35,rep,name=repeated_nested_annotation,json=repeatedNestedAnnotation,proto3" json:"repeated_nested_annotation,omitempty"` // nested object comments (This comment is overridden by the field annotation) NestedAnnotation *ABitOfEverything_Nested `protobuf:"bytes,36,opt,name=nested_annotation,json=nestedAnnotation,proto3" json:"nested_annotation,omitempty"` Int64OverrideType int64 `protobuf:"varint,37,opt,name=int64_override_type,json=int64OverrideType,proto3" json:"int64_override_type,omitempty"` Anytype *anypb.Any `protobuf:"bytes,38,opt,name=anytype,proto3" json:"anytype,omitempty"` RepeatedAnytype []*anypb.Any `protobuf:"bytes,39,rep,name=repeated_anytype,json=repeatedAnytype,proto3" json:"repeated_anytype,omitempty"` } func (x *ABitOfEverything) Reset() { *x = ABitOfEverything{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ABitOfEverything) String() string { return protoimpl.X.MessageStringOf(x) } func (*ABitOfEverything) ProtoMessage() {} func (x *ABitOfEverything) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 ABitOfEverything.ProtoReflect.Descriptor instead. func (*ABitOfEverything) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{1} } func (x *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { if x != nil { return x.SingleNested } return nil } func (x *ABitOfEverything) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { if x != nil { return x.Nested } return nil } func (x *ABitOfEverything) GetFloatValue() float32 { if x != nil { return x.FloatValue } return 0 } func (x *ABitOfEverything) GetDoubleValue() float64 { if x != nil { return x.DoubleValue } return 0 } func (x *ABitOfEverything) GetInt64Value() int64 { if x != nil { return x.Int64Value } return 0 } func (x *ABitOfEverything) GetUint64Value() uint64 { if x != nil { return x.Uint64Value } return 0 } func (x *ABitOfEverything) GetInt32Value() int32 { if x != nil { return x.Int32Value } return 0 } func (x *ABitOfEverything) GetFixed64Value() uint64 { if x != nil { return x.Fixed64Value } return 0 } func (x *ABitOfEverything) GetFixed32Value() uint32 { if x != nil { return x.Fixed32Value } return 0 } func (x *ABitOfEverything) GetBoolValue() bool { if x != nil { return x.BoolValue } return false } func (x *ABitOfEverything) GetStringValue() string { if x != nil { return x.StringValue } return "" } func (x *ABitOfEverything) GetBytesValue() []byte { if x != nil { return x.BytesValue } return nil } func (x *ABitOfEverything) GetUint32Value() uint32 { if x != nil { return x.Uint32Value } return 0 } func (x *ABitOfEverything) GetEnumValue() NumericEnum { if x != nil { return x.EnumValue } return NumericEnum_ZERO } func (x *ABitOfEverything) GetSfixed32Value() int32 { if x != nil { return x.Sfixed32Value } return 0 } func (x *ABitOfEverything) GetSfixed64Value() int64 { if x != nil { return x.Sfixed64Value } return 0 } func (x *ABitOfEverything) GetSint32Value() int32 { if x != nil { return x.Sint32Value } return 0 } func (x *ABitOfEverything) GetSint64Value() int64 { if x != nil { return x.Sint64Value } return 0 } func (x *ABitOfEverything) GetRepeatedStringValue() []string { if x != nil { return x.RepeatedStringValue } return nil } func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { if m != nil { return m.OneofValue } return nil } func (x *ABitOfEverything) GetOneofEmpty() *emptypb.Empty { if x, ok := x.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty } return nil } func (x *ABitOfEverything) GetOneofString() string { if x, ok := x.GetOneofValue().(*ABitOfEverything_OneofString); ok { return x.OneofString } return "" } func (x *ABitOfEverything) GetMapValue() map[string]NumericEnum { if x != nil { return x.MapValue } return nil } func (x *ABitOfEverything) GetMappedStringValue() map[string]string { if x != nil { return x.MappedStringValue } return nil } func (x *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested { if x != nil { return x.MappedNestedValue } return nil } func (x *ABitOfEverything) GetNonConventionalNameValue() string { if x != nil { return x.NonConventionalNameValue } return "" } func (x *ABitOfEverything) GetTimestampValue() *timestamppb.Timestamp { if x != nil { return x.TimestampValue } return nil } func (x *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { if x != nil { return x.RepeatedEnumValue } return nil } func (x *ABitOfEverything) GetRepeatedEnumAnnotation() []NumericEnum { if x != nil { return x.RepeatedEnumAnnotation } return nil } func (x *ABitOfEverything) GetEnumValueAnnotation() NumericEnum { if x != nil { return x.EnumValueAnnotation } return NumericEnum_ZERO } func (x *ABitOfEverything) GetRepeatedStringAnnotation() []string { if x != nil { return x.RepeatedStringAnnotation } return nil } func (x *ABitOfEverything) GetRepeatedNestedAnnotation() []*ABitOfEverything_Nested { if x != nil { return x.RepeatedNestedAnnotation } return nil } func (x *ABitOfEverything) GetNestedAnnotation() *ABitOfEverything_Nested { if x != nil { return x.NestedAnnotation } return nil } func (x *ABitOfEverything) GetInt64OverrideType() int64 { if x != nil { return x.Int64OverrideType } return 0 } func (x *ABitOfEverything) GetAnytype() *anypb.Any { if x != nil { return x.Anytype } return nil } func (x *ABitOfEverything) GetRepeatedAnytype() []*anypb.Any { if x != nil { return x.RepeatedAnytype } return nil } type isABitOfEverything_OneofValue interface { isABitOfEverything_OneofValue() } type ABitOfEverything_OneofEmpty struct { OneofEmpty *emptypb.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` } type ABitOfEverything_OneofString struct { OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` } func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} type ResponseBodyOut struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` } func (x *ResponseBodyOut) Reset() { *x = ResponseBodyOut{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ResponseBodyOut) String() string { return protoimpl.X.MessageStringOf(x) } func (*ResponseBodyOut) ProtoMessage() {} func (x *ResponseBodyOut) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 ResponseBodyOut.ProtoReflect.Descriptor instead. func (*ResponseBodyOut) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{2} } func (x *ResponseBodyOut) GetResponse() *ResponseBodyOut_Response { if x != nil { return x.Response } return nil } type RepeatedResponseBodyOut struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Response []*RepeatedResponseBodyOut_Response `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"` } func (x *RepeatedResponseBodyOut) Reset() { *x = RepeatedResponseBodyOut{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RepeatedResponseBodyOut) String() string { return protoimpl.X.MessageStringOf(x) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (x *RepeatedResponseBodyOut) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 RepeatedResponseBodyOut.ProtoReflect.Descriptor instead. func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{3} } func (x *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Response { if x != nil { return x.Response } return nil } type UpdateMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,1,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` ABitOfEverything *ABitOfEverything `protobuf:"bytes,2,opt,name=a_bit_of_everything,json=aBitOfEverything,proto3" json:"a_bit_of_everything,omitempty"` } func (x *UpdateMessage) Reset() { *x = UpdateMessage{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UpdateMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*UpdateMessage) ProtoMessage() {} func (x *UpdateMessage) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 UpdateMessage.ProtoReflect.Descriptor instead. func (*UpdateMessage) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{4} } func (x *UpdateMessage) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } func (x *UpdateMessage) GetABitOfEverything() *ABitOfEverything { if x != nil { return x.ABitOfEverything } return nil } type NestedOuter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields One *NestedOne `protobuf:"bytes,1,opt,name=one,proto3" json:"one,omitempty"` } func (x *NestedOuter) Reset() { *x = NestedOuter{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedOuter) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedOuter) ProtoMessage() {} func (x *NestedOuter) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 NestedOuter.ProtoReflect.Descriptor instead. func (*NestedOuter) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{5} } func (x *NestedOuter) GetOne() *NestedOne { if x != nil { return x.One } return nil } type NestedOne struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Two *NestedTwo `protobuf:"bytes,1,opt,name=two,proto3" json:"two,omitempty"` } func (x *NestedOne) Reset() { *x = NestedOne{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedOne) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedOne) ProtoMessage() {} func (x *NestedOne) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 NestedOne.ProtoReflect.Descriptor instead. func (*NestedOne) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{6} } func (x *NestedOne) GetTwo() *NestedTwo { if x != nil { return x.Two } return nil } type NestedTwo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Three *NestedThree `protobuf:"bytes,1,opt,name=three,proto3" json:"three,omitempty"` } func (x *NestedTwo) Reset() { *x = NestedTwo{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedTwo) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedTwo) ProtoMessage() {} func (x *NestedTwo) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 NestedTwo.ProtoReflect.Descriptor instead. func (*NestedTwo) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{7} } func (x *NestedTwo) GetThree() *NestedThree { if x != nil { return x.Three } return nil } type NestedThree struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields A bool `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` B bool `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"` } func (x *NestedThree) Reset() { *x = NestedThree{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NestedThree) String() string { return protoimpl.X.MessageStringOf(x) } func (*NestedThree) ProtoMessage() {} func (x *NestedThree) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 NestedThree.ProtoReflect.Descriptor instead. func (*NestedThree) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{8} } func (x *NestedThree) GetA() bool { if x != nil { return x.A } return false } func (x *NestedThree) GetB() bool { if x != nil { return x.B } return false } type UpdateNestedRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Nested *NestedOuter `protobuf:"bytes,1,opt,name=nested,proto3" json:"nested,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *UpdateNestedRequest) Reset() { *x = UpdateNestedRequest{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *UpdateNestedRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*UpdateNestedRequest) ProtoMessage() {} func (x *UpdateNestedRequest) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 UpdateNestedRequest.ProtoReflect.Descriptor instead. func (*UpdateNestedRequest) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{9} } func (x *UpdateNestedRequest) GetNested() *NestedOuter { if x != nil { return x.Nested } return nil } func (x *UpdateNestedRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } // Nested is nested type. type ABitOfEverything_Nested struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // name is nested field. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // DeepEnum comment. Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.runtime.internal.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` } func (x *ABitOfEverything_Nested) Reset() { *x = ABitOfEverything_Nested{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ABitOfEverything_Nested) String() string { return protoimpl.X.MessageStringOf(x) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (x *ABitOfEverything_Nested) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_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 ABitOfEverything_Nested.ProtoReflect.Descriptor instead. func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{1, 0} } func (x *ABitOfEverything_Nested) GetName() string { if x != nil { return x.Name } return "" } func (x *ABitOfEverything_Nested) GetAmount() uint32 { if x != nil { return x.Amount } return 0 } func (x *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { if x != nil { return x.Ok } return ABitOfEverything_Nested_FALSE } type ResponseBodyOut_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (x *ResponseBodyOut_Response) Reset() { *x = ResponseBodyOut_Response{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ResponseBodyOut_Response) String() string { return protoimpl.X.MessageStringOf(x) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (x *ResponseBodyOut_Response) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[14] 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 ResponseBodyOut_Response.ProtoReflect.Descriptor instead. func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{2, 0} } func (x *ResponseBodyOut_Response) GetData() string { if x != nil { return x.Data } return "" } type RepeatedResponseBodyOut_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` } func (x *RepeatedResponseBodyOut_Response) Reset() { *x = RepeatedResponseBodyOut_Response{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *RepeatedResponseBodyOut_Response) String() string { return protoimpl.X.MessageStringOf(x) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (x *RepeatedResponseBodyOut_Response) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_example_proto_msgTypes[15] 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 RepeatedResponseBodyOut_Response.ProtoReflect.Descriptor instead. func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_example_proto_rawDescGZIP(), []int{3, 0} } func (x *RepeatedResponseBodyOut_Response) GetData() string { if x != nil { return x.Data } return "" } func (x *RepeatedResponseBodyOut_Response) GetType() RepeatedResponseBodyOut_Response_ResponseType { if x != nil { return x.Type } return RepeatedResponseBodyOut_Response_UNKNOWN } var File_runtime_internal_examplepb_example_proto protoreflect.FileDescriptor var file_runtime_internal_examplepb_example_proto_rawDesc = []byte{ 0x0a, 0x28, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x1f, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xdc, 0x15, 0x0a, 0x10, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x65, 0x0a, 0x0d, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x0c, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x58, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0c, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x07, 0x52, 0x0c, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x53, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x0d, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x10, 0x52, 0x0d, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0b, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0b, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x64, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x13, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x13, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x6e, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x6e, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1b, 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, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x64, 0x0a, 0x13, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1c, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x11, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x6e, 0x0a, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x20, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x68, 0x0a, 0x15, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x13, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x1a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x22, 0x20, 0x03, 0x28, 0x09, 0x52, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x7e, 0x0a, 0x1a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x18, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x6d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x61, 0x6e, 0x79, 0x74, 0x79, 0x70, 0x65, 0x18, 0x26, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x61, 0x6e, 0x79, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6e, 0x79, 0x74, 0x79, 0x70, 0x65, 0x18, 0x27, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x74, 0x79, 0x70, 0x65, 0x1a, 0xb0, 0x01, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x59, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x49, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x65, 0x70, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x1f, 0x0a, 0x08, 0x44, 0x65, 0x65, 0x70, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, 0x1a, 0x71, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, 0x0a, 0x16, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x86, 0x01, 0x0a, 0x16, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x56, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x12, 0x5d, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xb8, 0x02, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x12, 0x65, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x49, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0xb5, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6a, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x56, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x75, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x29, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x22, 0xb6, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x68, 0x0a, 0x13, 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x61, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x53, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x03, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x65, 0x52, 0x03, 0x6f, 0x6e, 0x65, 0x22, 0x51, 0x0a, 0x09, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x74, 0x77, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x77, 0x6f, 0x52, 0x03, 0x74, 0x77, 0x6f, 0x22, 0x57, 0x0a, 0x09, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x77, 0x6f, 0x12, 0x4a, 0x0a, 0x05, 0x74, 0x68, 0x72, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x68, 0x72, 0x65, 0x65, 0x52, 0x05, 0x74, 0x68, 0x72, 0x65, 0x65, 0x22, 0x29, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x68, 0x72, 0x65, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x01, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x01, 0x62, 0x22, 0xa0, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x2a, 0x20, 0x0a, 0x0b, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_runtime_internal_examplepb_example_proto_rawDescOnce sync.Once file_runtime_internal_examplepb_example_proto_rawDescData = file_runtime_internal_examplepb_example_proto_rawDesc ) func file_runtime_internal_examplepb_example_proto_rawDescGZIP() []byte { file_runtime_internal_examplepb_example_proto_rawDescOnce.Do(func() { file_runtime_internal_examplepb_example_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_internal_examplepb_example_proto_rawDescData) }) return file_runtime_internal_examplepb_example_proto_rawDescData } var file_runtime_internal_examplepb_example_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_runtime_internal_examplepb_example_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_runtime_internal_examplepb_example_proto_goTypes = []interface{}{ (NumericEnum)(0), // 0: grpc.gateway.runtime.internal.examplepb.NumericEnum (ABitOfEverything_Nested_DeepEnum)(0), // 1: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested.DeepEnum (RepeatedResponseBodyOut_Response_ResponseType)(0), // 2: grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response.ResponseType (*SimpleMessage)(nil), // 3: grpc.gateway.runtime.internal.examplepb.SimpleMessage (*ABitOfEverything)(nil), // 4: grpc.gateway.runtime.internal.examplepb.ABitOfEverything (*ResponseBodyOut)(nil), // 5: grpc.gateway.runtime.internal.examplepb.ResponseBodyOut (*RepeatedResponseBodyOut)(nil), // 6: grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut (*UpdateMessage)(nil), // 7: grpc.gateway.runtime.internal.examplepb.UpdateMessage (*NestedOuter)(nil), // 8: grpc.gateway.runtime.internal.examplepb.NestedOuter (*NestedOne)(nil), // 9: grpc.gateway.runtime.internal.examplepb.NestedOne (*NestedTwo)(nil), // 10: grpc.gateway.runtime.internal.examplepb.NestedTwo (*NestedThree)(nil), // 11: grpc.gateway.runtime.internal.examplepb.NestedThree (*UpdateNestedRequest)(nil), // 12: grpc.gateway.runtime.internal.examplepb.UpdateNestedRequest (*ABitOfEverything_Nested)(nil), // 13: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested nil, // 14: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MapValueEntry nil, // 15: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedStringValueEntry nil, // 16: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedNestedValueEntry (*ResponseBodyOut_Response)(nil), // 17: grpc.gateway.runtime.internal.examplepb.ResponseBodyOut.Response (*RepeatedResponseBodyOut_Response)(nil), // 18: grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response (*emptypb.Empty)(nil), // 19: google.protobuf.Empty (*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp (*anypb.Any)(nil), // 21: google.protobuf.Any (*fieldmaskpb.FieldMask)(nil), // 22: google.protobuf.FieldMask } var file_runtime_internal_examplepb_example_proto_depIdxs = []int32{ 13, // 0: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.single_nested:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested 13, // 1: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.nested:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested 0, // 2: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.enum_value:type_name -> grpc.gateway.runtime.internal.examplepb.NumericEnum 19, // 3: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.oneof_empty:type_name -> google.protobuf.Empty 14, // 4: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.map_value:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MapValueEntry 15, // 5: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.mapped_string_value:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedStringValueEntry 16, // 6: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.mapped_nested_value:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedNestedValueEntry 20, // 7: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.timestamp_value:type_name -> google.protobuf.Timestamp 0, // 8: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.repeated_enum_value:type_name -> grpc.gateway.runtime.internal.examplepb.NumericEnum 0, // 9: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.repeated_enum_annotation:type_name -> grpc.gateway.runtime.internal.examplepb.NumericEnum 0, // 10: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.enum_value_annotation:type_name -> grpc.gateway.runtime.internal.examplepb.NumericEnum 13, // 11: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.repeated_nested_annotation:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested 13, // 12: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.nested_annotation:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested 21, // 13: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.anytype:type_name -> google.protobuf.Any 21, // 14: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.repeated_anytype:type_name -> google.protobuf.Any 17, // 15: grpc.gateway.runtime.internal.examplepb.ResponseBodyOut.response:type_name -> grpc.gateway.runtime.internal.examplepb.ResponseBodyOut.Response 18, // 16: grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.response:type_name -> grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response 22, // 17: grpc.gateway.runtime.internal.examplepb.UpdateMessage.update_mask:type_name -> google.protobuf.FieldMask 4, // 18: grpc.gateway.runtime.internal.examplepb.UpdateMessage.a_bit_of_everything:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything 9, // 19: grpc.gateway.runtime.internal.examplepb.NestedOuter.one:type_name -> grpc.gateway.runtime.internal.examplepb.NestedOne 10, // 20: grpc.gateway.runtime.internal.examplepb.NestedOne.two:type_name -> grpc.gateway.runtime.internal.examplepb.NestedTwo 11, // 21: grpc.gateway.runtime.internal.examplepb.NestedTwo.three:type_name -> grpc.gateway.runtime.internal.examplepb.NestedThree 8, // 22: grpc.gateway.runtime.internal.examplepb.UpdateNestedRequest.nested:type_name -> grpc.gateway.runtime.internal.examplepb.NestedOuter 22, // 23: grpc.gateway.runtime.internal.examplepb.UpdateNestedRequest.update_mask:type_name -> google.protobuf.FieldMask 1, // 24: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested.ok:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested.DeepEnum 0, // 25: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MapValueEntry.value:type_name -> grpc.gateway.runtime.internal.examplepb.NumericEnum 13, // 26: grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedNestedValueEntry.value:type_name -> grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested 2, // 27: grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response.type:type_name -> grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response.ResponseType 28, // [28:28] is the sub-list for method output_type 28, // [28:28] is the sub-list for method input_type 28, // [28:28] is the sub-list for extension type_name 28, // [28:28] is the sub-list for extension extendee 0, // [0:28] is the sub-list for field type_name } func init() { file_runtime_internal_examplepb_example_proto_init() } func file_runtime_internal_examplepb_example_proto_init() { if File_runtime_internal_examplepb_example_proto != nil { return } if !protoimpl.UnsafeEnabled { file_runtime_internal_examplepb_example_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SimpleMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ABitOfEverything); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseBodyOut); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepeatedResponseBodyOut); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedOuter); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedOne); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedTwo); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NestedThree); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateNestedRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ABitOfEverything_Nested); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseBodyOut_Response); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_example_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RepeatedResponseBodyOut_Response); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_runtime_internal_examplepb_example_proto_msgTypes[1].OneofWrappers = []interface{}{ (*ABitOfEverything_OneofEmpty)(nil), (*ABitOfEverything_OneofString)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_internal_examplepb_example_proto_rawDesc, NumEnums: 3, NumMessages: 16, NumExtensions: 0, NumServices: 0, }, GoTypes: file_runtime_internal_examplepb_example_proto_goTypes, DependencyIndexes: file_runtime_internal_examplepb_example_proto_depIdxs, EnumInfos: file_runtime_internal_examplepb_example_proto_enumTypes, MessageInfos: file_runtime_internal_examplepb_example_proto_msgTypes, }.Build() File_runtime_internal_examplepb_example_proto = out.File file_runtime_internal_examplepb_example_proto_rawDesc = nil file_runtime_internal_examplepb_example_proto_goTypes = nil file_runtime_internal_examplepb_example_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/example.proto000066400000000000000000000066021465037340600316640ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.runtime.internal.examplepb; import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb"; // SimpleMessage represents a simple message sent to the Echo service. message SimpleMessage { string id = 1; } message ABitOfEverything { // Nested is nested type. message Nested { // name is nested field. string name = 1; uint32 amount = 2; // DeepEnum is one or zero. enum DeepEnum { // FALSE is false. FALSE = 0; // TRUE is true. TRUE = 1; } // DeepEnum comment. DeepEnum ok = 3; } Nested single_nested = 25; string uuid = 1; repeated Nested nested = 2; float float_value = 3; double double_value = 4; int64 int64_value = 5; uint64 uint64_value = 6; int32 int32_value = 7; fixed64 fixed64_value = 8; fixed32 fixed32_value = 9; bool bool_value = 10; string string_value = 11; bytes bytes_value = 29; uint32 uint32_value = 13; NumericEnum enum_value = 14; sfixed32 sfixed32_value = 15; sfixed64 sfixed64_value = 16; sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; oneof oneof_value { google.protobuf.Empty oneof_empty = 20; string oneof_string = 21; } map map_value = 22; map mapped_string_value = 23; map mapped_nested_value = 24; string nonConventionalNameValue = 26; google.protobuf.Timestamp timestamp_value = 27; // repeated enum value. it is comma-separated in query repeated NumericEnum repeated_enum_value = 28; // repeated numeric enum comment (This comment is overridden by the field // annotation) repeated NumericEnum repeated_enum_annotation = 32; // numeric enum comment (This comment is overridden by the field annotation) NumericEnum enum_value_annotation = 33; // repeated string comment (This comment is overridden by the field // annotation) repeated string repeated_string_annotation = 34; // repeated nested object comment (This comment is overridden by the field // annotation) repeated Nested repeated_nested_annotation = 35; // nested object comments (This comment is overridden by the field annotation) Nested nested_annotation = 36; int64 int64_override_type = 37; google.protobuf.Any anytype = 38; repeated google.protobuf.Any repeated_anytype = 39; } // NumericEnum is one or zero. enum NumericEnum { // ZERO means 0 ZERO = 0; // ONE means 1 ONE = 1; } message ResponseBodyOut { message Response { string data = 1; } Response response = 2; } message RepeatedResponseBodyOut { message Response { string data = 1; enum ResponseType { // UNKNOWN UNKNOWN = 0; // A is 1 A = 1; // B is 2 B = 2; } ResponseType type = 3; } repeated Response response = 2; } message UpdateMessage { google.protobuf.FieldMask update_mask = 1; ABitOfEverything a_bit_of_everything = 2; } message NestedOuter { NestedOne one = 1; } message NestedOne { NestedTwo two = 1; } message NestedTwo { NestedThree three = 1; } message NestedThree { bool a = 1; bool b = 2; } message UpdateNestedRequest { NestedOuter nested = 1; google.protobuf.FieldMask update_mask = 2; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/example.swagger.json000066400000000000000000000105461465037340600331320ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "runtime/internal/examplepb/example.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/non_standard_names.pb.go000066400000000000000000001155731465037340600337400ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: runtime/internal/examplepb/non_standard_names.proto package examplepb import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" structpb "google.golang.org/protobuf/types/known/structpb" 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) ) // NonStandardMessage has oddly named fields. type NonStandardMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3" json:"line_num,omitempty"` LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` STATUS string `protobuf:"bytes,5,opt,name=STATUS,proto3" json:"STATUS,omitempty"` En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=enGB,proto3" json:"en_GB,omitempty"` No string `protobuf:"bytes,7,opt,name=no,proto3" json:"no,omitempty"` Thing *NonStandardMessage_Thing `protobuf:"bytes,8,opt,name=thing,proto3" json:"thing,omitempty"` StructField *structpb.Struct `protobuf:"bytes,9,opt,name=struct_field,json=structField,proto3" json:"struct_field,omitempty"` ValueField *structpb.Value `protobuf:"bytes,10,opt,name=value_field,json=valueField,proto3" json:"value_field,omitempty"` } func (x *NonStandardMessage) Reset() { *x = NonStandardMessage{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage) ProtoMessage() {} func (x *NonStandardMessage) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessage.ProtoReflect.Descriptor instead. func (*NonStandardMessage) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0} } func (x *NonStandardMessage) GetId() string { if x != nil { return x.Id } return "" } func (x *NonStandardMessage) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *NonStandardMessage) GetLineNum() int64 { if x != nil { return x.LineNum } return 0 } func (x *NonStandardMessage) GetLangIdent() string { if x != nil { return x.LangIdent } return "" } func (x *NonStandardMessage) GetSTATUS() string { if x != nil { return x.STATUS } return "" } func (x *NonStandardMessage) GetEn_GB() int64 { if x != nil { return x.En_GB } return 0 } func (x *NonStandardMessage) GetNo() string { if x != nil { return x.No } return "" } func (x *NonStandardMessage) GetThing() *NonStandardMessage_Thing { if x != nil { return x.Thing } return nil } func (x *NonStandardMessage) GetStructField() *structpb.Struct { if x != nil { return x.StructField } return nil } func (x *NonStandardMessage) GetValueField() *structpb.Value { if x != nil { return x.ValueField } return nil } type NonStandardUpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Body *NonStandardMessage `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *NonStandardUpdateRequest) Reset() { *x = NonStandardUpdateRequest{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardUpdateRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardUpdateRequest) ProtoMessage() {} func (x *NonStandardUpdateRequest) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardUpdateRequest.ProtoReflect.Descriptor instead. func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{1} } func (x *NonStandardUpdateRequest) GetBody() *NonStandardMessage { if x != nil { return x.Body } return nil } func (x *NonStandardUpdateRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } // NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. type NonStandardMessageWithJSONNames struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id,json=ID,proto3" json:"id,omitempty"` Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=LineNum,proto3" json:"line_num,omitempty"` LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` STATUS string `protobuf:"bytes,5,opt,name=STATUS,json=status,proto3" json:"STATUS,omitempty"` En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=En_GB,proto3" json:"en_GB,omitempty"` No string `protobuf:"bytes,7,opt,name=no,json=yes,proto3" json:"no,omitempty"` Thing *NonStandardMessageWithJSONNames_Thing `protobuf:"bytes,8,opt,name=thing,json=Thingy,proto3" json:"thing,omitempty"` StructField *structpb.Struct `protobuf:"bytes,9,opt,name=struct_field,json=StructField,proto3" json:"struct_field,omitempty"` ValueField *structpb.Value `protobuf:"bytes,10,opt,name=value_field,json=ValueField,proto3" json:"value_field,omitempty"` } func (x *NonStandardMessageWithJSONNames) Reset() { *x = NonStandardMessageWithJSONNames{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2} } func (x *NonStandardMessageWithJSONNames) GetId() string { if x != nil { return x.Id } return "" } func (x *NonStandardMessageWithJSONNames) GetNum() int64 { if x != nil { return x.Num } return 0 } func (x *NonStandardMessageWithJSONNames) GetLineNum() int64 { if x != nil { return x.LineNum } return 0 } func (x *NonStandardMessageWithJSONNames) GetLangIdent() string { if x != nil { return x.LangIdent } return "" } func (x *NonStandardMessageWithJSONNames) GetSTATUS() string { if x != nil { return x.STATUS } return "" } func (x *NonStandardMessageWithJSONNames) GetEn_GB() int64 { if x != nil { return x.En_GB } return 0 } func (x *NonStandardMessageWithJSONNames) GetNo() string { if x != nil { return x.No } return "" } func (x *NonStandardMessageWithJSONNames) GetThing() *NonStandardMessageWithJSONNames_Thing { if x != nil { return x.Thing } return nil } func (x *NonStandardMessageWithJSONNames) GetStructField() *structpb.Struct { if x != nil { return x.StructField } return nil } func (x *NonStandardMessageWithJSONNames) GetValueField() *structpb.Value { if x != nil { return x.ValueField } return nil } type NonStandardWithJSONNamesUpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Body *NonStandardMessageWithJSONNames `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *NonStandardWithJSONNamesUpdateRequest) Reset() { *x = NonStandardWithJSONNamesUpdateRequest{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardWithJSONNamesUpdateRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} func (x *NonStandardWithJSONNamesUpdateRequest) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardWithJSONNamesUpdateRequest.ProtoReflect.Descriptor instead. func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{3} } func (x *NonStandardWithJSONNamesUpdateRequest) GetBody() *NonStandardMessageWithJSONNames { if x != nil { return x.Body } return nil } func (x *NonStandardWithJSONNamesUpdateRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } return nil } type NonStandardMessage_Thing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubThing *NonStandardMessage_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,proto3" json:"subThing,omitempty"` } func (x *NonStandardMessage_Thing) Reset() { *x = NonStandardMessage_Thing{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage_Thing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage_Thing) ProtoMessage() {} func (x *NonStandardMessage_Thing) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessage_Thing.ProtoReflect.Descriptor instead. func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0, 0} } func (x *NonStandardMessage_Thing) GetSubThing() *NonStandardMessage_Thing_SubThing { if x != nil { return x.SubThing } return nil } type NonStandardMessage_Thing_SubThing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=subValue,proto3" json:"sub_value,omitempty"` } func (x *NonStandardMessage_Thing_SubThing) Reset() { *x = NonStandardMessage_Thing_SubThing{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessage_Thing_SubThing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} func (x *NonStandardMessage_Thing_SubThing) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessage_Thing_SubThing.ProtoReflect.Descriptor instead. func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{0, 0, 0} } func (x *NonStandardMessage_Thing_SubThing) GetSubValue() string { if x != nil { return x.SubValue } return "" } type NonStandardMessageWithJSONNames_Thing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubThing *NonStandardMessageWithJSONNames_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,json=SubThing,proto3" json:"subThing,omitempty"` } func (x *NonStandardMessageWithJSONNames_Thing) Reset() { *x = NonStandardMessageWithJSONNames_Thing{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames_Thing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames_Thing) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames_Thing.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2, 0} } func (x *NonStandardMessageWithJSONNames_Thing) GetSubThing() *NonStandardMessageWithJSONNames_Thing_SubThing { if x != nil { return x.SubThing } return nil } type NonStandardMessageWithJSONNames_Thing_SubThing struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=sub_Value,proto3" json:"sub_value,omitempty"` } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) Reset() { *x = NonStandardMessageWithJSONNames_Thing_SubThing{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { return protoimpl.X.MessageStringOf(x) } func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} func (x *NonStandardMessageWithJSONNames_Thing_SubThing) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_non_standard_names_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 NonStandardMessageWithJSONNames_Thing_SubThing.ProtoReflect.Descriptor instead. func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *NonStandardMessageWithJSONNames_Thing_SubThing) GetSubValue() string { if x != nil { return x.SubValue } return "" } var File_runtime_internal_examplepb_non_standard_names_proto protoreflect.FileDescriptor var file_runtime_internal_examplepb_non_standard_names_proto_rawDesc = []byte{ 0x0a, 0x33, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x04, 0x0a, 0x12, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x12, 0x13, 0x0a, 0x05, 0x65, 0x6e, 0x5f, 0x47, 0x42, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x65, 0x6e, 0x47, 0x42, 0x12, 0x0e, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6e, 0x6f, 0x12, 0x57, 0x0a, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0x98, 0x01, 0x0a, 0x05, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x66, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x27, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa8, 0x01, 0x0a, 0x18, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0xc0, 0x04, 0x0a, 0x1f, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4c, 0x69, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x5f, 0x47, 0x42, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x45, 0x6e, 0x5f, 0x47, 0x42, 0x12, 0x0f, 0x0a, 0x02, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x79, 0x65, 0x73, 0x12, 0x65, 0x0a, 0x05, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x79, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x1a, 0xa6, 0x01, 0x0a, 0x05, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x73, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x57, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x28, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x54, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x62, 0x5f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc2, 0x01, 0x0a, 0x25, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x32, 0xbf, 0x03, 0x0a, 0x12, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb7, 0x01, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0xee, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x4e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4a, 0x53, 0x4f, 0x4e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x3a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, 0x2f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x6e, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_runtime_internal_examplepb_non_standard_names_proto_rawDescOnce sync.Once file_runtime_internal_examplepb_non_standard_names_proto_rawDescData = file_runtime_internal_examplepb_non_standard_names_proto_rawDesc ) func file_runtime_internal_examplepb_non_standard_names_proto_rawDescGZIP() []byte { file_runtime_internal_examplepb_non_standard_names_proto_rawDescOnce.Do(func() { file_runtime_internal_examplepb_non_standard_names_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_internal_examplepb_non_standard_names_proto_rawDescData) }) return file_runtime_internal_examplepb_non_standard_names_proto_rawDescData } var file_runtime_internal_examplepb_non_standard_names_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_runtime_internal_examplepb_non_standard_names_proto_goTypes = []interface{}{ (*NonStandardMessage)(nil), // 0: grpc.gateway.runtime.internal.examplepb.NonStandardMessage (*NonStandardUpdateRequest)(nil), // 1: grpc.gateway.runtime.internal.examplepb.NonStandardUpdateRequest (*NonStandardMessageWithJSONNames)(nil), // 2: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames (*NonStandardWithJSONNamesUpdateRequest)(nil), // 3: grpc.gateway.runtime.internal.examplepb.NonStandardWithJSONNamesUpdateRequest (*NonStandardMessage_Thing)(nil), // 4: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.Thing (*NonStandardMessage_Thing_SubThing)(nil), // 5: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.Thing.SubThing (*NonStandardMessageWithJSONNames_Thing)(nil), // 6: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.Thing (*NonStandardMessageWithJSONNames_Thing_SubThing)(nil), // 7: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing (*structpb.Struct)(nil), // 8: google.protobuf.Struct (*structpb.Value)(nil), // 9: google.protobuf.Value (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask } var file_runtime_internal_examplepb_non_standard_names_proto_depIdxs = []int32{ 4, // 0: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.thing:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessage.Thing 8, // 1: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.struct_field:type_name -> google.protobuf.Struct 9, // 2: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.value_field:type_name -> google.protobuf.Value 0, // 3: grpc.gateway.runtime.internal.examplepb.NonStandardUpdateRequest.body:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessage 10, // 4: grpc.gateway.runtime.internal.examplepb.NonStandardUpdateRequest.update_mask:type_name -> google.protobuf.FieldMask 6, // 5: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.thing:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.Thing 8, // 6: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.struct_field:type_name -> google.protobuf.Struct 9, // 7: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.value_field:type_name -> google.protobuf.Value 2, // 8: grpc.gateway.runtime.internal.examplepb.NonStandardWithJSONNamesUpdateRequest.body:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames 10, // 9: grpc.gateway.runtime.internal.examplepb.NonStandardWithJSONNamesUpdateRequest.update_mask:type_name -> google.protobuf.FieldMask 5, // 10: grpc.gateway.runtime.internal.examplepb.NonStandardMessage.Thing.subThing:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessage.Thing.SubThing 7, // 11: grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.Thing.subThing:type_name -> grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing 1, // 12: grpc.gateway.runtime.internal.examplepb.NonStandardService.Update:input_type -> grpc.gateway.runtime.internal.examplepb.NonStandardUpdateRequest 3, // 13: grpc.gateway.runtime.internal.examplepb.NonStandardService.UpdateWithJSONNames:input_type -> grpc.gateway.runtime.internal.examplepb.NonStandardWithJSONNamesUpdateRequest 0, // 14: grpc.gateway.runtime.internal.examplepb.NonStandardService.Update:output_type -> grpc.gateway.runtime.internal.examplepb.NonStandardMessage 2, // 15: grpc.gateway.runtime.internal.examplepb.NonStandardService.UpdateWithJSONNames:output_type -> grpc.gateway.runtime.internal.examplepb.NonStandardMessageWithJSONNames 14, // [14:16] is the sub-list for method output_type 12, // [12:14] 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_runtime_internal_examplepb_non_standard_names_proto_init() } func file_runtime_internal_examplepb_non_standard_names_proto_init() { if File_runtime_internal_examplepb_non_standard_names_proto != nil { return } if !protoimpl.UnsafeEnabled { file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardUpdateRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardWithJSONNamesUpdateRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage_Thing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessage_Thing_SubThing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames_Thing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_runtime_internal_examplepb_non_standard_names_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NonStandardMessageWithJSONNames_Thing_SubThing); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_internal_examplepb_non_standard_names_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, GoTypes: file_runtime_internal_examplepb_non_standard_names_proto_goTypes, DependencyIndexes: file_runtime_internal_examplepb_non_standard_names_proto_depIdxs, MessageInfos: file_runtime_internal_examplepb_non_standard_names_proto_msgTypes, }.Build() File_runtime_internal_examplepb_non_standard_names_proto = out.File file_runtime_internal_examplepb_non_standard_names_proto_rawDesc = nil file_runtime_internal_examplepb_non_standard_names_proto_goTypes = nil file_runtime_internal_examplepb_non_standard_names_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/non_standard_names.proto000066400000000000000000000047501465037340600340700ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.runtime.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; // NonStandardMessage has oddly named fields. message NonStandardMessage { // Id represents the message identifier. string id = 1; int64 Num = 2; int64 line_num = 3; string langIdent = 4; string STATUS = 5; int64 en_GB = 6; string no = 7; message Thing { message SubThing { string sub_value = 1; } SubThing subThing = 1; } Thing thing = 8; google.protobuf.Struct struct_field = 9; google.protobuf.Value value_field = 10; } message NonStandardUpdateRequest { NonStandardMessage body = 1; google.protobuf.FieldMask update_mask = 2; } // NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. message NonStandardMessageWithJSONNames { // Id represents the message identifier. string id = 1 [json_name = "ID"]; int64 Num = 2 [json_name = "Num"]; int64 line_num = 3 [json_name = "LineNum"]; string langIdent = 4 [json_name = "langIdent"]; string STATUS = 5 [json_name = "status"]; int64 en_GB = 6 [json_name = "En_GB"]; string no = 7 [json_name = "yes"]; message Thing { message SubThing { string sub_value = 1 [json_name = "sub_Value"]; } SubThing subThing = 1 [json_name = "SubThing"]; } Thing thing = 8 [json_name = "Thingy"]; google.protobuf.Struct struct_field = 9 [json_name = "StructField"]; google.protobuf.Value value_field = 10 [json_name = "ValueField"]; } message NonStandardWithJSONNamesUpdateRequest { NonStandardMessageWithJSONNames body = 1; google.protobuf.FieldMask update_mask = 2; } // NonStandardService responds to incoming messages, applies a field mask and returns the masked response. service NonStandardService { // Apply field mask to empty NonStandardMessage and return result. rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) { option (google.api.http) = { patch: "/v1/example/non_standard/update" body: "body" }; } // Apply field mask to empty NonStandardMessageWithJSONNames and return result. rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) { option (google.api.http) = { patch: "/v1/example/non_standard/update_with_json_names" body: "body" }; } } non_standard_names.swagger.json000066400000000000000000000223711465037340600352540ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb{ "swagger": "2.0", "info": { "title": "runtime/internal/examplepb/non_standard_names.proto", "version": "version not set" }, "tags": [ { "name": "NonStandardService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/non_standard/update": { "patch": { "summary": "Apply field mask to empty NonStandardMessage and return result.", "operationId": "NonStandardService_Update", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbNonStandardMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonStandardMessage" } } ], "tags": [ "NonStandardService" ] } }, "/v1/example/non_standard/update_with_json_names": { "patch": { "summary": "Apply field mask to empty NonStandardMessageWithJSONNames and return result.", "operationId": "NonStandardService_UpdateWithJSONNames", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNames" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNames" } } ], "tags": [ "NonStandardService" ] } } }, "definitions": { "examplepbNonStandardMessage": { "type": "object", "properties": { "id": { "type": "string", "description": "Id represents the message identifier." }, "Num": { "type": "string", "format": "int64" }, "lineNum": { "type": "string", "format": "int64" }, "langIdent": { "type": "string" }, "STATUS": { "type": "string" }, "enGB": { "type": "string", "format": "int64" }, "no": { "type": "string" }, "thing": { "$ref": "#/definitions/examplepbNonStandardMessageThing" }, "structField": { "type": "object" }, "valueField": {} }, "description": "NonStandardMessage has oddly named fields." }, "examplepbNonStandardMessageThing": { "type": "object", "properties": { "subThing": { "$ref": "#/definitions/examplepbNonStandardMessageThingSubThing" } } }, "examplepbNonStandardMessageThingSubThing": { "type": "object", "properties": { "subValue": { "type": "string" } } }, "examplepbNonStandardMessageWithJSONNames": { "type": "object", "properties": { "ID": { "type": "string", "description": "Id represents the message identifier." }, "Num": { "type": "string", "format": "int64" }, "LineNum": { "type": "string", "format": "int64" }, "langIdent": { "type": "string" }, "status": { "type": "string" }, "En_GB": { "type": "string", "format": "int64" }, "yes": { "type": "string" }, "Thingy": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNamesThing" }, "StructField": { "type": "object" }, "ValueField": {} }, "description": "NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion." }, "examplepbNonStandardMessageWithJSONNamesThing": { "type": "object", "properties": { "SubThing": { "$ref": "#/definitions/examplepbNonStandardMessageWithJSONNamesThingSubThing" } } }, "examplepbNonStandardMessageWithJSONNamesThingSubThing": { "type": "object", "properties": { "sub_Value": { "type": "string" } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "protobufNullValue": { "type": "string", "enum": [ "NULL_VALUE" ], "default": "NULL_VALUE", "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } non_standard_names_grpc.pb.go000066400000000000000000000137611465037340600346700ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc (unknown) // source: runtime/internal/examplepb/non_standard_names.proto package examplepb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // NonStandardServiceClient is the client API for NonStandardService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type NonStandardServiceClient interface { // Apply field mask to empty NonStandardMessage and return result. Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) // Apply field mask to empty NonStandardMessageWithJSONNames and return result. UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) } type nonStandardServiceClient struct { cc grpc.ClientConnInterface } func NewNonStandardServiceClient(cc grpc.ClientConnInterface) NonStandardServiceClient { return &nonStandardServiceClient{cc} } func (c *nonStandardServiceClient) Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) { out := new(NonStandardMessage) err := c.cc.Invoke(ctx, "/grpc.gateway.runtime.internal.examplepb.NonStandardService/Update", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *nonStandardServiceClient) UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) { out := new(NonStandardMessageWithJSONNames) err := c.cc.Invoke(ctx, "/grpc.gateway.runtime.internal.examplepb.NonStandardService/UpdateWithJSONNames", in, out, opts...) if err != nil { return nil, err } return out, nil } // NonStandardServiceServer is the server API for NonStandardService service. // All implementations should embed UnimplementedNonStandardServiceServer // for forward compatibility type NonStandardServiceServer interface { // Apply field mask to empty NonStandardMessage and return result. Update(context.Context, *NonStandardUpdateRequest) (*NonStandardMessage, error) // Apply field mask to empty NonStandardMessageWithJSONNames and return result. UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) } // UnimplementedNonStandardServiceServer should be embedded to have forward compatible implementations. type UnimplementedNonStandardServiceServer struct { } func (UnimplementedNonStandardServiceServer) Update(context.Context, *NonStandardUpdateRequest) (*NonStandardMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") } func (UnimplementedNonStandardServiceServer) UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateWithJSONNames not implemented") } // UnsafeNonStandardServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NonStandardServiceServer will // result in compilation errors. type UnsafeNonStandardServiceServer interface { mustEmbedUnimplementedNonStandardServiceServer() } func RegisterNonStandardServiceServer(s grpc.ServiceRegistrar, srv NonStandardServiceServer) { s.RegisterService(&NonStandardService_ServiceDesc, srv) } func _NonStandardService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonStandardUpdateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NonStandardServiceServer).Update(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.runtime.internal.examplepb.NonStandardService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).Update(ctx, req.(*NonStandardUpdateRequest)) } return interceptor(ctx, in, info, handler) } func _NonStandardService_UpdateWithJSONNames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonStandardWithJSONNamesUpdateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/grpc.gateway.runtime.internal.examplepb.NonStandardService/UpdateWithJSONNames", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, req.(*NonStandardWithJSONNamesUpdateRequest)) } return interceptor(ctx, in, info, handler) } // NonStandardService_ServiceDesc is the grpc.ServiceDesc for NonStandardService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var NonStandardService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.runtime.internal.examplepb.NonStandardService", HandlerType: (*NonStandardServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Update", Handler: _NonStandardService_Update_Handler, }, { MethodName: "UpdateWithJSONNames", Handler: _NonStandardService_UpdateWithJSONNames_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "runtime/internal/examplepb/non_standard_names.proto", } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto2.pb.go000066400000000000000000000227511465037340600313230ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: runtime/internal/examplepb/proto2.proto package examplepb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" 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 Proto2Message struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields FloatValue *float32 `protobuf:"fixed32,42,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` DoubleValue *float64 `protobuf:"fixed64,43,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` Int64Value *int64 `protobuf:"varint,3,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` Int32Value *int32 `protobuf:"varint,4,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` Uint64Value *uint64 `protobuf:"varint,5,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` Uint32Value *uint32 `protobuf:"varint,6,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` BoolValue *bool `protobuf:"varint,7,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` StringValue *string `protobuf:"bytes,8,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue" json:"bytes_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` } func (x *Proto2Message) Reset() { *x = Proto2Message{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_proto2_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Proto2Message) String() string { return protoimpl.X.MessageStringOf(x) } func (*Proto2Message) ProtoMessage() {} func (x *Proto2Message) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_proto2_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 Proto2Message.ProtoReflect.Descriptor instead. func (*Proto2Message) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_proto2_proto_rawDescGZIP(), []int{0} } func (x *Proto2Message) GetFloatValue() float32 { if x != nil && x.FloatValue != nil { return *x.FloatValue } return 0 } func (x *Proto2Message) GetDoubleValue() float64 { if x != nil && x.DoubleValue != nil { return *x.DoubleValue } return 0 } func (x *Proto2Message) GetInt64Value() int64 { if x != nil && x.Int64Value != nil { return *x.Int64Value } return 0 } func (x *Proto2Message) GetInt32Value() int32 { if x != nil && x.Int32Value != nil { return *x.Int32Value } return 0 } func (x *Proto2Message) GetUint64Value() uint64 { if x != nil && x.Uint64Value != nil { return *x.Uint64Value } return 0 } func (x *Proto2Message) GetUint32Value() uint32 { if x != nil && x.Uint32Value != nil { return *x.Uint32Value } return 0 } func (x *Proto2Message) GetBoolValue() bool { if x != nil && x.BoolValue != nil { return *x.BoolValue } return false } func (x *Proto2Message) GetStringValue() string { if x != nil && x.StringValue != nil { return *x.StringValue } return "" } func (x *Proto2Message) GetBytesValue() []byte { if x != nil { return x.BytesValue } return nil } func (x *Proto2Message) GetRepeatedValue() []string { if x != nil { return x.RepeatedValue } return nil } var File_runtime_internal_examplepb_proto2_proto protoreflect.FileDescriptor var file_runtime_internal_examplepb_proto2_proto_rawDesc = []byte{ 0x0a, 0x27, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x22, 0xe5, 0x02, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, } var ( file_runtime_internal_examplepb_proto2_proto_rawDescOnce sync.Once file_runtime_internal_examplepb_proto2_proto_rawDescData = file_runtime_internal_examplepb_proto2_proto_rawDesc ) func file_runtime_internal_examplepb_proto2_proto_rawDescGZIP() []byte { file_runtime_internal_examplepb_proto2_proto_rawDescOnce.Do(func() { file_runtime_internal_examplepb_proto2_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_internal_examplepb_proto2_proto_rawDescData) }) return file_runtime_internal_examplepb_proto2_proto_rawDescData } var file_runtime_internal_examplepb_proto2_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_runtime_internal_examplepb_proto2_proto_goTypes = []interface{}{ (*Proto2Message)(nil), // 0: grpc.gateway.runtime.internal.examplepb.Proto2Message } var file_runtime_internal_examplepb_proto2_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_runtime_internal_examplepb_proto2_proto_init() } func file_runtime_internal_examplepb_proto2_proto_init() { if File_runtime_internal_examplepb_proto2_proto != nil { return } if !protoimpl.UnsafeEnabled { file_runtime_internal_examplepb_proto2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Proto2Message); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_internal_examplepb_proto2_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_runtime_internal_examplepb_proto2_proto_goTypes, DependencyIndexes: file_runtime_internal_examplepb_proto2_proto_depIdxs, MessageInfos: file_runtime_internal_examplepb_proto2_proto_msgTypes, }.Build() File_runtime_internal_examplepb_proto2_proto = out.File file_runtime_internal_examplepb_proto2_proto_rawDesc = nil file_runtime_internal_examplepb_proto2_proto_goTypes = nil file_runtime_internal_examplepb_proto2_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto2.proto000066400000000000000000000010361465037340600314520ustar00rootroot00000000000000syntax = "proto2"; package grpc.gateway.runtime.internal.examplepb; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb"; message Proto2Message { optional float float_value = 42; optional double double_value = 43; optional int64 int64_value = 3; optional int32 int32_value = 4; optional uint64 uint64_value = 5; optional uint32 uint32_value = 6; optional bool bool_value = 7; optional string string_value = 8; optional bytes bytes_value = 9; repeated string repeated_value = 10; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto2.swagger.json000066400000000000000000000105451465037340600327230ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "runtime/internal/examplepb/proto2.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto3.pb.go000066400000000000000000001557471465037340600313400ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 // protoc (unknown) // source: runtime/internal/examplepb/proto3.proto package examplepb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" structpb "google.golang.org/protobuf/types/known/structpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 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 EnumValue int32 const ( EnumValue_X EnumValue = 0 EnumValue_Y EnumValue = 1 EnumValue_Z EnumValue = 2 ) // Enum value maps for EnumValue. var ( EnumValue_name = map[int32]string{ 0: "X", 1: "Y", 2: "Z", } EnumValue_value = map[string]int32{ "X": 0, "Y": 1, "Z": 2, } ) func (x EnumValue) Enum() *EnumValue { p := new(EnumValue) *p = x return p } func (x EnumValue) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } func (EnumValue) Descriptor() protoreflect.EnumDescriptor { return file_runtime_internal_examplepb_proto3_proto_enumTypes[0].Descriptor() } func (EnumValue) Type() protoreflect.EnumType { return &file_runtime_internal_examplepb_proto3_proto_enumTypes[0] } func (x EnumValue) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } // Deprecated: Use EnumValue.Descriptor instead. func (EnumValue) EnumDescriptor() ([]byte, []int) { return file_runtime_internal_examplepb_proto3_proto_rawDescGZIP(), []int{0} } type Proto3Message struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Next number: 49 Nested *Proto3Message `protobuf:"bytes,41,opt,name=nested,proto3" json:"nested,omitempty"` FloatValue float32 `protobuf:"fixed32,42,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` DoubleValue float64 `protobuf:"fixed64,43,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` Int64Value int64 `protobuf:"varint,3,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` Int32Value int32 `protobuf:"varint,4,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` Uint64Value uint64 `protobuf:"varint,5,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` Uint32Value uint32 `protobuf:"varint,6,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` BoolValue bool `protobuf:"varint,7,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,8,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"` RepeatedMessage []*wrapperspb.UInt64Value `protobuf:"bytes,44,rep,name=repeated_message,json=repeatedMessage,proto3" json:"repeated_message,omitempty"` EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.runtime.internal.examplepb.EnumValue" json:"enum_value,omitempty"` RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,proto3,enum=grpc.gateway.runtime.internal.examplepb.EnumValue" json:"repeated_enum,omitempty"` TimestampValue *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` DurationValue *durationpb.Duration `protobuf:"bytes,14,opt,name=duration_value,json=durationValue,proto3" json:"duration_value,omitempty"` FieldmaskValue *fieldmaskpb.FieldMask `protobuf:"bytes,15,opt,name=fieldmask_value,json=fieldmaskValue,proto3" json:"fieldmask_value,omitempty"` // Types that are assignable to OneofValue: // // *Proto3Message_OneofBoolValue // *Proto3Message_OneofStringValue OneofValue isProto3Message_OneofValue `protobuf_oneof:"oneof_value"` // Types that are assignable to NestedOneofValue: // // *Proto3Message_NestedOneofValueOne NestedOneofValue isProto3Message_NestedOneofValue `protobuf_oneof:"nested_oneof_value"` WrapperDoubleValue *wrapperspb.DoubleValue `protobuf:"bytes,17,opt,name=wrapper_double_value,json=wrapperDoubleValue,proto3" json:"wrapper_double_value,omitempty"` WrapperFloatValue *wrapperspb.FloatValue `protobuf:"bytes,18,opt,name=wrapper_float_value,json=wrapperFloatValue,proto3" json:"wrapper_float_value,omitempty"` WrapperInt64Value *wrapperspb.Int64Value `protobuf:"bytes,19,opt,name=wrapper_int64_value,json=wrapperInt64Value,proto3" json:"wrapper_int64_value,omitempty"` WrapperInt32Value *wrapperspb.Int32Value `protobuf:"bytes,20,opt,name=wrapper_int32_value,json=wrapperInt32Value,proto3" json:"wrapper_int32_value,omitempty"` WrapperUInt64Value *wrapperspb.UInt64Value `protobuf:"bytes,21,opt,name=wrapper_u_int64_value,json=wrapperUInt64Value,proto3" json:"wrapper_u_int64_value,omitempty"` WrapperUInt32Value *wrapperspb.UInt32Value `protobuf:"bytes,22,opt,name=wrapper_u_int32_value,json=wrapperUInt32Value,proto3" json:"wrapper_u_int32_value,omitempty"` WrapperBoolValue *wrapperspb.BoolValue `protobuf:"bytes,23,opt,name=wrapper_bool_value,json=wrapperBoolValue,proto3" json:"wrapper_bool_value,omitempty"` WrapperStringValue *wrapperspb.StringValue `protobuf:"bytes,24,opt,name=wrapper_string_value,json=wrapperStringValue,proto3" json:"wrapper_string_value,omitempty"` WrapperBytesValue *wrapperspb.BytesValue `protobuf:"bytes,25,opt,name=wrapper_bytes_value,json=wrapperBytesValue,proto3" json:"wrapper_bytes_value,omitempty"` MapValue map[string]string `protobuf:"bytes,26,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue2 map[string]int32 `protobuf:"bytes,27,rep,name=map_value2,json=mapValue2,proto3" json:"map_value2,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` MapValue3 map[int32]string `protobuf:"bytes,28,rep,name=map_value3,json=mapValue3,proto3" json:"map_value3,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue4 map[string]int64 `protobuf:"bytes,29,rep,name=map_value4,json=mapValue4,proto3" json:"map_value4,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` MapValue5 map[int64]string `protobuf:"bytes,30,rep,name=map_value5,json=mapValue5,proto3" json:"map_value5,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue6 map[string]uint32 `protobuf:"bytes,31,rep,name=map_value6,json=mapValue6,proto3" json:"map_value6,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` MapValue7 map[uint32]string `protobuf:"bytes,32,rep,name=map_value7,json=mapValue7,proto3" json:"map_value7,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue8 map[string]uint64 `protobuf:"bytes,33,rep,name=map_value8,json=mapValue8,proto3" json:"map_value8,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` MapValue9 map[uint64]string `protobuf:"bytes,34,rep,name=map_value9,json=mapValue9,proto3" json:"map_value9,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue10 map[string]float32 `protobuf:"bytes,35,rep,name=map_value10,json=mapValue10,proto3" json:"map_value10,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` MapValue12 map[string]float64 `protobuf:"bytes,37,rep,name=map_value12,json=mapValue12,proto3" json:"map_value12,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` MapValue14 map[string]bool `protobuf:"bytes,39,rep,name=map_value14,json=mapValue14,proto3" json:"map_value14,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` MapValue15 map[bool]string `protobuf:"bytes,40,rep,name=map_value15,json=mapValue15,proto3" json:"map_value15,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MapValue16 map[string]*wrapperspb.UInt64Value `protobuf:"bytes,45,rep,name=map_value16,json=mapValue16,proto3" json:"map_value16,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` StructValueValue *structpb.Value `protobuf:"bytes,47,opt,name=struct_value_value,json=structValueValue,proto3" json:"struct_value_value,omitempty"` StructValue *structpb.Struct `protobuf:"bytes,48,opt,name=struct_value,json=structValue,proto3" json:"struct_value,omitempty"` } func (x *Proto3Message) Reset() { *x = Proto3Message{} if protoimpl.UnsafeEnabled { mi := &file_runtime_internal_examplepb_proto3_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Proto3Message) String() string { return protoimpl.X.MessageStringOf(x) } func (*Proto3Message) ProtoMessage() {} func (x *Proto3Message) ProtoReflect() protoreflect.Message { mi := &file_runtime_internal_examplepb_proto3_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 Proto3Message.ProtoReflect.Descriptor instead. func (*Proto3Message) Descriptor() ([]byte, []int) { return file_runtime_internal_examplepb_proto3_proto_rawDescGZIP(), []int{0} } func (x *Proto3Message) GetNested() *Proto3Message { if x != nil { return x.Nested } return nil } func (x *Proto3Message) GetFloatValue() float32 { if x != nil { return x.FloatValue } return 0 } func (x *Proto3Message) GetDoubleValue() float64 { if x != nil { return x.DoubleValue } return 0 } func (x *Proto3Message) GetInt64Value() int64 { if x != nil { return x.Int64Value } return 0 } func (x *Proto3Message) GetInt32Value() int32 { if x != nil { return x.Int32Value } return 0 } func (x *Proto3Message) GetUint64Value() uint64 { if x != nil { return x.Uint64Value } return 0 } func (x *Proto3Message) GetUint32Value() uint32 { if x != nil { return x.Uint32Value } return 0 } func (x *Proto3Message) GetBoolValue() bool { if x != nil { return x.BoolValue } return false } func (x *Proto3Message) GetStringValue() string { if x != nil { return x.StringValue } return "" } func (x *Proto3Message) GetBytesValue() []byte { if x != nil { return x.BytesValue } return nil } func (x *Proto3Message) GetRepeatedValue() []string { if x != nil { return x.RepeatedValue } return nil } func (x *Proto3Message) GetRepeatedMessage() []*wrapperspb.UInt64Value { if x != nil { return x.RepeatedMessage } return nil } func (x *Proto3Message) GetEnumValue() EnumValue { if x != nil { return x.EnumValue } return EnumValue_X } func (x *Proto3Message) GetRepeatedEnum() []EnumValue { if x != nil { return x.RepeatedEnum } return nil } func (x *Proto3Message) GetTimestampValue() *timestamppb.Timestamp { if x != nil { return x.TimestampValue } return nil } func (x *Proto3Message) GetDurationValue() *durationpb.Duration { if x != nil { return x.DurationValue } return nil } func (x *Proto3Message) GetFieldmaskValue() *fieldmaskpb.FieldMask { if x != nil { return x.FieldmaskValue } return nil } func (m *Proto3Message) GetOneofValue() isProto3Message_OneofValue { if m != nil { return m.OneofValue } return nil } func (x *Proto3Message) GetOneofBoolValue() bool { if x, ok := x.GetOneofValue().(*Proto3Message_OneofBoolValue); ok { return x.OneofBoolValue } return false } func (x *Proto3Message) GetOneofStringValue() string { if x, ok := x.GetOneofValue().(*Proto3Message_OneofStringValue); ok { return x.OneofStringValue } return "" } func (m *Proto3Message) GetNestedOneofValue() isProto3Message_NestedOneofValue { if m != nil { return m.NestedOneofValue } return nil } func (x *Proto3Message) GetNestedOneofValueOne() *Proto3Message { if x, ok := x.GetNestedOneofValue().(*Proto3Message_NestedOneofValueOne); ok { return x.NestedOneofValueOne } return nil } func (x *Proto3Message) GetWrapperDoubleValue() *wrapperspb.DoubleValue { if x != nil { return x.WrapperDoubleValue } return nil } func (x *Proto3Message) GetWrapperFloatValue() *wrapperspb.FloatValue { if x != nil { return x.WrapperFloatValue } return nil } func (x *Proto3Message) GetWrapperInt64Value() *wrapperspb.Int64Value { if x != nil { return x.WrapperInt64Value } return nil } func (x *Proto3Message) GetWrapperInt32Value() *wrapperspb.Int32Value { if x != nil { return x.WrapperInt32Value } return nil } func (x *Proto3Message) GetWrapperUInt64Value() *wrapperspb.UInt64Value { if x != nil { return x.WrapperUInt64Value } return nil } func (x *Proto3Message) GetWrapperUInt32Value() *wrapperspb.UInt32Value { if x != nil { return x.WrapperUInt32Value } return nil } func (x *Proto3Message) GetWrapperBoolValue() *wrapperspb.BoolValue { if x != nil { return x.WrapperBoolValue } return nil } func (x *Proto3Message) GetWrapperStringValue() *wrapperspb.StringValue { if x != nil { return x.WrapperStringValue } return nil } func (x *Proto3Message) GetWrapperBytesValue() *wrapperspb.BytesValue { if x != nil { return x.WrapperBytesValue } return nil } func (x *Proto3Message) GetMapValue() map[string]string { if x != nil { return x.MapValue } return nil } func (x *Proto3Message) GetMapValue2() map[string]int32 { if x != nil { return x.MapValue2 } return nil } func (x *Proto3Message) GetMapValue3() map[int32]string { if x != nil { return x.MapValue3 } return nil } func (x *Proto3Message) GetMapValue4() map[string]int64 { if x != nil { return x.MapValue4 } return nil } func (x *Proto3Message) GetMapValue5() map[int64]string { if x != nil { return x.MapValue5 } return nil } func (x *Proto3Message) GetMapValue6() map[string]uint32 { if x != nil { return x.MapValue6 } return nil } func (x *Proto3Message) GetMapValue7() map[uint32]string { if x != nil { return x.MapValue7 } return nil } func (x *Proto3Message) GetMapValue8() map[string]uint64 { if x != nil { return x.MapValue8 } return nil } func (x *Proto3Message) GetMapValue9() map[uint64]string { if x != nil { return x.MapValue9 } return nil } func (x *Proto3Message) GetMapValue10() map[string]float32 { if x != nil { return x.MapValue10 } return nil } func (x *Proto3Message) GetMapValue12() map[string]float64 { if x != nil { return x.MapValue12 } return nil } func (x *Proto3Message) GetMapValue14() map[string]bool { if x != nil { return x.MapValue14 } return nil } func (x *Proto3Message) GetMapValue15() map[bool]string { if x != nil { return x.MapValue15 } return nil } func (x *Proto3Message) GetMapValue16() map[string]*wrapperspb.UInt64Value { if x != nil { return x.MapValue16 } return nil } func (x *Proto3Message) GetStructValueValue() *structpb.Value { if x != nil { return x.StructValueValue } return nil } func (x *Proto3Message) GetStructValue() *structpb.Struct { if x != nil { return x.StructValue } return nil } type isProto3Message_OneofValue interface { isProto3Message_OneofValue() } type Proto3Message_OneofBoolValue struct { OneofBoolValue bool `protobuf:"varint,1,opt,name=oneof_bool_value,json=oneofBoolValue,proto3,oneof"` } type Proto3Message_OneofStringValue struct { OneofStringValue string `protobuf:"bytes,2,opt,name=oneof_string_value,json=oneofStringValue,proto3,oneof"` } func (*Proto3Message_OneofBoolValue) isProto3Message_OneofValue() {} func (*Proto3Message_OneofStringValue) isProto3Message_OneofValue() {} type isProto3Message_NestedOneofValue interface { isProto3Message_NestedOneofValue() } type Proto3Message_NestedOneofValueOne struct { NestedOneofValueOne *Proto3Message `protobuf:"bytes,46,opt,name=nested_oneof_value_one,json=nestedOneofValueOne,proto3,oneof"` } func (*Proto3Message_NestedOneofValueOne) isProto3Message_NestedOneofValue() {} var File_runtime_internal_examplepb_proto3_proto protoreflect.FileDescriptor var file_runtime_internal_examplepb_proto3_proto_rawDesc = []byte{ 0x0a, 0x27, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 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, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x21, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x4e, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x47, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x2c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x51, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x57, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x43, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 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, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6d, 0x61, 0x73, 0x6b, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0e, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6d, 0x61, 0x73, 0x6b, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x6d, 0x0a, 0x16, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x01, 0x52, 0x13, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x6e, 0x65, 0x12, 0x4e, 0x0a, 0x14, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x12, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x13, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x13, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x13, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4f, 0x0a, 0x15, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x75, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x12, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4f, 0x0a, 0x15, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x75, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x12, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x48, 0x0a, 0x12, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4e, 0x0a, 0x14, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x12, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x13, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x61, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x33, 0x18, 0x1c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x33, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x33, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x34, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x34, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x34, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x35, 0x18, 0x1e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x35, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x35, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x36, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x36, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x36, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x37, 0x18, 0x20, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x37, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x37, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x38, 0x18, 0x21, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x38, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x38, 0x12, 0x64, 0x0a, 0x0a, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x39, 0x18, 0x22, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x39, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x39, 0x12, 0x67, 0x0a, 0x0b, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x30, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x30, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x30, 0x12, 0x67, 0x0a, 0x0b, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x32, 0x18, 0x25, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x32, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x32, 0x12, 0x67, 0x0a, 0x0b, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x34, 0x18, 0x27, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x34, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x34, 0x12, 0x67, 0x0a, 0x0b, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x35, 0x18, 0x28, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x35, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x35, 0x12, 0x67, 0x0a, 0x0b, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x36, 0x18, 0x2d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x36, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x36, 0x12, 0x44, 0x0a, 0x12, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x30, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, 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, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x33, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 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, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x34, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x35, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 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, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x36, 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, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x37, 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, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x38, 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, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x39, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 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, 0x1a, 0x3d, 0x0a, 0x0f, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x30, 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, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 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, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x34, 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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x35, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 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, 0x1a, 0x5b, 0x0a, 0x0f, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x36, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0x0a, 0x12, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x20, 0x0a, 0x09, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x05, 0x0a, 0x01, 0x58, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x59, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x5a, 0x10, 0x02, 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_runtime_internal_examplepb_proto3_proto_rawDescOnce sync.Once file_runtime_internal_examplepb_proto3_proto_rawDescData = file_runtime_internal_examplepb_proto3_proto_rawDesc ) func file_runtime_internal_examplepb_proto3_proto_rawDescGZIP() []byte { file_runtime_internal_examplepb_proto3_proto_rawDescOnce.Do(func() { file_runtime_internal_examplepb_proto3_proto_rawDescData = protoimpl.X.CompressGZIP(file_runtime_internal_examplepb_proto3_proto_rawDescData) }) return file_runtime_internal_examplepb_proto3_proto_rawDescData } var file_runtime_internal_examplepb_proto3_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_runtime_internal_examplepb_proto3_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_runtime_internal_examplepb_proto3_proto_goTypes = []interface{}{ (EnumValue)(0), // 0: grpc.gateway.runtime.internal.examplepb.EnumValue (*Proto3Message)(nil), // 1: grpc.gateway.runtime.internal.examplepb.Proto3Message nil, // 2: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry nil, // 3: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry nil, // 4: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry nil, // 5: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry nil, // 6: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry nil, // 7: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry nil, // 8: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry nil, // 9: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry nil, // 10: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry nil, // 11: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry nil, // 12: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry nil, // 13: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry nil, // 14: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry nil, // 15: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry (*wrapperspb.UInt64Value)(nil), // 16: google.protobuf.UInt64Value (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp (*durationpb.Duration)(nil), // 18: google.protobuf.Duration (*fieldmaskpb.FieldMask)(nil), // 19: google.protobuf.FieldMask (*wrapperspb.DoubleValue)(nil), // 20: google.protobuf.DoubleValue (*wrapperspb.FloatValue)(nil), // 21: google.protobuf.FloatValue (*wrapperspb.Int64Value)(nil), // 22: google.protobuf.Int64Value (*wrapperspb.Int32Value)(nil), // 23: google.protobuf.Int32Value (*wrapperspb.UInt32Value)(nil), // 24: google.protobuf.UInt32Value (*wrapperspb.BoolValue)(nil), // 25: google.protobuf.BoolValue (*wrapperspb.StringValue)(nil), // 26: google.protobuf.StringValue (*wrapperspb.BytesValue)(nil), // 27: google.protobuf.BytesValue (*structpb.Value)(nil), // 28: google.protobuf.Value (*structpb.Struct)(nil), // 29: google.protobuf.Struct } var file_runtime_internal_examplepb_proto3_proto_depIdxs = []int32{ 1, // 0: grpc.gateway.runtime.internal.examplepb.Proto3Message.nested:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message 16, // 1: grpc.gateway.runtime.internal.examplepb.Proto3Message.repeated_message:type_name -> google.protobuf.UInt64Value 0, // 2: grpc.gateway.runtime.internal.examplepb.Proto3Message.enum_value:type_name -> grpc.gateway.runtime.internal.examplepb.EnumValue 0, // 3: grpc.gateway.runtime.internal.examplepb.Proto3Message.repeated_enum:type_name -> grpc.gateway.runtime.internal.examplepb.EnumValue 17, // 4: grpc.gateway.runtime.internal.examplepb.Proto3Message.timestamp_value:type_name -> google.protobuf.Timestamp 18, // 5: grpc.gateway.runtime.internal.examplepb.Proto3Message.duration_value:type_name -> google.protobuf.Duration 19, // 6: grpc.gateway.runtime.internal.examplepb.Proto3Message.fieldmask_value:type_name -> google.protobuf.FieldMask 1, // 7: grpc.gateway.runtime.internal.examplepb.Proto3Message.nested_oneof_value_one:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message 20, // 8: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_double_value:type_name -> google.protobuf.DoubleValue 21, // 9: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_float_value:type_name -> google.protobuf.FloatValue 22, // 10: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int64_value:type_name -> google.protobuf.Int64Value 23, // 11: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int32_value:type_name -> google.protobuf.Int32Value 16, // 12: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int64_value:type_name -> google.protobuf.UInt64Value 24, // 13: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int32_value:type_name -> google.protobuf.UInt32Value 25, // 14: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bool_value:type_name -> google.protobuf.BoolValue 26, // 15: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_string_value:type_name -> google.protobuf.StringValue 27, // 16: grpc.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bytes_value:type_name -> google.protobuf.BytesValue 2, // 17: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry 3, // 18: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value2:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry 4, // 19: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value3:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry 5, // 20: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value4:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry 6, // 21: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value5:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry 7, // 22: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value6:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry 8, // 23: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value7:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry 9, // 24: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value8:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry 10, // 25: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value9:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry 11, // 26: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value10:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry 12, // 27: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value12:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry 13, // 28: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value14:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry 14, // 29: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value15:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry 15, // 30: grpc.gateway.runtime.internal.examplepb.Proto3Message.map_value16:type_name -> grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry 28, // 31: grpc.gateway.runtime.internal.examplepb.Proto3Message.struct_value_value:type_name -> google.protobuf.Value 29, // 32: grpc.gateway.runtime.internal.examplepb.Proto3Message.struct_value:type_name -> google.protobuf.Struct 16, // 33: grpc.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry.value:type_name -> google.protobuf.UInt64Value 34, // [34:34] is the sub-list for method output_type 34, // [34:34] is the sub-list for method input_type 34, // [34:34] is the sub-list for extension type_name 34, // [34:34] is the sub-list for extension extendee 0, // [0:34] is the sub-list for field type_name } func init() { file_runtime_internal_examplepb_proto3_proto_init() } func file_runtime_internal_examplepb_proto3_proto_init() { if File_runtime_internal_examplepb_proto3_proto != nil { return } if !protoimpl.UnsafeEnabled { file_runtime_internal_examplepb_proto3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Proto3Message); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_runtime_internal_examplepb_proto3_proto_msgTypes[0].OneofWrappers = []interface{}{ (*Proto3Message_OneofBoolValue)(nil), (*Proto3Message_OneofStringValue)(nil), (*Proto3Message_NestedOneofValueOne)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_runtime_internal_examplepb_proto3_proto_rawDesc, NumEnums: 1, NumMessages: 15, NumExtensions: 0, NumServices: 0, }, GoTypes: file_runtime_internal_examplepb_proto3_proto_goTypes, DependencyIndexes: file_runtime_internal_examplepb_proto3_proto_depIdxs, EnumInfos: file_runtime_internal_examplepb_proto3_proto_enumTypes, MessageInfos: file_runtime_internal_examplepb_proto3_proto_msgTypes, }.Build() File_runtime_internal_examplepb_proto3_proto = out.File file_runtime_internal_examplepb_proto3_proto_rawDesc = nil file_runtime_internal_examplepb_proto3_proto_goTypes = nil file_runtime_internal_examplepb_proto3_proto_depIdxs = nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto3.proto000066400000000000000000000045071465037340600314610ustar00rootroot00000000000000syntax = "proto3"; package grpc.gateway.runtime.internal.examplepb; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb"; message Proto3Message { // Next number: 49 Proto3Message nested = 41; float float_value = 42; double double_value = 43; int64 int64_value = 3; int32 int32_value = 4; uint64 uint64_value = 5; uint32 uint32_value = 6; bool bool_value = 7; string string_value = 8; bytes bytes_value = 9; repeated string repeated_value = 10; repeated google.protobuf.UInt64Value repeated_message = 44; EnumValue enum_value = 11; repeated EnumValue repeated_enum = 12; google.protobuf.Timestamp timestamp_value = 13; google.protobuf.Duration duration_value = 14; google.protobuf.FieldMask fieldmask_value = 15; oneof oneof_value { bool oneof_bool_value = 1; string oneof_string_value = 2; } oneof nested_oneof_value { Proto3Message nested_oneof_value_one = 46; } google.protobuf.DoubleValue wrapper_double_value = 17; google.protobuf.FloatValue wrapper_float_value = 18; google.protobuf.Int64Value wrapper_int64_value = 19; google.protobuf.Int32Value wrapper_int32_value = 20; google.protobuf.UInt64Value wrapper_u_int64_value = 21; google.protobuf.UInt32Value wrapper_u_int32_value = 22; google.protobuf.BoolValue wrapper_bool_value = 23; google.protobuf.StringValue wrapper_string_value = 24; google.protobuf.BytesValue wrapper_bytes_value = 25; map map_value = 26; map map_value2 = 27; map map_value3 = 28; map map_value4 = 29; map map_value5 = 30; map map_value6 = 31; map map_value7 = 32; map map_value8 = 33; map map_value9 = 34; map map_value10 = 35; map map_value12 = 37; map map_value14 = 39; map map_value15 = 40; map map_value16 = 45; google.protobuf.Value struct_value_value = 47; google.protobuf.Struct struct_value = 48; } enum EnumValue { X = 0; Y = 1; Z = 2; } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/internal/examplepb/proto3.swagger.json000066400000000000000000000105451465037340600327240ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "runtime/internal/examplepb/proto3.proto", "version": "version not set" }, "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": {}, "definitions": { "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_httpbodyproto.go000066400000000000000000000021011465037340600303200ustar00rootroot00000000000000package runtime import ( "google.golang.org/genproto/googleapis/api/httpbody" ) // HTTPBodyMarshaler is a Marshaler which supports marshaling of a // google.api.HttpBody message as the full response body if it is // the actual message used as the response. If not, then this will // simply fallback to the Marshaler specified as its default Marshaler. type HTTPBodyMarshaler struct { Marshaler } // ContentType returns its specified content type in case v is a // google.api.HttpBody message, otherwise it will fall back to the default Marshalers // content type. func (h *HTTPBodyMarshaler) ContentType(v interface{}) string { if httpBody, ok := v.(*httpbody.HttpBody); ok { return httpBody.GetContentType() } return h.Marshaler.ContentType(v) } // Marshal marshals "v" by returning the body bytes if v is a // google.api.HttpBody message, otherwise it falls back to the default Marshaler. func (h *HTTPBodyMarshaler) Marshal(v interface{}) ([]byte, error) { if httpBody, ok := v.(*httpbody.HttpBody); ok { return httpBody.GetData(), nil } return h.Marshaler.Marshal(v) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_httpbodyproto_test.go000066400000000000000000000023021465037340600313620ustar00rootroot00000000000000package runtime_test import ( "bytes" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/protobuf/encoding/protojson" ) func TestHTTPBodyContentType(t *testing.T) { m := runtime.HTTPBodyMarshaler{ &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, }, }, } expected := "CustomContentType" message := &httpbody.HttpBody{ ContentType: expected, } res := m.ContentType(nil) if res != "application/json" { t.Errorf("content type not equal (%q, %q)", res, expected) } res = m.ContentType(message) if res != expected { t.Errorf("content type not equal (%q, %q)", res, expected) } } func TestHTTPBodyMarshal(t *testing.T) { m := runtime.HTTPBodyMarshaler{ &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, }, }, } expected := []byte("Some test") message := &httpbody.HttpBody{ Data: expected, } res, err := m.Marshal(message) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", message, err) } if !bytes.Equal(res, expected) { t.Errorf("Marshalled data not equal (%q, %q)", res, expected) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_json.go000066400000000000000000000027261465037340600263650ustar00rootroot00000000000000package runtime import ( "encoding/json" "io" ) // JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON // with the standard "encoding/json" package of Golang. // Although it is generally faster for simple proto messages than JSONPb, // it does not support advanced features of protobuf, e.g. map, oneof, .... // // The NewEncoder and NewDecoder types return *json.Encoder and // *json.Decoder respectively. type JSONBuiltin struct{} // ContentType always Returns "application/json". func (*JSONBuiltin) ContentType(_ interface{}) string { return "application/json" } // Marshal marshals "v" into JSON func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) } // MarshalIndent is like Marshal but applies Indent to format the output func (j *JSONBuiltin) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { return json.MarshalIndent(v, prefix, indent) } // Unmarshal unmarshals JSON data into "v". func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) } // NewDecoder returns a Decoder which reads JSON stream from "r". func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { return json.NewDecoder(r) } // NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { return json.NewEncoder(w) } // Delimiter for newline encoded JSON streams. func (j *JSONBuiltin) Delimiter() []byte { return []byte("\n") } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_json_test.go000066400000000000000000000243401465037340600274200ustar00rootroot00000000000000package runtime_test import ( "bytes" "encoding/json" "reflect" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) func TestJSONBuiltinMarshal(t *testing.T) { var m runtime.JSONBuiltin msg := &examplepb.SimpleMessage{ Id: "foo", } buf, err := m.Marshal(msg) if err != nil { t.Errorf("m.Marshal(%v) failed with %v; want success", msg, err) } got := new(examplepb.SimpleMessage) if err := json.Unmarshal(buf, got); err != nil { t.Errorf("json.Unmarshal(%q, got) failed with %v; want success", buf, err) } if diff := cmp.Diff(got, msg, protocmp.Transform()); diff != "" { t.Error(diff) } } func TestJSONBuiltinMarshalField(t *testing.T) { var ( m runtime.JSONBuiltin buf []byte err error ) for _, fixt := range builtinFieldFixtures { if len(fixt.indent) == 0 { buf, err = m.Marshal(fixt.data) if err != nil { t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) } } else { buf, err = m.MarshalIndent(fixt.data, "", fixt.indent) if err != nil { t.Errorf("m.MarshalIndent(%v, \"\", \"%s\") failed with %v; want success", fixt.data, fixt.indent, err) } } if got, want := string(buf), fixt.json; got != want { t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) } } } func TestJSONBuiltinMarshalFieldKnownErrors(t *testing.T) { var m runtime.JSONBuiltin for _, fixt := range builtinKnownErrors { buf, err := m.Marshal(fixt.data) if err != nil { t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) } if got, want := string(buf), fixt.json; got == want { t.Errorf("surprisingly got = %q; as want %q; data = %#v", got, want, fixt.data) } } } func TestJSONBuiltinsnmarshal(t *testing.T) { var ( m runtime.JSONBuiltin got = new(examplepb.SimpleMessage) data = []byte(`{"id": "foo"}`) ) if err := m.Unmarshal(data, got); err != nil { t.Errorf("m.Unmarshal(%q, got) failed with %v; want success", data, err) } want := &examplepb.SimpleMessage{ Id: "foo", } if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf(diff) } } func TestJSONBuiltinUnmarshalField(t *testing.T) { var m runtime.JSONBuiltin for _, fixt := range builtinFieldFixtures { dest := alloc(reflect.TypeOf(fixt.data)) if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", fixt.json, err) } got, want := dest.Elem().Interface(), fixt.data if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Error(diff) } } } func alloc(t reflect.Type) reflect.Value { if t == nil { return reflect.ValueOf(new(interface{})) } return reflect.New(t) } func TestJSONBuiltinUnmarshalFieldKnownErrors(t *testing.T) { var m runtime.JSONBuiltin for _, fixt := range builtinKnownErrors { dest := reflect.New(reflect.TypeOf(fixt.data)) if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err == nil { t.Errorf("m.Unmarshal(%q, dest) succeeded; want ane error", fixt.json) } } } func TestJSONBuiltinEncoder(t *testing.T) { var m runtime.JSONBuiltin msg := &examplepb.SimpleMessage{ Id: "foo", } var buf bytes.Buffer enc := m.NewEncoder(&buf) if err := enc.Encode(msg); err != nil { t.Errorf("enc.Encode(%v) failed with %v; want success", msg, err) } got := new(examplepb.SimpleMessage) if err := json.Unmarshal(buf.Bytes(), got); err != nil { t.Errorf("json.Unmarshal(%q, got) failed with %v; want success", buf.String(), err) } if diff := cmp.Diff(got, msg, protocmp.Transform()); diff != "" { t.Error(diff) } } func TestJSONBuiltinEncoderFields(t *testing.T) { var m runtime.JSONBuiltin for _, fixt := range builtinFieldFixtures { var buf bytes.Buffer enc := m.NewEncoder(&buf) if fixt.indent != "" { if e, ok := enc.(*json.Encoder); ok { e.SetIndent("", fixt.indent) } else { // By default, JSONBuiltin.NewEncoder returns *json.Encoder as runtime.Encoder. // Otherwise it's better to fail the tests than skip fixtures with non empty indent t.Errorf("enc is not *json.Encoder, unable to set indentation settings. " + "This failure prevents testing the correctness of indentation in JSON output.") } } if err := enc.Encode(fixt.data); err != nil { t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } if got, want := buf.String(), fixt.json+"\n"; got != want { t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) } } } func TestJSONBuiltinDecoder(t *testing.T) { var ( m runtime.JSONBuiltin got = new(examplepb.SimpleMessage) data = `{"id": "foo"}` ) r := strings.NewReader(data) dec := m.NewDecoder(r) if err := dec.Decode(got); err != nil { t.Errorf("m.Unmarshal(got) failed with %v; want success", err) } want := &examplepb.SimpleMessage{ Id: "foo", } if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Errorf("got = %v; want = %v", got, want) } } func TestJSONBuiltinDecoderFields(t *testing.T) { var m runtime.JSONBuiltin for _, fixt := range builtinFieldFixtures { r := strings.NewReader(fixt.json) dec := m.NewDecoder(r) dest := alloc(reflect.TypeOf(fixt.data)) if err := dec.Decode(dest.Interface()); err != nil { t.Errorf("dec.Decode(dest) failed with %v; want success; data = %q", err, fixt.json) } got, want := dest.Elem().Interface(), fixt.data if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" { t.Error(diff) } } } var ( defaultIndent = " " builtinFieldFixtures = []struct { data interface{} indent string json string }{ {data: "", json: `""`}, {data: "", indent: defaultIndent, json: `""`}, {data: proto.String(""), json: `""`}, {data: proto.String(""), indent: defaultIndent, json: `""`}, {data: "foo", json: `"foo"`}, {data: "foo", indent: defaultIndent, json: `"foo"`}, {data: []byte("foo"), json: `"Zm9v"`}, {data: []byte("foo"), indent: defaultIndent, json: `"Zm9v"`}, {data: []byte{}, json: `""`}, {data: []byte{}, indent: defaultIndent, json: `""`}, {data: proto.String("foo"), json: `"foo"`}, {data: proto.String("foo"), indent: defaultIndent, json: `"foo"`}, {data: int32(-1), json: "-1"}, {data: int32(-1), indent: defaultIndent, json: "-1"}, {data: proto.Int32(-1), json: "-1"}, {data: proto.Int32(-1), indent: defaultIndent, json: "-1"}, {data: int64(-1), json: "-1"}, {data: int64(-1), indent: defaultIndent, json: "-1"}, {data: proto.Int64(-1), json: "-1"}, {data: proto.Int64(-1), indent: defaultIndent, json: "-1"}, {data: uint32(123), json: "123"}, {data: uint32(123), indent: defaultIndent, json: "123"}, {data: proto.Uint32(123), json: "123"}, {data: proto.Uint32(123), indent: defaultIndent, json: "123"}, {data: uint64(123), json: "123"}, {data: uint64(123), indent: defaultIndent, json: "123"}, {data: proto.Uint64(123), json: "123"}, {data: proto.Uint64(123), indent: defaultIndent, json: "123"}, {data: float32(-1.5), json: "-1.5"}, {data: float32(-1.5), indent: defaultIndent, json: "-1.5"}, {data: proto.Float32(-1.5), json: "-1.5"}, {data: proto.Float32(-1.5), indent: defaultIndent, json: "-1.5"}, {data: float64(-1.5), json: "-1.5"}, {data: float64(-1.5), indent: defaultIndent, json: "-1.5"}, {data: proto.Float64(-1.5), json: "-1.5"}, {data: proto.Float64(-1.5), indent: defaultIndent, json: "-1.5"}, {data: true, json: "true"}, {data: true, indent: defaultIndent, json: "true"}, {data: proto.Bool(true), json: "true"}, {data: proto.Bool(true), indent: defaultIndent, json: "true"}, {data: (*string)(nil), json: "null"}, {data: (*string)(nil), indent: defaultIndent, json: "null"}, {data: new(emptypb.Empty), json: "{}"}, {data: new(emptypb.Empty), indent: defaultIndent, json: "{}"}, {data: examplepb.NumericEnum_ONE, json: "1"}, {data: examplepb.NumericEnum_ONE, indent: defaultIndent, json: "1"}, {data: nil, json: "null"}, {data: nil, indent: defaultIndent, json: "null"}, {data: (*string)(nil), json: "null"}, {data: (*string)(nil), indent: defaultIndent, json: "null"}, {data: []interface{}{nil, "foo", -1.0, 1.234, true}, json: `[null,"foo",-1,1.234,true]`}, {data: []interface{}{nil, "foo", -1.0, 1.234, true}, indent: defaultIndent, json: "[\n null,\n \"foo\",\n -1,\n 1.234,\n true\n]"}, { data: map[string]interface{}{"bar": nil, "baz": -1.0, "fiz": 1.234, "foo": true}, json: `{"bar":null,"baz":-1,"fiz":1.234,"foo":true}`, }, { data: map[string]interface{}{"bar": nil, "baz": -1.0, "fiz": 1.234, "foo": true}, indent: defaultIndent, json: "{\n \"bar\": null,\n \"baz\": -1,\n \"fiz\": 1.234,\n \"foo\": true\n}", }, { data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), json: "1", }, { data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), indent: defaultIndent, json: "1", }, {data: map[string]int{"FOO": 0, "BAR": -1}, json: "{\"BAR\":-1,\"FOO\":0}"}, {data: map[string]int{"FOO": 0, "BAR": -1}, indent: defaultIndent, json: "{\n \"BAR\": -1,\n \"FOO\": 0\n}"}, {data: struct { A string B int C map[string]int }{A: "Go", B: 3, C: map[string]int{"FOO": 0, "BAR": -1}}, json: "{\"A\":\"Go\",\"B\":3,\"C\":{\"BAR\":-1,\"FOO\":0}}"}, {data: struct { A string B int C map[string]int }{A: "Go", B: 3, C: map[string]int{"FOO": 0, "BAR": -1}}, indent: defaultIndent, json: "{\n \"A\": \"Go\",\n \"B\": 3,\n \"C\": {\n \"BAR\": -1,\n \"FOO\": 0\n }\n}"}, } builtinKnownErrors = []struct { data interface{} json string }{ {data: examplepb.NumericEnum_ONE, json: "ONE"}, { data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), json: "ONE", }, { data: &examplepb.ABitOfEverything_OneofString{OneofString: "abc"}, json: `"abc"`, }, { data: ×tamppb.Timestamp{ Seconds: 1462875553, Nanos: 123000000, }, json: `"2016-05-10T10:19:13.123Z"`, }, { data: wrapperspb.Int32(123), json: "123", }, } ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_jsonpb.go000066400000000000000000000213501465037340600267010ustar00rootroot00000000000000package runtime import ( "bytes" "encoding/json" "fmt" "io" "reflect" "strconv" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) // JSONPb is a Marshaler which marshals/unmarshals into/from JSON // with the "google.golang.org/protobuf/encoding/protojson" marshaler. // It supports the full functionality of protobuf unlike JSONBuiltin. // // The NewDecoder method returns a DecoderWrapper, so the underlying // *json.Decoder methods can be used. type JSONPb struct { protojson.MarshalOptions protojson.UnmarshalOptions } // ContentType always returns "application/json". func (*JSONPb) ContentType(_ interface{}) string { return "application/json" } // Marshal marshals "v" into JSON. func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { var buf bytes.Buffer if err := j.marshalTo(&buf, v); err != nil { return nil, err } return buf.Bytes(), nil } func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { p, ok := v.(proto.Message) if !ok { buf, err := j.marshalNonProtoField(v) if err != nil { return err } if j.Indent != "" { b := &bytes.Buffer{} if err := json.Indent(b, buf, "", j.Indent); err != nil { return err } buf = b.Bytes() } _, err = w.Write(buf) return err } b, err := j.MarshalOptions.Marshal(p) if err != nil { return err } _, err = w.Write(b) return err } var ( // protoMessageType is stored to prevent constant lookup of the same type at runtime. protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() ) // marshalNonProto marshals a non-message field of a protobuf message. // This function does not correctly marshal arbitrary data structures into JSON, // it is only capable of marshaling non-message field values of protobuf, // i.e. primitive types, enums; pointers to primitives or enums; maps from // integer/string types to primitives/enums/pointers to messages. func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { if v == nil { return []byte("null"), nil } rv := reflect.ValueOf(v) for rv.Kind() == reflect.Ptr { if rv.IsNil() { return []byte("null"), nil } rv = rv.Elem() } if rv.Kind() == reflect.Slice { if rv.IsNil() { if j.EmitUnpopulated { return []byte("[]"), nil } return []byte("null"), nil } if rv.Type().Elem().Implements(protoMessageType) { var buf bytes.Buffer if err := buf.WriteByte('['); err != nil { return nil, err } for i := 0; i < rv.Len(); i++ { if i != 0 { if err := buf.WriteByte(','); err != nil { return nil, err } } if err := j.marshalTo(&buf, rv.Index(i).Interface().(proto.Message)); err != nil { return nil, err } } if err := buf.WriteByte(']'); err != nil { return nil, err } return buf.Bytes(), nil } if rv.Type().Elem().Implements(typeProtoEnum) { var buf bytes.Buffer if err := buf.WriteByte('['); err != nil { return nil, err } for i := 0; i < rv.Len(); i++ { if i != 0 { if err := buf.WriteByte(','); err != nil { return nil, err } } var err error if j.UseEnumNumbers { _, err = buf.WriteString(strconv.FormatInt(rv.Index(i).Int(), 10)) } else { _, err = buf.WriteString("\"" + rv.Index(i).Interface().(protoEnum).String() + "\"") } if err != nil { return nil, err } } if err := buf.WriteByte(']'); err != nil { return nil, err } return buf.Bytes(), nil } } if rv.Kind() == reflect.Map { m := make(map[string]*json.RawMessage) for _, k := range rv.MapKeys() { buf, err := j.Marshal(rv.MapIndex(k).Interface()) if err != nil { return nil, err } m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf) } return json.Marshal(m) } if enum, ok := rv.Interface().(protoEnum); ok && !j.UseEnumNumbers { return json.Marshal(enum.String()) } return json.Marshal(rv.Interface()) } // Unmarshal unmarshals JSON "data" into "v" func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { return unmarshalJSONPb(data, j.UnmarshalOptions, v) } // NewDecoder returns a Decoder which reads JSON stream from "r". func (j *JSONPb) NewDecoder(r io.Reader) Decoder { d := json.NewDecoder(r) return DecoderWrapper{ Decoder: d, UnmarshalOptions: j.UnmarshalOptions, } } // DecoderWrapper is a wrapper around a *json.Decoder that adds // support for protos to the Decode method. type DecoderWrapper struct { *json.Decoder protojson.UnmarshalOptions } // Decode wraps the embedded decoder's Decode method to support // protos using a jsonpb.Unmarshaler. func (d DecoderWrapper) Decode(v interface{}) error { return decodeJSONPb(d.Decoder, d.UnmarshalOptions, v) } // NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONPb) NewEncoder(w io.Writer) Encoder { return EncoderFunc(func(v interface{}) error { if err := j.marshalTo(w, v); err != nil { return err } // mimic json.Encoder by adding a newline (makes output // easier to read when it contains multiple encoded items) _, err := w.Write(j.Delimiter()) return err }) } func unmarshalJSONPb(data []byte, unmarshaler protojson.UnmarshalOptions, v interface{}) error { d := json.NewDecoder(bytes.NewReader(data)) return decodeJSONPb(d, unmarshaler, v) } func decodeJSONPb(d *json.Decoder, unmarshaler protojson.UnmarshalOptions, v interface{}) error { p, ok := v.(proto.Message) if !ok { return decodeNonProtoField(d, unmarshaler, v) } // Decode into bytes for marshalling var b json.RawMessage if err := d.Decode(&b); err != nil { return err } return unmarshaler.Unmarshal([]byte(b), p) } func decodeNonProtoField(d *json.Decoder, unmarshaler protojson.UnmarshalOptions, v interface{}) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr { return fmt.Errorf("%T is not a pointer", v) } for rv.Kind() == reflect.Ptr { if rv.IsNil() { rv.Set(reflect.New(rv.Type().Elem())) } if rv.Type().ConvertibleTo(typeProtoMessage) { // Decode into bytes for marshalling var b json.RawMessage if err := d.Decode(&b); err != nil { return err } return unmarshaler.Unmarshal([]byte(b), rv.Interface().(proto.Message)) } rv = rv.Elem() } if rv.Kind() == reflect.Map { if rv.IsNil() { rv.Set(reflect.MakeMap(rv.Type())) } conv, ok := convFromType[rv.Type().Key().Kind()] if !ok { return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key()) } m := make(map[string]*json.RawMessage) if err := d.Decode(&m); err != nil { return err } for k, v := range m { result := conv.Call([]reflect.Value{reflect.ValueOf(k)}) if err := result[1].Interface(); err != nil { return err.(error) } bk := result[0] bv := reflect.New(rv.Type().Elem()) if v == nil { null := json.RawMessage("null") v = &null } if err := unmarshalJSONPb([]byte(*v), unmarshaler, bv.Interface()); err != nil { return err } rv.SetMapIndex(bk, bv.Elem()) } return nil } if rv.Kind() == reflect.Slice { if rv.Type().Elem().Kind() == reflect.Uint8 { var sl []byte if err := d.Decode(&sl); err != nil { return err } if sl != nil { rv.SetBytes(sl) } return nil } var sl []json.RawMessage if err := d.Decode(&sl); err != nil { return err } if sl != nil { rv.Set(reflect.MakeSlice(rv.Type(), 0, 0)) } for _, item := range sl { bv := reflect.New(rv.Type().Elem()) if err := unmarshalJSONPb([]byte(item), unmarshaler, bv.Interface()); err != nil { return err } rv.Set(reflect.Append(rv, bv.Elem())) } return nil } if _, ok := rv.Interface().(protoEnum); ok { var repr interface{} if err := d.Decode(&repr); err != nil { return err } switch v := repr.(type) { case string: // TODO(yugui) Should use proto.StructProperties? return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface()) case float64: rv.Set(reflect.ValueOf(int32(v)).Convert(rv.Type())) return nil default: return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface()) } } return d.Decode(v) } type protoEnum interface { fmt.Stringer EnumDescriptor() ([]byte, []int) } var typeProtoEnum = reflect.TypeOf((*protoEnum)(nil)).Elem() var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() // Delimiter for newline encoded JSON streams. func (j *JSONPb) Delimiter() []byte { return []byte("\n") } var ( convFromType = map[reflect.Kind]reflect.Value{ reflect.String: reflect.ValueOf(String), reflect.Bool: reflect.ValueOf(Bool), reflect.Float64: reflect.ValueOf(Float64), reflect.Float32: reflect.ValueOf(Float32), reflect.Int64: reflect.ValueOf(Int64), reflect.Int32: reflect.ValueOf(Int32), reflect.Uint64: reflect.ValueOf(Uint64), reflect.Uint32: reflect.ValueOf(Uint32), reflect.Slice: reflect.ValueOf(Bytes), } ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_jsonpb_test.go000066400000000000000000000600511465037340600277410ustar00rootroot00000000000000package runtime_test import ( "bytes" "reflect" "strconv" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) func TestJSONPbMarshal(t *testing.T) { msg := examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{}, RepeatedStringValue: []string{}, MappedStringValue: map[string]string{}, MappedNestedValue: map[string]*examplepb.ABitOfEverything_Nested{}, RepeatedEnumValue: []examplepb.NumericEnum{}, TimestampValue: ×tamppb.Timestamp{}, Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", Amount: 12345, }, }, Uint64Value: 0xFFFFFFFFFFFFFFFF, EnumValue: examplepb.NumericEnum_ONE, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "bar", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{}, EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{}, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { useEnumNumbers, emitUnpopulated bool indent string useProtoNames bool verifier func(json string) }{ { verifier: func(json string) { if !strings.Contains(json, "ONE") { t.Errorf(`strings.Contains(%q, "ONE") = false; want true`, json) } if want := "uint64Value"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { useEnumNumbers: true, verifier: func(json string) { if strings.Contains(json, "ONE") { t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) } }, }, { emitUnpopulated: true, verifier: func(json string) { if want := `"sfixed32Value"`; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { indent: "\t\t", verifier: func(json string) { if want := "\t\t\"amount\":"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { useProtoNames: true, verifier: func(json string) { if want := "uint64_value"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { m := runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: spec.emitUnpopulated, Indent: spec.indent, UseProtoNames: spec.useProtoNames, UseEnumNumbers: spec.useEnumNumbers, }, } buf, err := m.Marshal(&msg) if err != nil { t.Errorf("m.Marshal(%v) failed with %v; want success; spec=%v", &msg, err, spec) } var got examplepb.ABitOfEverything unmarshaler := &protojson.UnmarshalOptions{} if err = unmarshaler.Unmarshal(buf, &got); err != nil { t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", string(buf), err, spec) } if diff := cmp.Diff(&got, &msg, protocmp.Transform()); diff != "" { t.Errorf("case %d: spec=%v; %s", i, spec, diff) } if spec.verifier != nil { spec.verifier(string(buf)) } }) } } func TestJSONPbMarshalFields(t *testing.T) { var m runtime.JSONPb m.UseEnumNumbers = true // builtin fixtures include an enum, expected to be marshaled as int for _, spec := range builtinFieldFixtures { m.Indent = spec.indent buf, err := m.Marshal(spec.data) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", spec.data, err) } if got, want := string(buf), spec.json; got != want { t.Errorf("m.Marshal(%#v) = %q; want %q", spec.data, got, want) } } // Reset m.Indent to ensure no unintended indentation settings carry over to subsequent tests m.Indent = "" nums := []examplepb.NumericEnum{examplepb.NumericEnum_ZERO, examplepb.NumericEnum_ONE} buf, err := m.Marshal(nums) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", nums, err) } if got, want := string(buf), `[0,1]`; got != want { t.Errorf("m.Marshal(%#v) = %q; want %q", nums, got, want) } m.UseEnumNumbers = false buf, err = m.Marshal(examplepb.NumericEnum_ONE) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) } if got, want := string(buf), `"ONE"`; got != want { t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) } buf, err = m.Marshal(nums) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", nums, err) } if got, want := string(buf), `["ZERO","ONE"]`; got != want { t.Errorf("m.Marshal(%#v) = %q; want %q", nums, got, want) } } func TestJSONPbUnmarshal(t *testing.T) { var ( m runtime.JSONPb got examplepb.ABitOfEverything ) for i, data := range []string{ `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": 18446744073709551615, "enumValue": "ONE", "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": "18446744073709551615", "enumValue": "ONE", "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": 18446744073709551615, "enumValue": 1, "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, } { if err := m.Unmarshal([]byte(data), &got); err != nil { t.Errorf("case %d: m.Unmarshal(%q, &got) failed with %v; want success", i, data, err) } want := examplepb.ABitOfEverything{ Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", Amount: 12345, }, }, Uint64Value: 0xFFFFFFFFFFFFFFFF, EnumValue: examplepb.NumericEnum_ONE, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "bar", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, } if diff := cmp.Diff(&got, &want, protocmp.Transform()); diff != "" { t.Errorf("case %d: %s", i, diff) } } } func TestJSONPbUnmarshalFields(t *testing.T) { var m runtime.JSONPb for _, fixt := range fieldFixtures { if fixt.skipUnmarshal { continue } dest := reflect.New(reflect.TypeOf(fixt.data)) if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { t.Errorf("m.Unmarshal(%q, %T) failed with %v; want success", fixt.json, dest.Interface(), err) } if diff := cmp.Diff(dest.Elem().Interface(), fixt.data, protocmp.Transform()); diff != "" { t.Errorf("dest = %#v; want %#v; input = %v", dest.Elem().Interface(), fixt.data, fixt.json) } } } func TestJSONPbEncoder(t *testing.T) { msg := examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{}, RepeatedStringValue: []string{}, MappedStringValue: map[string]string{}, MappedNestedValue: map[string]*examplepb.ABitOfEverything_Nested{}, RepeatedEnumValue: []examplepb.NumericEnum{}, TimestampValue: ×tamppb.Timestamp{}, Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", Amount: 12345, }, }, Uint64Value: 0xFFFFFFFFFFFFFFFF, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "bar", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{}, EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{}, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { useEnumNumbers, emitUnpopulated bool indent string useProtoNames bool verifier func(json string) }{ { verifier: func(json string) { if !strings.Contains(json, "ONE") { t.Errorf(`strings.Contains(%q, "ONE") = false; want true`, json) } if want := "uint64Value"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { useEnumNumbers: true, verifier: func(json string) { if strings.Contains(json, "ONE") { t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) } }, }, { emitUnpopulated: true, verifier: func(json string) { if want := `"sfixed32Value"`; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { indent: "\t\t", verifier: func(json string) { if want := "\t\t\"amount\":"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, { useProtoNames: true, verifier: func(json string) { if want := "uint64_value"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) } }, }, } { m := runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: spec.emitUnpopulated, Indent: spec.indent, UseProtoNames: spec.useProtoNames, UseEnumNumbers: spec.useEnumNumbers, }, } var buf bytes.Buffer enc := m.NewEncoder(&buf) if err := enc.Encode(&msg); err != nil { t.Errorf("enc.Encode(%v) failed with %v; want success; spec=%v", &msg, err, spec) } var got examplepb.ABitOfEverything unmarshaler := &protojson.UnmarshalOptions{} if err := unmarshaler.Unmarshal(buf.Bytes(), &got); err != nil { t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", buf.String(), err, spec) } if diff := cmp.Diff(&got, &msg, protocmp.Transform()); diff != "" { t.Errorf("case %d: %s", i, diff) } if spec.verifier != nil { spec.verifier(buf.String()) } } } func TestJSONPbEncoderFields(t *testing.T) { var m runtime.JSONPb for _, fixt := range fieldFixtures { var buf bytes.Buffer enc := m.NewEncoder(&buf) if err := enc.Encode(fixt.data); err != nil { t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } if got, want := buf.String(), fixt.json+string(m.Delimiter()); got != want { t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) } } m.UseEnumNumbers = true buf, err := m.Marshal(examplepb.NumericEnum_ONE) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) } if got, want := string(buf), "1"; got != want { t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) } } func TestJSONPbDecoder(t *testing.T) { var ( m runtime.JSONPb got examplepb.ABitOfEverything ) for _, data := range []string{ `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": 18446744073709551615, "enumValue": "ONE", "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": "18446744073709551615", "enumValue": "ONE", "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ {"name": "foo", "amount": 12345} ], "uint64Value": 18446744073709551615, "enumValue": 1, "oneofString": "bar", "mapValue": { "a": 1, "b": 0 } }`, } { r := strings.NewReader(data) dec := m.NewDecoder(r) if err := dec.Decode(&got); err != nil { t.Errorf("m.Unmarshal(&got) failed with %v; want success; data=%q", err, data) } want := examplepb.ABitOfEverything{ Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", Amount: 12345, }, }, Uint64Value: 0xFFFFFFFFFFFFFFFF, EnumValue: examplepb.NumericEnum_ONE, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "bar", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, } if diff := cmp.Diff(&got, &want, protocmp.Transform()); diff != "" { t.Errorf("data %q: %s", data, diff) } } } func TestJSONPbDecoderFields(t *testing.T) { var m runtime.JSONPb for _, fixt := range fieldFixtures { if fixt.skipUnmarshal { continue } dest := reflect.New(reflect.TypeOf(fixt.data)) dec := m.NewDecoder(strings.NewReader(fixt.json)) if err := dec.Decode(dest.Interface()); err != nil { t.Errorf("dec.Decode(%T) failed with %v; want success; input = %q", dest.Interface(), err, fixt.json) } if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { t.Errorf("dest = %#v; want %#v; input = %v", got, want, fixt.json) } } } func TestJSONPbDecoderUnknownField(t *testing.T) { var ( m = runtime.JSONPb{ UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: false, }, } got examplepb.ABitOfEverything ) data := `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "unknownField": "111" }` r := strings.NewReader(data) dec := m.NewDecoder(r) if err := dec.Decode(&got); err == nil { t.Errorf("m.Unmarshal(&got) not failed; want `unknown field` error; data=%q", data) } } var ( fieldFixtures = []struct { data interface{} json string skipUnmarshal bool }{ {data: int32(1), json: "1"}, {data: proto.Int32(1), json: "1"}, {data: int64(1), json: "1"}, {data: proto.Int64(1), json: "1"}, {data: uint32(1), json: "1"}, {data: proto.Uint32(1), json: "1"}, {data: uint64(1), json: "1"}, {data: proto.Uint64(1), json: "1"}, {data: "abc", json: `"abc"`}, {data: []byte("abc"), json: `"YWJj"`}, {data: []byte{}, json: `""`}, {data: proto.String("abc"), json: `"abc"`}, {data: float32(1.5), json: "1.5"}, {data: proto.Float32(1.5), json: "1.5"}, {data: float64(1.5), json: "1.5"}, {data: proto.Float64(1.5), json: "1.5"}, {data: true, json: "true"}, {data: false, json: "false"}, {data: (*string)(nil), json: "null"}, { data: examplepb.NumericEnum_ONE, json: `"ONE"`, // TODO(yugui) support unmarshaling of symbolic enum skipUnmarshal: true, }, { data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), json: `"ONE"`, // TODO(yugui) support unmarshaling of symbolic enum skipUnmarshal: true, }, { data: map[string]int32{ "foo": 1, }, json: `{"foo":1}`, }, { data: map[string]*examplepb.SimpleMessage{ "foo": {Id: "bar"}, }, json: `{"foo":{"id":"bar"}}`, }, { data: map[int32]*examplepb.SimpleMessage{ 1: {Id: "foo"}, }, json: `{"1":{"id":"foo"}}`, }, { data: map[bool]*examplepb.SimpleMessage{ true: {Id: "foo"}, }, json: `{"true":{"id":"foo"}}`, }, { data: &durationpb.Duration{ Seconds: 123, Nanos: 456000000, }, json: `"123.456s"`, }, { data: ×tamppb.Timestamp{ Seconds: 1462875553, Nanos: 123000000, }, json: `"2016-05-10T10:19:13.123Z"`, }, { data: new(emptypb.Empty), json: "{}", }, { data: &structpb.Value{ Kind: new(structpb.Value_NullValue), }, json: "null", skipUnmarshal: true, }, { data: &structpb.Value{ Kind: &structpb.Value_NumberValue{ NumberValue: 123.4, }, }, json: "123.4", skipUnmarshal: true, }, { data: &structpb.Value{ Kind: &structpb.Value_StringValue{ StringValue: "abc", }, }, json: `"abc"`, skipUnmarshal: true, }, { data: &structpb.Value{ Kind: &structpb.Value_BoolValue{ BoolValue: true, }, }, json: "true", skipUnmarshal: true, }, { data: &structpb.Struct{ Fields: map[string]*structpb.Value{ "foo_bar": { Kind: &structpb.Value_BoolValue{ BoolValue: true, }, }, }, }, json: `{"foo_bar":true}`, skipUnmarshal: true, }, { data: wrapperspb.Bool(true), json: "true", }, { data: wrapperspb.Double(123.456), json: "123.456", }, { data: wrapperspb.Float(123.456), json: "123.456", }, { data: wrapperspb.Int32(-123), json: "-123", }, { data: wrapperspb.Int64(-123), json: `"-123"`, }, { data: wrapperspb.UInt32(123), json: "123", }, { data: wrapperspb.UInt64(123), json: `"123"`, }, // TODO(yugui) Add other well-known types once jsonpb supports them } ) func TestJSONPbUnmarshalNullField(t *testing.T) { var out map[string]interface{} const json = `{"foo": null}` marshaler := &runtime.JSONPb{} if err := marshaler.Unmarshal([]byte(json), &out); err != nil { t.Fatalf("unexpected error: %v", err) } value, hasKey := out["foo"] if !hasKey { t.Fatalf("unmarshaled map did not have key 'foo'") } if value != nil { t.Fatalf("unexpected value: %v", value) } } func TestJSONPbMarshalResponseBodies(t *testing.T) { marshaler := &runtime.JSONPb{} for i, spec := range []struct { input interface{} emitUnpopulated bool verifier func(*testing.T, interface{}, []byte) }{ { input: &examplepb.ResponseBodyOut{ Response: &examplepb.ResponseBodyOut_Response{Data: "abcdef"}, }, verifier: func(t *testing.T, input interface{}, json []byte) { var out examplepb.ResponseBodyOut err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, &out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { emitUnpopulated: true, input: &examplepb.ResponseBodyOut{}, verifier: func(t *testing.T, input interface{}, json []byte) { var out examplepb.ResponseBodyOut err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, &out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: &examplepb.RepeatedResponseBodyOut_Response{}, verifier: func(t *testing.T, input interface{}, json []byte) { var out examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, &out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { emitUnpopulated: true, input: &examplepb.RepeatedResponseBodyOut_Response{}, verifier: func(t *testing.T, input interface{}, json []byte) { var out examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, &out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: ([]*examplepb.RepeatedResponseBodyOut_Response)(nil), verifier: func(t *testing.T, input interface{}, json []byte) { var out []*examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { emitUnpopulated: true, input: ([]*examplepb.RepeatedResponseBodyOut_Response)(nil), verifier: func(t *testing.T, _ interface{}, json []byte) { var out []*examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff([]*examplepb.RepeatedResponseBodyOut_Response{}, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: []*examplepb.RepeatedResponseBodyOut_Response{}, verifier: func(t *testing.T, input interface{}, json []byte) { var out []*examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: []string{"something"}, verifier: func(t *testing.T, input interface{}, json []byte) { var out []string err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: []string{}, verifier: func(t *testing.T, input interface{}, json []byte) { var out []string err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: ([]string)(nil), verifier: func(t *testing.T, input interface{}, json []byte) { var out []string err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { emitUnpopulated: true, input: ([]string)(nil), verifier: func(t *testing.T, _ interface{}, json []byte) { var out []string err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff([]string{}, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { input: []*examplepb.RepeatedResponseBodyOut_Response{ {}, { Data: "abc", Type: examplepb.RepeatedResponseBodyOut_Response_A, }, }, verifier: func(t *testing.T, input interface{}, json []byte) { var out []*examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, { emitUnpopulated: true, input: []*examplepb.RepeatedResponseBodyOut_Response{ {}, { Data: "abc", Type: examplepb.RepeatedResponseBodyOut_Response_B, }, }, verifier: func(t *testing.T, input interface{}, json []byte) { var out []*examplepb.RepeatedResponseBodyOut_Response err := marshaler.Unmarshal(json, &out) if err != nil { t.Fatalf("unexpected error: %v", err) } diff := cmp.Diff(input, out, protocmp.Transform()) if diff != "" { t.Errorf("json not equal:\n%s", diff) } }, }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { m := runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: spec.emitUnpopulated, }, } val := spec.input buf, err := m.Marshal(val) if err != nil { t.Errorf("m.Marshal(%v) failed with %v; want success; spec=%v", val, err, spec) } if spec.verifier != nil { spec.verifier(t, spec.input, buf) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_proto.go000066400000000000000000000030561465037340600265540ustar00rootroot00000000000000package runtime import ( "errors" "io" "google.golang.org/protobuf/proto" ) // ProtoMarshaller is a Marshaller which marshals/unmarshals into/from serialize proto bytes type ProtoMarshaller struct{} // ContentType always returns "application/octet-stream". func (*ProtoMarshaller) ContentType(_ interface{}) string { return "application/octet-stream" } // Marshal marshals "value" into Proto func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) { message, ok := value.(proto.Message) if !ok { return nil, errors.New("unable to marshal non proto field") } return proto.Marshal(message) } // Unmarshal unmarshals proto "data" into "value" func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { message, ok := value.(proto.Message) if !ok { return errors.New("unable to unmarshal non proto field") } return proto.Unmarshal(data, message) } // NewDecoder returns a Decoder which reads proto stream from "reader". func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder { return DecoderFunc(func(value interface{}) error { buffer, err := io.ReadAll(reader) if err != nil { return err } return marshaller.Unmarshal(buffer, value) }) } // NewEncoder returns an Encoder which writes proto stream into "writer". func (marshaller *ProtoMarshaller) NewEncoder(writer io.Writer) Encoder { return EncoderFunc(func(value interface{}) error { buffer, err := marshaller.Marshal(value) if err != nil { return err } if _, err := writer.Write(buffer); err != nil { return err } return nil }) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshal_proto_test.go000066400000000000000000000042421465037340600276110ustar00rootroot00000000000000package runtime_test import ( "bytes" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" ) var message = &examplepb.ABitOfEverything{ SingleNested: &examplepb.ABitOfEverything_Nested{}, RepeatedStringValue: nil, MappedStringValue: nil, MappedNestedValue: nil, RepeatedEnumValue: nil, TimestampValue: ×tamppb.Timestamp{}, Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", Amount: 12345, }, }, Uint64Value: 0xFFFFFFFFFFFFFFFF, EnumValue: examplepb.NumericEnum_ONE, OneofValue: &examplepb.ABitOfEverything_OneofString{ OneofString: "bar", }, MapValue: map[string]examplepb.NumericEnum{ "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, } func TestProtoMarshalUnmarshal(t *testing.T) { marshaller := runtime.ProtoMarshaller{} // Marshal buffer, err := marshaller.Marshal(message) if err != nil { t.Fatalf("Marshalling returned error: %s", err.Error()) } // Unmarshal unmarshalled := &examplepb.ABitOfEverything{} err = marshaller.Unmarshal(buffer, unmarshalled) if err != nil { t.Fatalf("Unmarshalling returned error: %s", err.Error()) } if !proto.Equal(unmarshalled, message) { t.Errorf( "Unmarshalled didn't match original message: (original = %v) != (unmarshalled = %v)", unmarshalled, message, ) } } func TestProtoEncoderDecodert(t *testing.T) { marshaller := runtime.ProtoMarshaller{} var buf bytes.Buffer encoder := marshaller.NewEncoder(&buf) decoder := marshaller.NewDecoder(&buf) // Encode err := encoder.Encode(message) if err != nil { t.Fatalf("Encoding returned error: %s", err.Error()) } // Decode unencoded := &examplepb.ABitOfEverything{} err = decoder.Decode(unencoded) if err != nil { t.Fatalf("Unmarshalling returned error: %s", err.Error()) } if !proto.Equal(unencoded, message) { t.Errorf( "Unencoded didn't match original message: (original = %v) != (unencoded = %v)", unencoded, message, ) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshaler.go000066400000000000000000000031361465037340600256570ustar00rootroot00000000000000package runtime import ( "io" ) // Marshaler defines a conversion between byte sequence and gRPC payloads / fields. type Marshaler interface { // Marshal marshals "v" into byte sequence. Marshal(v interface{}) ([]byte, error) // Unmarshal unmarshals "data" into "v". // "v" must be a pointer value. Unmarshal(data []byte, v interface{}) error // NewDecoder returns a Decoder which reads byte sequence from "r". NewDecoder(r io.Reader) Decoder // NewEncoder returns an Encoder which writes bytes sequence into "w". NewEncoder(w io.Writer) Encoder // ContentType returns the Content-Type which this marshaler is responsible for. // The parameter describes the type which is being marshalled, which can sometimes // affect the content type returned. ContentType(v interface{}) string } // Decoder decodes a byte sequence type Decoder interface { Decode(v interface{}) error } // Encoder encodes gRPC payloads / fields into byte sequence. type Encoder interface { Encode(v interface{}) error } // DecoderFunc adapts an decoder function into Decoder. type DecoderFunc func(v interface{}) error // Decode delegates invocations to the underlying function itself. func (f DecoderFunc) Decode(v interface{}) error { return f(v) } // EncoderFunc adapts an encoder function into Encoder type EncoderFunc func(v interface{}) error // Encode delegates invocations to the underlying function itself. func (f EncoderFunc) Encode(v interface{}) error { return f(v) } // Delimited defines the streaming delimiter. type Delimited interface { // Delimiter returns the record separator for the stream. Delimiter() []byte } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshaler_registry.go000066400000000000000000000061671465037340600276160ustar00rootroot00000000000000package runtime import ( "errors" "mime" "net/http" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/encoding/protojson" ) // MIMEWildcard is the fallback MIME type used for requests which do not match // a registered MIME type. const MIMEWildcard = "*" var ( acceptHeader = http.CanonicalHeaderKey("Accept") contentTypeHeader = http.CanonicalHeaderKey("Content-Type") defaultMarshaler = &HTTPBodyMarshaler{ Marshaler: &JSONPb{ MarshalOptions: protojson.MarshalOptions{ EmitUnpopulated: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }, } ) // MarshalerForRequest returns the inbound/outbound marshalers for this request. // It checks the registry on the ServeMux for the MIME type set by the Content-Type header. // If it isn't set (or the request Content-Type is empty), checks for "*". // If there are multiple Content-Type headers set, choose the first one that it can // exactly match in the registry. // Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { for _, acceptVal := range r.Header[acceptHeader] { if m, ok := mux.marshalers.mimeMap[acceptVal]; ok { outbound = m break } } for _, contentTypeVal := range r.Header[contentTypeHeader] { contentType, _, err := mime.ParseMediaType(contentTypeVal) if err != nil { grpclog.Errorf("Failed to parse Content-Type %s: %v", contentTypeVal, err) continue } if m, ok := mux.marshalers.mimeMap[contentType]; ok { inbound = m break } } if inbound == nil { inbound = mux.marshalers.mimeMap[MIMEWildcard] } if outbound == nil { outbound = inbound } return inbound, outbound } // marshalerRegistry is a mapping from MIME types to Marshalers. type marshalerRegistry struct { mimeMap map[string]Marshaler } // add adds a marshaler for a case-sensitive MIME type string ("*" to match any // MIME type). func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { if len(mime) == 0 { return errors.New("empty MIME type") } m.mimeMap[mime] = marshaler return nil } // makeMarshalerMIMERegistry returns a new registry of marshalers. // It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. // // For example, you could allow the client to specify the use of the runtime.JSONPb marshaler // with a "application/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler // with a "application/json" Content-Type. // "*" can be used to match any Content-Type. // This can be attached to a ServerMux with the marshaler option. func makeMarshalerMIMERegistry() marshalerRegistry { return marshalerRegistry{ mimeMap: map[string]Marshaler{ MIMEWildcard: defaultMarshaler, }, } } // WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound // Marshalers to a MIME type in mux. func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { return func(mux *ServeMux) { if err := mux.marshalers.add(mime, marshaler); err != nil { panic(err) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/marshaler_registry_test.go000066400000000000000000000067371465037340600306600ustar00rootroot00000000000000package runtime_test import ( "context" "errors" "fmt" "io" "net/http" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" ) func TestMarshalerForRequest(t *testing.T) { ctx := context.Background() r, err := http.NewRequestWithContext(ctx, "GET", "http://example.com", nil) if err != nil { t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) } mux := runtime.NewServeMux() r.Header.Set("Accept", "application/x-out") r.Header.Set("Content-Type", "application/x-in") in, out := runtime.MarshalerForRequest(mux, r) if _, ok := in.(*runtime.HTTPBodyMarshaler); !ok { t.Errorf("in = %#v; want a runtime.HTTPBodyMarshaler", in) } if _, ok := out.(*runtime.HTTPBodyMarshaler); !ok { t.Errorf("out = %#v; want a runtime.HTTPBodyMarshaler", in) } marshalers := []dummyMarshaler{0, 1, 2} specs := []struct { opt runtime.ServeMuxOption wantIn runtime.Marshaler wantOut runtime.Marshaler }{ // The option with wildcard overwrites the default configuration { opt: runtime.WithMarshalerOption(runtime.MIMEWildcard, &marshalers[0]), wantIn: &marshalers[0], wantOut: &marshalers[0], }, // You can specify a marshaler for a specific MIME type. // The output marshaler follows the input one unless specified. { opt: runtime.WithMarshalerOption("application/x-in", &marshalers[1]), wantIn: &marshalers[1], wantOut: &marshalers[1], }, // You can also separately specify an output marshaler { opt: runtime.WithMarshalerOption("application/x-out", &marshalers[2]), wantIn: &marshalers[1], wantOut: &marshalers[2], }, } for i, spec := range specs { var opts []runtime.ServeMuxOption for _, s := range specs[:i+1] { opts = append(opts, s.opt) } mux = runtime.NewServeMux(opts...) in, out = runtime.MarshalerForRequest(mux, r) if got, want := in, spec.wantIn; got != want { t.Errorf("in = %#v; want %#v", got, want) } if got, want := out, spec.wantOut; got != want { t.Errorf("out = %#v; want %#v", got, want) } } r.Header.Set("Content-Type", "application/x-in; charset=UTF-8") in, out = runtime.MarshalerForRequest(mux, r) if got, want := in, &marshalers[1]; got != want { t.Errorf("in = %#v; want %#v", got, want) } if got, want := out, &marshalers[2]; got != want { t.Errorf("out = %#v; want %#v", got, want) } r.Header.Set("Content-Type", "application/x-another") r.Header.Set("Accept", "application/x-another") in, out = runtime.MarshalerForRequest(mux, r) if got, want := in, &marshalers[0]; got != want { t.Errorf("in = %#v; want %#v", got, want) } if got, want := out, &marshalers[0]; got != want { t.Errorf("out = %#v; want %#v", got, want) } } type dummyMarshaler int func (dummyMarshaler) ContentType(_ interface{}) string { return "" } func (dummyMarshaler) Marshal(interface{}) ([]byte, error) { return nil, errors.New("not implemented") } func (dummyMarshaler) Unmarshal([]byte, interface{}) error { return errors.New("not implemented") } func (dummyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return dummyDecoder{} } func (dummyMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return dummyEncoder{} } func (m dummyMarshaler) GoString() string { return fmt.Sprintf("dummyMarshaler(%d)", m) } type dummyDecoder struct{} func (dummyDecoder) Decode(interface{}) error { return errors.New("not implemented") } type dummyEncoder struct{} func (dummyEncoder) Encode(interface{}) error { return errors.New("not implemented") } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/mux.go000066400000000000000000000446531465037340600245230ustar00rootroot00000000000000package runtime import ( "context" "errors" "fmt" "net/http" "net/textproto" "regexp" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) // UnescapingMode defines the behavior of ServeMux when unescaping path parameters. type UnescapingMode int const ( // UnescapingModeLegacy is the default V2 behavior, which escapes the entire // path string before doing any routing. UnescapingModeLegacy UnescapingMode = iota // UnescapingModeAllExceptReserved unescapes all path parameters except RFC 6570 // reserved characters. UnescapingModeAllExceptReserved // UnescapingModeAllExceptSlash unescapes URL path parameters except path // separators, which will be left as "%2F". UnescapingModeAllExceptSlash // UnescapingModeAllCharacters unescapes all URL path parameters. UnescapingModeAllCharacters // UnescapingModeDefault is the default escaping type. // TODO(v3): default this to UnescapingModeAllExceptReserved per grpc-httpjson-transcoding's // reference implementation UnescapingModeDefault = UnescapingModeLegacy ) var encodedPathSplitter = regexp.MustCompile("(/|%2F)") // A HandlerFunc handles a specific pair of path pattern and HTTP method. type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) // ServeMux is a request multiplexer for grpc-gateway. // It matches http requests to patterns and invokes the corresponding handler. type ServeMux struct { // handlers maps HTTP method to a list of handlers. handlers map[string][]handler forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error marshalers marshalerRegistry incomingHeaderMatcher HeaderMatcherFunc outgoingHeaderMatcher HeaderMatcherFunc outgoingTrailerMatcher HeaderMatcherFunc metadataAnnotators []func(context.Context, *http.Request) metadata.MD errorHandler ErrorHandlerFunc streamErrorHandler StreamErrorHandlerFunc routingErrorHandler RoutingErrorHandlerFunc disablePathLengthFallback bool unescapingMode UnescapingMode } // ServeMuxOption is an option that can be given to a ServeMux on construction. type ServeMuxOption func(*ServeMux) // WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption. // // forwardResponseOption is an option that will be called on the relevant context.Context, // http.ResponseWriter, and proto.Message before every forwarded response. // // The message may be nil in the case where just a header is being sent. func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption) } } // WithUnescapingMode sets the escaping type. See the definitions of UnescapingMode // for more information. func WithUnescapingMode(mode UnescapingMode) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.unescapingMode = mode } } // SetQueryParameterParser sets the query parameter parser, used to populate message from query parameters. // Configuring this will mean the generated OpenAPI output is no longer correct, and it should be // done with careful consideration. func SetQueryParameterParser(queryParameterParser QueryParameterParser) ServeMuxOption { return func(serveMux *ServeMux) { currentQueryParser = queryParameterParser } } // HeaderMatcherFunc checks whether a header key should be forwarded to/from gRPC context. type HeaderMatcherFunc func(string) (string, bool) // DefaultHeaderMatcher is used to pass http request headers to/from gRPC context. This adds permanent HTTP header // keys (as specified by the IANA, e.g: Accept, Cookie, Host) to the gRPC metadata with the grpcgateway- prefix. If you want to know which headers are considered permanent, you can view the isPermanentHTTPHeader function. // HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata after removing the prefix 'Grpc-Metadata-'. // Other headers are not added to the gRPC metadata. func DefaultHeaderMatcher(key string) (string, bool) { switch key = textproto.CanonicalMIMEHeaderKey(key); { case isPermanentHTTPHeader(key): return MetadataPrefix + key, true case strings.HasPrefix(key, MetadataHeaderPrefix): return key[len(MetadataHeaderPrefix):], true } return "", false } func defaultOutgoingHeaderMatcher(key string) (string, bool) { return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true } func defaultOutgoingTrailerMatcher(key string) (string, bool) { return fmt.Sprintf("%s%s", MetadataTrailerPrefix, key), true } // WithIncomingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for incoming request to gateway. // // This matcher will be called with each header in http.Request. If matcher returns true, that header will be // passed to gRPC context. To transform the header before passing to gRPC context, matcher should return the modified header. func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { for _, header := range fn.matchedMalformedHeaders() { grpclog.Warningf("The configured forwarding filter would allow %q to be sent to the gRPC server, which will likely cause errors. See https://github.com/grpc/grpc-go/pull/4803#issuecomment-986093310 for more information.", header) } return func(mux *ServeMux) { mux.incomingHeaderMatcher = fn } } // matchedMalformedHeaders returns the malformed headers that would be forwarded to gRPC server. func (fn HeaderMatcherFunc) matchedMalformedHeaders() []string { if fn == nil { return nil } headers := make([]string, 0) for header := range malformedHTTPHeaders { out, accept := fn(header) if accept && isMalformedHTTPHeader(out) { headers = append(headers, out) } } return headers } // WithOutgoingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. // // This matcher will be called with each header in response header metadata. If matcher returns true, that header will be // passed to http response returned from gateway. To transform the header before passing to response, // matcher should return the modified header. func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { return func(mux *ServeMux) { mux.outgoingHeaderMatcher = fn } } // WithOutgoingTrailerMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. // // This matcher will be called with each header in response trailer metadata. If matcher returns true, that header will be // passed to http response returned from gateway. To transform the header before passing to response, // matcher should return the modified header. func WithOutgoingTrailerMatcher(fn HeaderMatcherFunc) ServeMuxOption { return func(mux *ServeMux) { mux.outgoingTrailerMatcher = fn } } // WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context. // // This can be used by services that need to read from http.Request and modify gRPC context. A common use case // is reading token from cookie and adding it in gRPC context. func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator) } } // WithErrorHandler returns a ServeMuxOption for configuring a custom error handler. // // This can be used to configure a custom error response. func WithErrorHandler(fn ErrorHandlerFunc) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.errorHandler = fn } } // WithStreamErrorHandler returns a ServeMuxOption that will use the given custom stream // error handler, which allows for customizing the error trailer for server-streaming // calls. // // For stream errors that occur before any response has been written, the mux's // ErrorHandler will be invoked. However, once data has been written, the errors must // be handled differently: they must be included in the response body. The response body's // final message will include the error details returned by the stream error handler. func WithStreamErrorHandler(fn StreamErrorHandlerFunc) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.streamErrorHandler = fn } } // WithRoutingErrorHandler returns a ServeMuxOption for configuring a custom error handler to handle http routing errors. // // Method called for errors which can happen before gRPC route selected or executed. // The following error codes: StatusMethodNotAllowed StatusNotFound StatusBadRequest func WithRoutingErrorHandler(fn RoutingErrorHandlerFunc) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.routingErrorHandler = fn } } // WithDisablePathLengthFallback returns a ServeMuxOption for disable path length fallback. func WithDisablePathLengthFallback() ServeMuxOption { return func(serveMux *ServeMux) { serveMux.disablePathLengthFallback = true } } // WithHealthEndpointAt returns a ServeMuxOption that will add an endpoint to the created ServeMux at the path specified by endpointPath. // When called the handler will forward the request to the upstream grpc service health check (defined in the // gRPC Health Checking Protocol). // // See here https://grpc-ecosystem.github.io/grpc-gateway/docs/operations/health_check/ for more information on how // to setup the protocol in the grpc server. // // If you define a service as query parameter, this will also be forwarded as service in the HealthCheckRequest. func WithHealthEndpointAt(healthCheckClient grpc_health_v1.HealthClient, endpointPath string) ServeMuxOption { return func(s *ServeMux) { // error can be ignored since pattern is definitely valid _ = s.HandlePath( http.MethodGet, endpointPath, func(w http.ResponseWriter, r *http.Request, _ map[string]string, ) { _, outboundMarshaler := MarshalerForRequest(s, r) resp, err := healthCheckClient.Check(r.Context(), &grpc_health_v1.HealthCheckRequest{ Service: r.URL.Query().Get("service"), }) if err != nil { s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) return } w.Header().Set("Content-Type", "application/json") if resp.GetStatus() != grpc_health_v1.HealthCheckResponse_SERVING { switch resp.GetStatus() { case grpc_health_v1.HealthCheckResponse_NOT_SERVING, grpc_health_v1.HealthCheckResponse_UNKNOWN: err = status.Error(codes.Unavailable, resp.String()) case grpc_health_v1.HealthCheckResponse_SERVICE_UNKNOWN: err = status.Error(codes.NotFound, resp.String()) } s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) return } _ = outboundMarshaler.NewEncoder(w).Encode(resp) }) } } // WithHealthzEndpoint returns a ServeMuxOption that will add a /healthz endpoint to the created ServeMux. // // See WithHealthEndpointAt for the general implementation. func WithHealthzEndpoint(healthCheckClient grpc_health_v1.HealthClient) ServeMuxOption { return WithHealthEndpointAt(healthCheckClient, "/healthz") } // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), errorHandler: DefaultHTTPErrorHandler, streamErrorHandler: DefaultStreamErrorHandler, routingErrorHandler: DefaultRoutingErrorHandler, unescapingMode: UnescapingModeDefault, } for _, opt := range opts { opt(serveMux) } if serveMux.incomingHeaderMatcher == nil { serveMux.incomingHeaderMatcher = DefaultHeaderMatcher } if serveMux.outgoingHeaderMatcher == nil { serveMux.outgoingHeaderMatcher = defaultOutgoingHeaderMatcher } if serveMux.outgoingTrailerMatcher == nil { serveMux.outgoingTrailerMatcher = defaultOutgoingTrailerMatcher } return serveMux } // Handle associates "h" to the pair of HTTP method and path pattern. func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { s.handlers[meth] = append([]handler{{pat: pat, h: h}}, s.handlers[meth]...) } // HandlePath allows users to configure custom path handlers. // refer: https://grpc-ecosystem.github.io/grpc-gateway/docs/operations/inject_router/ func (s *ServeMux) HandlePath(meth string, pathPattern string, h HandlerFunc) error { compiler, err := httprule.Parse(pathPattern) if err != nil { return fmt.Errorf("parsing path pattern: %w", err) } tp := compiler.Compile() pattern, err := NewPattern(tp.Version, tp.OpCodes, tp.Pool, tp.Verb) if err != nil { return fmt.Errorf("creating new pattern: %w", err) } s.Handle(meth, pattern, h) return nil } // ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.URL.Path. func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() path := r.URL.Path if !strings.HasPrefix(path, "/") { _, outboundMarshaler := MarshalerForRequest(s, r) s.routingErrorHandler(ctx, s, outboundMarshaler, w, r, http.StatusBadRequest) return } // TODO(v3): remove UnescapingModeLegacy if s.unescapingMode != UnescapingModeLegacy && r.URL.RawPath != "" { path = r.URL.RawPath } if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { if err := r.ParseForm(); err != nil { _, outboundMarshaler := MarshalerForRequest(s, r) sterr := status.Error(codes.InvalidArgument, err.Error()) s.errorHandler(ctx, s, outboundMarshaler, w, r, sterr) return } r.Method = strings.ToUpper(override) } var pathComponents []string // since in UnescapeModeLegacy, the URL will already have been fully unescaped, if we also split on "%2F" // in this escaping mode we would be double unescaping but in UnescapingModeAllCharacters, we still do as the // path is the RawPath (i.e. unescaped). That does mean that the behavior of this function will change its default // behavior when the UnescapingModeDefault gets changed from UnescapingModeLegacy to UnescapingModeAllExceptReserved if s.unescapingMode == UnescapingModeAllCharacters { pathComponents = encodedPathSplitter.Split(path[1:], -1) } else { pathComponents = strings.Split(path[1:], "/") } lastPathComponent := pathComponents[len(pathComponents)-1] for _, h := range s.handlers[r.Method] { // If the pattern has a verb, explicitly look for a suffix in the last // component that matches a colon plus the verb. This allows us to // handle some cases that otherwise can't be correctly handled by the // former LastIndex case, such as when the verb literal itself contains // a colon. This should work for all cases that have run through the // parser because we know what verb we're looking for, however, there // are still some cases that the parser itself cannot disambiguate. See // the comment there if interested. var verb string patVerb := h.pat.Verb() idx := -1 if patVerb != "" && strings.HasSuffix(lastPathComponent, ":"+patVerb) { idx = len(lastPathComponent) - len(patVerb) - 1 } if idx == 0 { _, outboundMarshaler := MarshalerForRequest(s, r) s.routingErrorHandler(ctx, s, outboundMarshaler, w, r, http.StatusNotFound) return } comps := make([]string, len(pathComponents)) copy(comps, pathComponents) if idx > 0 { comps[len(comps)-1], verb = lastPathComponent[:idx], lastPathComponent[idx+1:] } pathParams, err := h.pat.MatchAndEscape(comps, verb, s.unescapingMode) if err != nil { var mse MalformedSequenceError if ok := errors.As(err, &mse); ok { _, outboundMarshaler := MarshalerForRequest(s, r) s.errorHandler(ctx, s, outboundMarshaler, w, r, &HTTPStatusError{ HTTPStatus: http.StatusBadRequest, Err: mse, }) } continue } h.h(w, r, pathParams) return } // if no handler has found for the request, lookup for other methods // to handle POST -> GET fallback if the request is subject to path // length fallback. // Note we are not eagerly checking the request here as we want to return the // right HTTP status code, and we need to process the fallback candidates in // order to do that. for m, handlers := range s.handlers { if m == r.Method { continue } for _, h := range handlers { var verb string patVerb := h.pat.Verb() idx := -1 if patVerb != "" && strings.HasSuffix(lastPathComponent, ":"+patVerb) { idx = len(lastPathComponent) - len(patVerb) - 1 } comps := make([]string, len(pathComponents)) copy(comps, pathComponents) if idx > 0 { comps[len(comps)-1], verb = lastPathComponent[:idx], lastPathComponent[idx+1:] } pathParams, err := h.pat.MatchAndEscape(comps, verb, s.unescapingMode) if err != nil { var mse MalformedSequenceError if ok := errors.As(err, &mse); ok { _, outboundMarshaler := MarshalerForRequest(s, r) s.errorHandler(ctx, s, outboundMarshaler, w, r, &HTTPStatusError{ HTTPStatus: http.StatusBadRequest, Err: mse, }) } continue } // X-HTTP-Method-Override is optional. Always allow fallback to POST. // Also, only consider POST -> GET fallbacks, and avoid falling back to // potentially dangerous operations like DELETE. if s.isPathLengthFallback(r) && m == http.MethodGet { if err := r.ParseForm(); err != nil { _, outboundMarshaler := MarshalerForRequest(s, r) sterr := status.Error(codes.InvalidArgument, err.Error()) s.errorHandler(ctx, s, outboundMarshaler, w, r, sterr) return } h.h(w, r, pathParams) return } _, outboundMarshaler := MarshalerForRequest(s, r) s.routingErrorHandler(ctx, s, outboundMarshaler, w, r, http.StatusMethodNotAllowed) return } } _, outboundMarshaler := MarshalerForRequest(s, r) s.routingErrorHandler(ctx, s, outboundMarshaler, w, r, http.StatusNotFound) } // GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux. func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error { return s.forwardResponseOptions } func (s *ServeMux) isPathLengthFallback(r *http.Request) bool { return !s.disablePathLengthFallback && r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" } type handler struct { pat Pattern h HandlerFunc } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/mux_internal_test.go000066400000000000000000000017671465037340600274550ustar00rootroot00000000000000package runtime import ( "sort" "testing" ) func TestWithIncomingHeaderMatcher_matchedMalformedHeaders(t *testing.T) { tests := []struct { name string matcher HeaderMatcherFunc want []string }{ { "nil matcher returns nothing", nil, nil, }, { "default matcher returns nothing", DefaultHeaderMatcher, nil, }, { "passthrough matcher returns all malformed headers", func(s string) (string, bool) { return s, true }, []string{"connection"}, }, } sliceEqual := func(a, b []string) bool { if len(a) != len(b) { return false } sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) sort.Slice(b, func(i, j int) bool { return a[i] < a[j] }) for idx := range a { if a[idx] != b[idx] { return false } } return true } for _, tt := range tests { out := tt.matcher.matchedMalformedHeaders() if !sliceEqual(tt.want, out) { t.Errorf("matchedMalformedHeaders not match; Want %v; got %v", tt.want, out) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/mux_test.go000066400000000000000000000525661465037340600255640ustar00rootroot00000000000000package runtime_test import ( "bytes" "context" "fmt" "net/http" "net/http/httptest" "net/url" "strconv" "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/status" ) func TestMuxServeHTTP(t *testing.T) { type stubPattern struct { method string ops []int pool []string verb string } for i, spec := range []struct { patterns []stubPattern reqMethod string reqPath string headers map[string]string respStatus int respContent string disablePathLengthFallback bool unescapingMode runtime.UnescapingMode }{ { patterns: nil, reqMethod: "GET", reqPath: "/", respStatus: http.StatusNotFound, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "GET", reqPath: "/foo", respStatus: http.StatusOK, respContent: "GET /foo", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "GET", reqPath: "/bar", respStatus: http.StatusNotFound, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpPush), 0}, }, { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "GET", reqPath: "/foo", respStatus: http.StatusOK, respContent: "GET /foo", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, { method: "POST", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", respStatus: http.StatusOK, respContent: "POST /foo", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "DELETE", reqPath: "/foo", respStatus: http.StatusNotImplemented, }, { patterns: []stubPattern{ { method: "POST", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, verb: "archive", }, }, reqMethod: "DELETE", reqPath: "/foo/bar:archive", respStatus: http.StatusNotImplemented, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", }, respStatus: http.StatusOK, respContent: "GET /foo", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", }, respStatus: http.StatusNotImplemented, disablePathLengthFallback: true, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, { method: "POST", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", }, respStatus: http.StatusOK, respContent: "POST /foo", disablePathLengthFallback: true, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, { method: "POST", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", "X-HTTP-Method-Override": "GET", }, respStatus: http.StatusOK, respContent: "GET /foo", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", }, respStatus: http.StatusOK, respContent: "GET /foo", }, { patterns: []stubPattern{ { method: "DELETE", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, { method: "PUT", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, { method: "PATCH", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/x-www-form-urlencoded", }, respStatus: http.StatusNotImplemented, }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "/foo", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusNotImplemented, }, { patterns: []stubPattern{ { method: "POST", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, verb: "bar", }, }, reqMethod: "POST", reqPath: "/foo:bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "POST /foo:bar", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, verb: "verb", }, }, reqMethod: "GET", reqPath: "/foo/bar:verb", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "GET /foo/{id=*}:verb", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, }, reqMethod: "GET", reqPath: "/foo/bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "GET /foo/{id=*}", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, }, reqMethod: "GET", reqPath: "/foo/bar:123", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "GET /foo/{id=*}", }, { patterns: []stubPattern{ { method: "POST", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, { method: "POST", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, verb: "verb", }, }, reqMethod: "POST", reqPath: "/foo/bar:verb", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "POST /foo/{id=*}:verb", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"foo"}, }, }, reqMethod: "POST", reqPath: "foo", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusBadRequest, }, { patterns: []stubPattern{ { method: "POST", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, { method: "POST", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, verb: "verb:subverb", }, }, reqMethod: "POST", reqPath: "/foo/bar:verb:subverb", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, respContent: "POST /foo/{id=*}:verb:subverb", }, { patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 1, int(utilities.OpCapture), 1, int(utilities.OpLitPush), 2}, pool: []string{"foo", "id", "bar"}, }, }, reqMethod: "POST", reqPath: "/foo/404%2fwith%2Fspace/bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusNotFound, unescapingMode: runtime.UnescapingModeLegacy, }, { patterns: []stubPattern{ { method: "GET", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, int(utilities.OpLitPush), 2}, pool: []string{"foo", "id", "bar"}, }, }, reqMethod: "GET", reqPath: "/foo/success%2fwith%2Fspace/bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, unescapingMode: runtime.UnescapingModeAllExceptReserved, respContent: "GET /foo/{id=*}/bar", }, { patterns: []stubPattern{ { method: "GET", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, int(utilities.OpLitPush), 2}, pool: []string{"foo", "id", "bar"}, }, }, reqMethod: "GET", reqPath: "/foo/success%2fwith%2Fspace/bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusNotFound, unescapingMode: runtime.UnescapingModeAllCharacters, }, { patterns: []stubPattern{ { method: "GET", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, int(utilities.OpLitPush), 2}, pool: []string{"foo", "id", "bar"}, }, }, reqMethod: "GET", reqPath: "/foo/success%2fwith%2Fspace/bar", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusNotFound, unescapingMode: runtime.UnescapingModeLegacy, }, { patterns: []stubPattern{ { method: "GET", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPushM), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, }, pool: []string{"foo", "id", "bar"}, }, }, reqMethod: "GET", reqPath: "/foo/success%2fwith%2Fspace", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, unescapingMode: runtime.UnescapingModeAllExceptReserved, respContent: "GET /foo/{id=**}", }, { patterns: []stubPattern{ { method: "POST", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpLitPush), 2, int(utilities.OpPush), 0, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 3, }, pool: []string{"api", "v1", "organizations", "name"}, verb: "action", }, }, reqMethod: "POST", reqPath: "/api/v1/" + url.QueryEscape("organizations/foo") + ":action", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, unescapingMode: runtime.UnescapingModeAllCharacters, respContent: "POST /api/v1/{name=organizations/*}:action", }, { patterns: []stubPattern{ { method: "POST", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpLitPush), 2, }, pool: []string{"api", "v1", "organizations"}, verb: "verb", }, { method: "POST", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpLitPush), 2, }, pool: []string{"api", "v1", "organizations"}, verb: "", }, { method: "POST", ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpLitPush), 2, }, pool: []string{"api", "v1", "dummies"}, verb: "verb", }, }, reqMethod: "POST", reqPath: "/api/v1/organizations:verb", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, unescapingMode: runtime.UnescapingModeAllCharacters, respContent: "POST /api/v1/organizations:verb", }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { var opts []runtime.ServeMuxOption opts = append(opts, runtime.WithUnescapingMode(spec.unescapingMode)) if spec.disablePathLengthFallback { opts = append(opts, runtime.WithDisablePathLengthFallback(), ) } mux := runtime.NewServeMux(opts...) for _, p := range spec.patterns { func(p stubPattern) { pat, err := runtime.NewPattern(1, p.ops, p.pool, p.verb) if err != nil { t.Fatalf("runtime.NewPattern(1, %#v, %#v, %q) failed with %v; want success", p.ops, p.pool, p.verb, err) } mux.Handle(p.method, pat, func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { _, _ = fmt.Fprintf(w, "%s %s", p.method, pat.String()) }) }(p) } reqUrl := fmt.Sprintf("https://host.example%s", spec.reqPath) ctx := context.Background() r, err := http.NewRequestWithContext(ctx, spec.reqMethod, reqUrl, bytes.NewReader(nil)) if err != nil { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", spec.reqMethod, reqUrl, err) } for name, value := range spec.headers { r.Header.Set(name, value) } w := httptest.NewRecorder() mux.ServeHTTP(w, r) if got, want := w.Code, spec.respStatus; got != want { t.Errorf("w.Code = %d; want %d; patterns=%v; req=%v", got, want, spec.patterns, r) } if spec.respContent != "" { if got, want := w.Body.String(), spec.respContent; got != want { t.Errorf("w.Body = %q; want %q; patterns=%v; req=%v", got, want, spec.patterns, r) } } }) } } func TestServeHTTP_WithMethodOverrideAndFormParsing(t *testing.T) { r := httptest.NewRequest("POST", "/foo", strings.NewReader("bar=hoge")) r.Header.Set("Content-Type", "application/x-www-form-urlencoded") r.Header.Set("X-HTTP-Method-Override", "GET") w := httptest.NewRecorder() runtime.NewServeMux().ServeHTTP(w, r) if r.FormValue("bar") != "hoge" { t.Error("form is not parsed") } } var defaultHeaderMatcherTests = []struct { name string in string outValue string outValid bool }{ { "permanent HTTP header should return prefixed", "Accept", "grpcgateway-Accept", true, }, { "key prefixed with MetadataHeaderPrefix should return without the prefix", "Grpc-Metadata-Custom-Header", "Custom-Header", true, }, { "non-permanent HTTP header key without prefix should not return", "Custom-Header", "", false, }, } func TestDefaultHeaderMatcher(t *testing.T) { for _, tt := range defaultHeaderMatcherTests { t.Run(tt.name, func(t *testing.T) { out, valid := runtime.DefaultHeaderMatcher(tt.in) if out != tt.outValue { t.Errorf("got %v, want %v", out, tt.outValue) } if valid != tt.outValid { t.Errorf("got %v, want %v", valid, tt.outValid) } }) } } var defaultRouteMatcherTests = []struct { name string method string path string valid bool }{ { "Test route /", "GET", "/", true, }, { "Simple Endpoint", "GET", "/v1/{bucket}/do:action", true, }, { "Complex Endpoint", "POST", "/v1/b/{bucket_name=buckets/*}/o/{name}", true, }, { "Wildcard Endpoint", "GET", "/v1/endpoint/*", true, }, { "Invalid Endpoint", "POST", "v1/b/:name/do", false, }, } func TestServeMux_HandlePath(t *testing.T) { mux := runtime.NewServeMux() testFn := func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { } for _, tt := range defaultRouteMatcherTests { t.Run(tt.name, func(t *testing.T) { err := mux.HandlePath(tt.method, tt.path, testFn) if tt.valid && err != nil { t.Errorf("The route %v with method %v and path %v invalid, got %v", tt.name, tt.method, tt.path, err) } if !tt.valid && err == nil { t.Errorf("The route %v with method %v and path %v should be invalid", tt.name, tt.method, tt.path) } }) } } var healthCheckTests = []struct { name string code codes.Code status grpc_health_v1.HealthCheckResponse_ServingStatus httpStatusCode int }{ { "Test grpc error code", codes.NotFound, grpc_health_v1.HealthCheckResponse_UNKNOWN, http.StatusNotFound, }, { "Test HealthCheckResponse_SERVING", codes.OK, grpc_health_v1.HealthCheckResponse_SERVING, http.StatusOK, }, { "Test HealthCheckResponse_NOT_SERVING", codes.OK, grpc_health_v1.HealthCheckResponse_NOT_SERVING, http.StatusServiceUnavailable, }, { "Test HealthCheckResponse_UNKNOWN", codes.OK, grpc_health_v1.HealthCheckResponse_UNKNOWN, http.StatusServiceUnavailable, }, { "Test HealthCheckResponse_SERVICE_UNKNOWN", codes.OK, grpc_health_v1.HealthCheckResponse_SERVICE_UNKNOWN, http.StatusNotFound, }, } func TestWithHealthzEndpoint_codes(t *testing.T) { for _, tt := range healthCheckTests { t.Run(tt.name, func(t *testing.T) { mux := runtime.NewServeMux(runtime.WithHealthzEndpoint(&dummyHealthCheckClient{status: tt.status, code: tt.code})) r := httptest.NewRequest(http.MethodGet, "/healthz", nil) rr := httptest.NewRecorder() mux.ServeHTTP(rr, r) if rr.Code != tt.httpStatusCode { t.Errorf( "result http status code for grpc code %q and status %q should be %d, got %d", tt.code, tt.status, tt.httpStatusCode, rr.Code, ) } }) } } func TestWithHealthEndpointAt_consistentWithHealthz(t *testing.T) { const endpointPath = "/healthz" r := httptest.NewRequest(http.MethodGet, endpointPath, nil) for _, tt := range healthCheckTests { tt := tt t.Run(tt.name, func(t *testing.T) { client := &dummyHealthCheckClient{ status: tt.status, code: tt.code, } w := httptest.NewRecorder() runtime.NewServeMux( runtime.WithHealthEndpointAt(client, endpointPath), ).ServeHTTP(w, r) refW := httptest.NewRecorder() runtime.NewServeMux( runtime.WithHealthzEndpoint(client), ).ServeHTTP(refW, r) if w.Code != refW.Code { t.Errorf( "result http status code for grpc code %q and status %q should be equal to %d, but got %d", tt.code, tt.status, refW.Code, w.Code, ) } }) } } func TestWithHealthzEndpoint_serviceParam(t *testing.T) { service := "test" // trigger error to output service in body dummyClient := dummyHealthCheckClient{status: grpc_health_v1.HealthCheckResponse_UNKNOWN, code: codes.Unknown} mux := runtime.NewServeMux(runtime.WithHealthzEndpoint(&dummyClient)) r := httptest.NewRequest(http.MethodGet, "/healthz?service="+service, nil) rr := httptest.NewRecorder() mux.ServeHTTP(rr, r) if !strings.Contains(rr.Body.String(), service) { t.Errorf( "service query parameter should be translated to HealthCheckRequest: expected %s to contain %s", rr.Body.String(), service, ) } } func TestWithHealthzEndpoint_header(t *testing.T) { for _, tt := range healthCheckTests { t.Run(tt.name, func(t *testing.T) { mux := runtime.NewServeMux(runtime.WithHealthzEndpoint(&dummyHealthCheckClient{status: tt.status, code: tt.code})) r := httptest.NewRequest(http.MethodGet, "/healthz", nil) rr := httptest.NewRecorder() mux.ServeHTTP(rr, r) if actualHeader := rr.Header().Get("Content-Type"); actualHeader != "application/json" { t.Errorf( "result http header Content-Type for grpc code %q and status %q should be application/json, got %s", tt.code, tt.status, actualHeader, ) } }) } } var _ grpc_health_v1.HealthClient = (*dummyHealthCheckClient)(nil) type dummyHealthCheckClient struct { status grpc_health_v1.HealthCheckResponse_ServingStatus code codes.Code } func (g *dummyHealthCheckClient) Check(ctx context.Context, r *grpc_health_v1.HealthCheckRequest, opts ...grpc.CallOption) (*grpc_health_v1.HealthCheckResponse, error) { if g.code != codes.OK { return nil, status.Error(g.code, r.GetService()) } return &grpc_health_v1.HealthCheckResponse{Status: g.status}, nil } func (g *dummyHealthCheckClient) Watch(ctx context.Context, r *grpc_health_v1.HealthCheckRequest, opts ...grpc.CallOption) (grpc_health_v1.Health_WatchClient, error) { return nil, status.Error(codes.Unimplemented, "unimplemented") } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/pattern.go000066400000000000000000000225731465037340600253640ustar00rootroot00000000000000package runtime import ( "errors" "fmt" "strconv" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc/grpclog" ) var ( // ErrNotMatch indicates that the given HTTP request path does not match to the pattern. ErrNotMatch = errors.New("not match to the path pattern") // ErrInvalidPattern indicates that the given definition of Pattern is not valid. ErrInvalidPattern = errors.New("invalid pattern") ) type MalformedSequenceError string func (e MalformedSequenceError) Error() string { return "malformed path escape " + strconv.Quote(string(e)) } type op struct { code utilities.OpCode operand int } // Pattern is a template pattern of http request paths defined in // https://github.com/googleapis/googleapis/blob/master/google/api/http.proto type Pattern struct { // ops is a list of operations ops []op // pool is a constant pool indexed by the operands or vars. pool []string // vars is a list of variables names to be bound by this pattern vars []string // stacksize is the max depth of the stack stacksize int // tailLen is the length of the fixed-size segments after a deep wildcard tailLen int // verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part. verb string } // NewPattern returns a new Pattern from the given definition values. // "ops" is a sequence of op codes. "pool" is a constant pool. // "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. // "version" must be 1 for now. // It returns an error if the given definition is invalid. func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { if version != 1 { grpclog.Errorf("unsupported version: %d", version) return Pattern{}, ErrInvalidPattern } l := len(ops) if l%2 != 0 { grpclog.Errorf("odd number of ops codes: %d", l) return Pattern{}, ErrInvalidPattern } var ( typedOps []op stack, maxstack int tailLen int pushMSeen bool vars []string ) for i := 0; i < l; i += 2 { op := op{code: utilities.OpCode(ops[i]), operand: ops[i+1]} switch op.code { case utilities.OpNop: continue case utilities.OpPush: if pushMSeen { tailLen++ } stack++ case utilities.OpPushM: if pushMSeen { grpclog.Error("pushM appears twice") return Pattern{}, ErrInvalidPattern } pushMSeen = true stack++ case utilities.OpLitPush: if op.operand < 0 || len(pool) <= op.operand { grpclog.Errorf("negative literal index: %d", op.operand) return Pattern{}, ErrInvalidPattern } if pushMSeen { tailLen++ } stack++ case utilities.OpConcatN: if op.operand <= 0 { grpclog.Errorf("negative concat size: %d", op.operand) return Pattern{}, ErrInvalidPattern } stack -= op.operand if stack < 0 { grpclog.Error("stack underflow") return Pattern{}, ErrInvalidPattern } stack++ case utilities.OpCapture: if op.operand < 0 || len(pool) <= op.operand { grpclog.Errorf("variable name index out of bound: %d", op.operand) return Pattern{}, ErrInvalidPattern } v := pool[op.operand] op.operand = len(vars) vars = append(vars, v) stack-- if stack < 0 { grpclog.Error("stack underflow") return Pattern{}, ErrInvalidPattern } default: grpclog.Errorf("invalid opcode: %d", op.code) return Pattern{}, ErrInvalidPattern } if maxstack < stack { maxstack = stack } typedOps = append(typedOps, op) } return Pattern{ ops: typedOps, pool: pool, vars: vars, stacksize: maxstack, tailLen: tailLen, verb: verb, }, nil } // MustPattern is a helper function which makes it easier to call NewPattern in variable initialization. func MustPattern(p Pattern, err error) Pattern { if err != nil { grpclog.Fatalf("Pattern initialization failed: %v", err) } return p } // MatchAndEscape examines components to determine if they match to a Pattern. // MatchAndEscape will return an error if no Patterns matched or if a pattern // matched but contained malformed escape sequences. If successful, the function // returns a mapping from field paths to their captured values. func (p Pattern) MatchAndEscape(components []string, verb string, unescapingMode UnescapingMode) (map[string]string, error) { if p.verb != verb { if p.verb != "" { return nil, ErrNotMatch } if len(components) == 0 { components = []string{":" + verb} } else { components = append([]string{}, components...) components[len(components)-1] += ":" + verb } } var pos int stack := make([]string, 0, p.stacksize) captured := make([]string, len(p.vars)) l := len(components) for _, op := range p.ops { var err error switch op.code { case utilities.OpNop: continue case utilities.OpPush, utilities.OpLitPush: if pos >= l { return nil, ErrNotMatch } c := components[pos] if op.code == utilities.OpLitPush { if lit := p.pool[op.operand]; c != lit { return nil, ErrNotMatch } } else if op.code == utilities.OpPush { if c, err = unescape(c, unescapingMode, false); err != nil { return nil, err } } stack = append(stack, c) pos++ case utilities.OpPushM: end := len(components) if end < pos+p.tailLen { return nil, ErrNotMatch } end -= p.tailLen c := strings.Join(components[pos:end], "/") if c, err = unescape(c, unescapingMode, true); err != nil { return nil, err } stack = append(stack, c) pos = end case utilities.OpConcatN: n := op.operand l := len(stack) - n stack = append(stack[:l], strings.Join(stack[l:], "/")) case utilities.OpCapture: n := len(stack) - 1 captured[op.operand] = stack[n] stack = stack[:n] } } if pos < l { return nil, ErrNotMatch } bindings := make(map[string]string) for i, val := range captured { bindings[p.vars[i]] = val } return bindings, nil } // MatchAndEscape examines components to determine if they match to a Pattern. // It will never perform per-component unescaping (see: UnescapingModeLegacy). // MatchAndEscape will return an error if no Patterns matched. If successful, // the function returns a mapping from field paths to their captured values. // // Deprecated: Use MatchAndEscape. func (p Pattern) Match(components []string, verb string) (map[string]string, error) { return p.MatchAndEscape(components, verb, UnescapingModeDefault) } // Verb returns the verb part of the Pattern. func (p Pattern) Verb() string { return p.verb } func (p Pattern) String() string { var stack []string for _, op := range p.ops { switch op.code { case utilities.OpNop: continue case utilities.OpPush: stack = append(stack, "*") case utilities.OpLitPush: stack = append(stack, p.pool[op.operand]) case utilities.OpPushM: stack = append(stack, "**") case utilities.OpConcatN: n := op.operand l := len(stack) - n stack = append(stack[:l], strings.Join(stack[l:], "/")) case utilities.OpCapture: n := len(stack) - 1 stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n]) } } segs := strings.Join(stack, "/") if p.verb != "" { return fmt.Sprintf("/%s:%s", segs, p.verb) } return "/" + segs } /* * The following code is adopted and modified from Go's standard library * and carries the attached license. * * Copyright 2009 The Go Authors. All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file. */ // ishex returns whether or not the given byte is a valid hex character func ishex(c byte) bool { switch { case '0' <= c && c <= '9': return true case 'a' <= c && c <= 'f': return true case 'A' <= c && c <= 'F': return true } return false } func isRFC6570Reserved(c byte) bool { switch c { case '!', '#', '$', '&', '\'', '(', ')', '*', '+', ',', '/', ':', ';', '=', '?', '@', '[', ']': return true default: return false } } // unhex converts a hex point to the bit representation func unhex(c byte) byte { switch { case '0' <= c && c <= '9': return c - '0' case 'a' <= c && c <= 'f': return c - 'a' + 10 case 'A' <= c && c <= 'F': return c - 'A' + 10 } return 0 } // shouldUnescapeWithMode returns true if the character is escapable with the // given mode func shouldUnescapeWithMode(c byte, mode UnescapingMode) bool { switch mode { case UnescapingModeAllExceptReserved: if isRFC6570Reserved(c) { return false } case UnescapingModeAllExceptSlash: if c == '/' { return false } case UnescapingModeAllCharacters: return true } return true } // unescape unescapes a path string using the provided mode func unescape(s string, mode UnescapingMode, multisegment bool) (string, error) { // TODO(v3): remove UnescapingModeLegacy if mode == UnescapingModeLegacy { return s, nil } if !multisegment { mode = UnescapingModeAllCharacters } // Count %, check that they're well-formed. n := 0 for i := 0; i < len(s); { if s[i] == '%' { n++ if i+2 >= len(s) || !ishex(s[i+1]) || !ishex(s[i+2]) { s = s[i:] if len(s) > 3 { s = s[:3] } return "", MalformedSequenceError(s) } i += 3 } else { i++ } } if n == 0 { return s, nil } var t strings.Builder t.Grow(len(s)) for i := 0; i < len(s); i++ { switch s[i] { case '%': c := unhex(s[i+1])<<4 | unhex(s[i+2]) if shouldUnescapeWithMode(c, mode) { t.WriteByte(c) i += 2 continue } fallthrough default: t.WriteByte(s[i]) } } return t.String(), nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/pattern_test.go000066400000000000000000000361751465037340600264260ustar00rootroot00000000000000package runtime import ( "errors" "fmt" "reflect" "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) const ( validVersion = 1 anything = 0 ) func TestNewPattern(t *testing.T) { for _, spec := range []struct { ops []int pool []string verb string stackSizeWant, tailLenWant int }{ {}, { ops: []int{int(utilities.OpNop), anything}, stackSizeWant: 0, tailLenWant: 0, }, { ops: []int{int(utilities.OpPush), anything}, stackSizeWant: 1, tailLenWant: 0, }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"abc"}, stackSizeWant: 1, tailLenWant: 0, }, { ops: []int{int(utilities.OpPushM), anything}, stackSizeWant: 1, tailLenWant: 0, }, { ops: []int{ int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, }, stackSizeWant: 1, tailLenWant: 0, }, { ops: []int{ int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 0, }, pool: []string{"abc"}, stackSizeWant: 1, tailLenWant: 0, }, { ops: []int{ int(utilities.OpPush), anything, int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPushM), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, }, pool: []string{"lit1", "lit2", "var1"}, stackSizeWant: 4, tailLenWant: 0, }, { ops: []int{ int(utilities.OpPushM), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 2, int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, }, pool: []string{"lit1", "lit2", "var1"}, stackSizeWant: 2, tailLenWant: 2, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPushM), anything, int(utilities.OpLitPush), 2, int(utilities.OpConcatN), 3, int(utilities.OpLitPush), 3, int(utilities.OpCapture), 4, }, pool: []string{"lit1", "lit2", "lit3", "lit4", "var1"}, stackSizeWant: 4, tailLenWant: 2, }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"abc"}, verb: "LOCK", stackSizeWant: 1, tailLenWant: 0, }, } { pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) if err != nil { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) continue } if got, want := pat.stacksize, spec.stackSizeWant; got != want { t.Errorf("pat.stacksize = %d; want %d", got, want) } if got, want := pat.tailLen, spec.tailLenWant; got != want { t.Errorf("pat.stacksize = %d; want %d", got, want) } } } func TestNewPatternWithWrongOp(t *testing.T) { for _, spec := range []struct { ops []int pool []string verb string }{ { // op code out of bound ops: []int{-1, anything}, }, { // op code out of bound ops: []int{int(utilities.OpEnd), 0}, }, { // odd number of items ops: []int{int(utilities.OpPush)}, }, { // negative index ops: []int{int(utilities.OpLitPush), -1}, pool: []string{"abc"}, }, { // index out of bound ops: []int{int(utilities.OpLitPush), 1}, pool: []string{"abc"}, }, { // negative # of segments ops: []int{int(utilities.OpConcatN), -1}, pool: []string{"abc"}, }, { // negative index ops: []int{int(utilities.OpCapture), -1}, pool: []string{"abc"}, }, { // index out of bound ops: []int{int(utilities.OpCapture), 1}, pool: []string{"abc"}, }, { // pushM appears twice ops: []int{ int(utilities.OpPushM), anything, int(utilities.OpLitPush), 0, int(utilities.OpPushM), anything, }, pool: []string{"abc"}, }, } { _, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) if err == nil { t.Errorf("NewPattern(%d, %v, %q, %q) succeeded; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, ErrInvalidPattern) continue } if !errors.Is(err, ErrInvalidPattern) { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, err, ErrInvalidPattern) continue } } } func TestNewPatternWithStackUnderflow(t *testing.T) { for _, spec := range []struct { ops []int pool []string verb string }{ { ops: []int{int(utilities.OpConcatN), 1}, }, { ops: []int{int(utilities.OpCapture), 0}, pool: []string{"abc"}, }, } { _, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) if err == nil { t.Errorf("NewPattern(%d, %v, %q, %q) succeeded; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, ErrInvalidPattern) continue } if !errors.Is(err, ErrInvalidPattern) { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, err, ErrInvalidPattern) continue } } } func TestMatch(t *testing.T) { for _, spec := range []struct { ops []int pool []string verb string match []string notMatch []string }{ { match: []string{""}, notMatch: []string{"example"}, }, { ops: []int{int(utilities.OpNop), anything}, match: []string{""}, notMatch: []string{"example", "path/to/example"}, }, { ops: []int{int(utilities.OpPush), anything}, match: []string{"abc", "def"}, notMatch: []string{"", "abc/def"}, }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"v1"}, match: []string{"v1"}, notMatch: []string{"", "v2"}, }, { ops: []int{int(utilities.OpPushM), anything}, match: []string{"", "abc", "abc/def", "abc/def/ghi"}, }, { ops: []int{ int(utilities.OpPushM), anything, int(utilities.OpLitPush), 0, }, pool: []string{"tail"}, match: []string{"tail", "abc/tail", "abc/def/tail"}, notMatch: []string{ "", "abc", "abc/def", "tail/extra", "abc/tail/extra", "abc/def/tail/extra", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 2, }, pool: []string{"v1", "bucket", "name"}, match: []string{"v1/bucket/my-bucket", "v1/bucket/our-bucket"}, notMatch: []string{ "", "v1", "v1/bucket", "v2/bucket/my-bucket", "v1/pubsub/my-topic", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPushM), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, }, pool: []string{"v1", "o", "name"}, match: []string{ "v1/o", "v1/o/my-bucket", "v1/o/our-bucket", "v1/o/my-bucket/dir", "v1/o/my-bucket/dir/dir2", "v1/o/my-bucket/dir/dir2/obj", }, notMatch: []string{ "", "v1", "v2/o/my-bucket", "v1/b/my-bucket", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, int(utilities.OpLitPush), 3, int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 4, }, pool: []string{"v2", "b", "name", "o", "oname"}, match: []string{ "v2/b/my-bucket/o/obj", "v2/b/our-bucket/o/obj", "v2/b/my-bucket/o/dir", }, notMatch: []string{ "", "v2", "v2/b", "v2/b/my-bucket", "v2/b/my-bucket/o", }, }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"v1"}, verb: "LOCK", match: []string{"v1:LOCK"}, notMatch: []string{"v1", "LOCK"}, }, } { pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) if err != nil { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) continue } for _, path := range spec.match { _, err = pat.Match(segments(path)) if err != nil { t.Errorf("pat.Match(%q) failed with %v; want success; pattern = (%v, %q)", path, err, spec.ops, spec.pool) } } for _, path := range spec.notMatch { _, err = pat.Match(segments(path)) if err == nil { t.Errorf("pat.Match(%q) succeeded; want failure with %v; pattern = (%v, %q)", path, ErrNotMatch, spec.ops, spec.pool) continue } if !errors.Is(err, ErrNotMatch) { t.Errorf("pat.Match(%q) failed with %v; want failure with %v; pattern = (%v, %q)", spec.notMatch, err, ErrNotMatch, spec.ops, spec.pool) } } } } func TestMatchWithBinding(t *testing.T) { for _, spec := range []struct { ops []int pool []string path string verb string mode UnescapingMode want map[string]string }{ { want: make(map[string]string), }, { ops: []int{int(utilities.OpNop), anything}, want: make(map[string]string), }, { ops: []int{int(utilities.OpPush), anything}, path: "abc", want: make(map[string]string), }, { ops: []int{int(utilities.OpPush), anything}, verb: "LOCK", path: "abc:LOCK", want: make(map[string]string), }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"endpoint"}, path: "endpoint", want: make(map[string]string), }, { ops: []int{int(utilities.OpPushM), anything}, path: "abc/def/ghi", want: make(map[string]string), }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 2, }, pool: []string{"v1", "bucket", "name"}, path: "v1/bucket/my-bucket", want: map[string]string{ "name": "my-bucket", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 2, }, pool: []string{"v1", "bucket", "name"}, verb: "LOCK", path: "v1/bucket/my-bucket:LOCK", want: map[string]string{ "name": "my-bucket", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPushM), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, }, pool: []string{"v1", "o", "name"}, path: "v1/o/my-bucket/dir/dir2/obj", want: map[string]string{ "name": "o/my-bucket/dir/dir2/obj", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPushM), anything, int(utilities.OpLitPush), 2, int(utilities.OpConcatN), 3, int(utilities.OpCapture), 4, int(utilities.OpLitPush), 3, }, pool: []string{"v1", "o", ".ext", "tail", "name"}, path: "v1/o/my-bucket/dir/dir2/obj/.ext/tail", want: map[string]string{ "name": "o/my-bucket/dir/dir2/obj/.ext", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, int(utilities.OpLitPush), 3, int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 4, }, pool: []string{"v2", "b", "name", "o", "oname"}, path: "v2/b/my-bucket/o/obj", want: map[string]string{ "name": "b/my-bucket", "oname": "obj", }, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, int(utilities.OpLitPush), 2, }, pool: []string{"foo", "id", "bar"}, path: "foo/part1%2Fpart2/bar", want: map[string]string{ "id": "part1/part2", }, mode: UnescapingModeAllExceptReserved, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPushM), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, }, pool: []string{"foo", "id"}, path: "foo/test%2Fbar", want: map[string]string{ "id": "test%2Fbar", }, mode: UnescapingModeAllExceptReserved, }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpPushM), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1, }, pool: []string{"foo", "id"}, path: "foo/test%2Fbar", want: map[string]string{ "id": "test/bar", }, mode: UnescapingModeAllCharacters, }, } { pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) if err != nil { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) continue } components, verb := segments(spec.path) got, err := pat.MatchAndEscape(components, verb, spec.mode) if err != nil { t.Errorf("pat.Match(%q) failed with %v; want success; pattern = (%v, %q)", spec.path, err, spec.ops, spec.pool) } if !reflect.DeepEqual(got, spec.want) { t.Errorf("pat.Match(%q) = %q; want %q; pattern = (%v, %q)", spec.path, got, spec.want, spec.ops, spec.pool) } } } func segments(path string) (components []string, verb string) { if path == "" { return nil, "" } components = strings.Split(path, "/") l := len(components) c := components[l-1] if idx := strings.LastIndex(c, ":"); idx >= 0 { components[l-1], verb = c[:idx], c[idx+1:] } return components, verb } func TestPatternString(t *testing.T) { for _, spec := range []struct { ops []int pool []string want string }{ { want: "/", }, { ops: []int{int(utilities.OpNop), anything}, want: "/", }, { ops: []int{int(utilities.OpPush), anything}, want: "/*", }, { ops: []int{int(utilities.OpLitPush), 0}, pool: []string{"endpoint"}, want: "/endpoint", }, { ops: []int{int(utilities.OpPushM), anything}, want: "/**", }, { ops: []int{ int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, }, want: "/*", }, { ops: []int{ int(utilities.OpPush), anything, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 0, }, pool: []string{"name"}, want: "/{name=*}", }, { ops: []int{ int(utilities.OpLitPush), 0, int(utilities.OpLitPush), 1, int(utilities.OpPush), anything, int(utilities.OpConcatN), 2, int(utilities.OpCapture), 2, int(utilities.OpLitPush), 3, int(utilities.OpPushM), anything, int(utilities.OpLitPush), 4, int(utilities.OpConcatN), 3, int(utilities.OpCapture), 6, int(utilities.OpLitPush), 5, }, pool: []string{"v1", "buckets", "bucket_name", "objects", ".ext", "tail", "name"}, want: "/v1/{bucket_name=buckets/*}/{name=objects/**/.ext}/tail", }, } { p, err := NewPattern(validVersion, spec.ops, spec.pool, "") if err != nil { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, "", err) continue } if got, want := p.String(), spec.want; got != want { t.Errorf("%#v.String() = %q; want %q", p, got, want) } verb := "LOCK" p, err = NewPattern(validVersion, spec.ops, spec.pool, verb) if err != nil { t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, verb, err) continue } if got, want := p.String(), fmt.Sprintf("%s:%s", spec.want, verb); got != want { t.Errorf("%#v.String() = %q; want %q", p, got, want) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/proto2_convert.go000066400000000000000000000042511465037340600266650ustar00rootroot00000000000000package runtime import ( "google.golang.org/protobuf/proto" ) // StringP returns a pointer to a string whose pointee is same as the given string value. func StringP(val string) (*string, error) { return proto.String(val), nil } // BoolP parses the given string representation of a boolean value, // and returns a pointer to a bool whose value is same as the parsed value. func BoolP(val string) (*bool, error) { b, err := Bool(val) if err != nil { return nil, err } return proto.Bool(b), nil } // Float64P parses the given string representation of a floating point number, // and returns a pointer to a float64 whose value is same as the parsed number. func Float64P(val string) (*float64, error) { f, err := Float64(val) if err != nil { return nil, err } return proto.Float64(f), nil } // Float32P parses the given string representation of a floating point number, // and returns a pointer to a float32 whose value is same as the parsed number. func Float32P(val string) (*float32, error) { f, err := Float32(val) if err != nil { return nil, err } return proto.Float32(f), nil } // Int64P parses the given string representation of an integer // and returns a pointer to a int64 whose value is same as the parsed integer. func Int64P(val string) (*int64, error) { i, err := Int64(val) if err != nil { return nil, err } return proto.Int64(i), nil } // Int32P parses the given string representation of an integer // and returns a pointer to a int32 whose value is same as the parsed integer. func Int32P(val string) (*int32, error) { i, err := Int32(val) if err != nil { return nil, err } return proto.Int32(i), err } // Uint64P parses the given string representation of an integer // and returns a pointer to a uint64 whose value is same as the parsed integer. func Uint64P(val string) (*uint64, error) { i, err := Uint64(val) if err != nil { return nil, err } return proto.Uint64(i), err } // Uint32P parses the given string representation of an integer // and returns a pointer to a uint32 whose value is same as the parsed integer. func Uint32P(val string) (*uint32, error) { i, err := Uint32(val) if err != nil { return nil, err } return proto.Uint32(i), err } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/query.go000066400000000000000000000272751465037340600250600ustar00rootroot00000000000000package runtime import ( "errors" "fmt" "net/url" "regexp" "strconv" "strings" "time" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc/grpclog" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/known/durationpb" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) var valuesKeyRegexp = regexp.MustCompile(`^(.*)\[(.*)\]$`) var currentQueryParser QueryParameterParser = &DefaultQueryParser{} // QueryParameterParser defines interface for all query parameter parsers type QueryParameterParser interface { Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error } // PopulateQueryParameters parses query parameters // into "msg" using current query parser func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { return currentQueryParser.Parse(msg, values, filter) } // DefaultQueryParser is a QueryParameterParser which implements the default // query parameters parsing behavior. // // See https://github.com/grpc-ecosystem/grpc-gateway/issues/2632 for more context. type DefaultQueryParser struct{} // Parse populates "values" into "msg". // A value is ignored if its key starts with one of the elements in "filter". func (*DefaultQueryParser) Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { if match := valuesKeyRegexp.FindStringSubmatch(key); len(match) == 3 { key = match[1] values = append([]string{match[2]}, values...) } msgValue := msg.ProtoReflect() fieldPath := normalizeFieldPath(msgValue, strings.Split(key, ".")) if filter.HasCommonPrefix(fieldPath) { continue } if err := populateFieldValueFromPath(msgValue, fieldPath, values); err != nil { return err } } return nil } // PopulateFieldFromPath sets a value in a nested Protobuf structure. func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error { fieldPath := strings.Split(fieldPathString, ".") return populateFieldValueFromPath(msg.ProtoReflect(), fieldPath, []string{value}) } func normalizeFieldPath(msgValue protoreflect.Message, fieldPath []string) []string { newFieldPath := make([]string, 0, len(fieldPath)) for i, fieldName := range fieldPath { fields := msgValue.Descriptor().Fields() fieldDesc := fields.ByTextName(fieldName) if fieldDesc == nil { fieldDesc = fields.ByJSONName(fieldName) } if fieldDesc == nil { // return initial field path values if no matching message field was found return fieldPath } newFieldPath = append(newFieldPath, string(fieldDesc.Name())) // If this is the last element, we're done if i == len(fieldPath)-1 { break } // Only singular message fields are allowed if fieldDesc.Message() == nil || fieldDesc.Cardinality() == protoreflect.Repeated { return fieldPath } // Get the nested message msgValue = msgValue.Get(fieldDesc).Message() } return newFieldPath } func populateFieldValueFromPath(msgValue protoreflect.Message, fieldPath []string, values []string) error { if len(fieldPath) < 1 { return errors.New("no field path") } if len(values) < 1 { return errors.New("no value provided") } var fieldDescriptor protoreflect.FieldDescriptor for i, fieldName := range fieldPath { fields := msgValue.Descriptor().Fields() // Get field by name fieldDescriptor = fields.ByName(protoreflect.Name(fieldName)) if fieldDescriptor == nil { fieldDescriptor = fields.ByJSONName(fieldName) if fieldDescriptor == nil { // We're not returning an error here because this could just be // an extra query parameter that isn't part of the request. grpclog.Infof("field not found in %q: %q", msgValue.Descriptor().FullName(), strings.Join(fieldPath, ".")) return nil } } // If this is the last element, we're done if i == len(fieldPath)-1 { break } // Only singular message fields are allowed if fieldDescriptor.Message() == nil || fieldDescriptor.Cardinality() == protoreflect.Repeated { return fmt.Errorf("invalid path: %q is not a message", fieldName) } // Get the nested message msgValue = msgValue.Mutable(fieldDescriptor).Message() } // Check if oneof already set if of := fieldDescriptor.ContainingOneof(); of != nil { if f := msgValue.WhichOneof(of); f != nil { return fmt.Errorf("field already set for oneof %q", of.FullName().Name()) } } switch { case fieldDescriptor.IsList(): return populateRepeatedField(fieldDescriptor, msgValue.Mutable(fieldDescriptor).List(), values) case fieldDescriptor.IsMap(): return populateMapField(fieldDescriptor, msgValue.Mutable(fieldDescriptor).Map(), values) } if len(values) > 1 { return fmt.Errorf("too many values for field %q: %s", fieldDescriptor.FullName().Name(), strings.Join(values, ", ")) } return populateField(fieldDescriptor, msgValue, values[0]) } func populateField(fieldDescriptor protoreflect.FieldDescriptor, msgValue protoreflect.Message, value string) error { v, err := parseField(fieldDescriptor, value) if err != nil { return fmt.Errorf("parsing field %q: %w", fieldDescriptor.FullName().Name(), err) } msgValue.Set(fieldDescriptor, v) return nil } func populateRepeatedField(fieldDescriptor protoreflect.FieldDescriptor, list protoreflect.List, values []string) error { for _, value := range values { v, err := parseField(fieldDescriptor, value) if err != nil { return fmt.Errorf("parsing list %q: %w", fieldDescriptor.FullName().Name(), err) } list.Append(v) } return nil } func populateMapField(fieldDescriptor protoreflect.FieldDescriptor, mp protoreflect.Map, values []string) error { if len(values) != 2 { return fmt.Errorf("more than one value provided for key %q in map %q", values[0], fieldDescriptor.FullName()) } key, err := parseField(fieldDescriptor.MapKey(), values[0]) if err != nil { return fmt.Errorf("parsing map key %q: %w", fieldDescriptor.FullName().Name(), err) } value, err := parseField(fieldDescriptor.MapValue(), values[1]) if err != nil { return fmt.Errorf("parsing map value %q: %w", fieldDescriptor.FullName().Name(), err) } mp.Set(key.MapKey(), value) return nil } func parseField(fieldDescriptor protoreflect.FieldDescriptor, value string) (protoreflect.Value, error) { switch fieldDescriptor.Kind() { case protoreflect.BoolKind: v, err := strconv.ParseBool(value) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfBool(v), nil case protoreflect.EnumKind: enum, err := protoregistry.GlobalTypes.FindEnumByName(fieldDescriptor.Enum().FullName()) if err != nil { if errors.Is(err, protoregistry.NotFound) { return protoreflect.Value{}, fmt.Errorf("enum %q is not registered", fieldDescriptor.Enum().FullName()) } return protoreflect.Value{}, fmt.Errorf("failed to look up enum: %w", err) } // Look for enum by name v := enum.Descriptor().Values().ByName(protoreflect.Name(value)) if v == nil { i, err := strconv.Atoi(value) if err != nil { return protoreflect.Value{}, fmt.Errorf("%q is not a valid value", value) } // Look for enum by number if v = enum.Descriptor().Values().ByNumber(protoreflect.EnumNumber(i)); v == nil { return protoreflect.Value{}, fmt.Errorf("%q is not a valid value", value) } } return protoreflect.ValueOfEnum(v.Number()), nil case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: v, err := strconv.ParseInt(value, 10, 32) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfInt32(int32(v)), nil case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: v, err := strconv.ParseInt(value, 10, 64) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfInt64(v), nil case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: v, err := strconv.ParseUint(value, 10, 32) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfUint32(uint32(v)), nil case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: v, err := strconv.ParseUint(value, 10, 64) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfUint64(v), nil case protoreflect.FloatKind: v, err := strconv.ParseFloat(value, 32) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfFloat32(float32(v)), nil case protoreflect.DoubleKind: v, err := strconv.ParseFloat(value, 64) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfFloat64(v), nil case protoreflect.StringKind: return protoreflect.ValueOfString(value), nil case protoreflect.BytesKind: v, err := Bytes(value) if err != nil { return protoreflect.Value{}, err } return protoreflect.ValueOfBytes(v), nil case protoreflect.MessageKind, protoreflect.GroupKind: return parseMessage(fieldDescriptor.Message(), value) default: panic(fmt.Sprintf("unknown field kind: %v", fieldDescriptor.Kind())) } } func parseMessage(msgDescriptor protoreflect.MessageDescriptor, value string) (protoreflect.Value, error) { var msg proto.Message switch msgDescriptor.FullName() { case "google.protobuf.Timestamp": t, err := time.Parse(time.RFC3339Nano, value) if err != nil { return protoreflect.Value{}, err } msg = timestamppb.New(t) case "google.protobuf.Duration": d, err := time.ParseDuration(value) if err != nil { return protoreflect.Value{}, err } msg = durationpb.New(d) case "google.protobuf.DoubleValue": v, err := strconv.ParseFloat(value, 64) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Double(v) case "google.protobuf.FloatValue": v, err := strconv.ParseFloat(value, 32) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Float(float32(v)) case "google.protobuf.Int64Value": v, err := strconv.ParseInt(value, 10, 64) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Int64(v) case "google.protobuf.Int32Value": v, err := strconv.ParseInt(value, 10, 32) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Int32(int32(v)) case "google.protobuf.UInt64Value": v, err := strconv.ParseUint(value, 10, 64) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.UInt64(v) case "google.protobuf.UInt32Value": v, err := strconv.ParseUint(value, 10, 32) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.UInt32(uint32(v)) case "google.protobuf.BoolValue": v, err := strconv.ParseBool(value) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Bool(v) case "google.protobuf.StringValue": msg = wrapperspb.String(value) case "google.protobuf.BytesValue": v, err := Bytes(value) if err != nil { return protoreflect.Value{}, err } msg = wrapperspb.Bytes(v) case "google.protobuf.FieldMask": fm := &field_mask.FieldMask{} fm.Paths = append(fm.Paths, strings.Split(value, ",")...) msg = fm case "google.protobuf.Value": var v structpb.Value if err := protojson.Unmarshal([]byte(value), &v); err != nil { return protoreflect.Value{}, err } msg = &v case "google.protobuf.Struct": var v structpb.Struct if err := protojson.Unmarshal([]byte(value), &v); err != nil { return protoreflect.Value{}, err } msg = &v default: return protoreflect.Value{}, fmt.Errorf("unsupported message type: %q", string(msgDescriptor.FullName())) } return protoreflect.ValueOfMessage(msg.ProtoReflect()), nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/query_fuzz_test.go000066400000000000000000000067161465037340600271720ustar00rootroot00000000000000//go:build go1.18 // +build go1.18 package runtime_test import ( "net/url" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) func FuzzPopulateQueryParameters(f *testing.F) { f.Add("bool_value=true&bytes_value=YWJjMTIzIT8kKiYoKSctPUB-&double_value=2.5&duration_value=13h0m0s&enum_value=1&fieldmask_value=float_value%2Cdouble_value&float_value=1.5&int32_value=-2&int64_value=-1&map_value10%5Bkey%5D=1.5&map_value11%5B1.5%5D=value&map_value12%5Bkey%5D=2.5&map_value13%5B2.5%5D=value&map_value14%5Bkey%5D=true&map_value15%5Btrue%5D=value&map_value16%5Bkey%5D=2&map_value2%5Bkey%5D=-2&map_value3%5B-2%5D=value&map_value4%5Bkey%5D=-1&map_value5%5B-1%5D=value&map_value6%5Bkey%5D=3&map_value7%5B3%5D=value&map_value8%5Bkey%5D=4&map_value9%5B4%5D=value&map_value%5Bfourth%5D=&map_value%5Bkey%5D=value&map_value%5Bsecond%5D=bar&map_value%5Bthird%5D=zzz&map_value%5B~%21%40%23%24%25%5E%26%2A%28%29%5D=value&repeated_enum=1&repeated_enum=2&repeated_enum=0&repeated_message=1&repeated_message=2&repeated_message=3&repeated_value=a&repeated_value=b&repeated_value=c&string_value=str&struct_value=%7B%22a%22%3A%7B%22b%22%3A1%7D%7D&struct_value_value=%7B%22a%22%3A%7B%22b%22%3A1%7D%7D×tamp_value=2016-12-15T12%3A23%3A32.000000049Z&uint32_value=4&uint64_value=3&wrapper_bool_value=true&wrapper_bytes_value=YWJjMTIzIT8kKiYoKSctPUB-&wrapper_double_value=2.5&wrapper_float_value=1.5&wrapper_int32_value=-2&wrapper_int64_value=-1&wrapper_string_value=str&wrapper_u_int32_value=4&wrapper_u_int64_value=3") f.Add("boolValue=true&bytesValue=Ynl0ZXM%3D&doubleValue=2.5&durationValue=13h0m0s&enumValue=1&fieldmaskValue=float_value%2Cdouble_value&floatValue=1.5&int32Value=-2&int64Value=-1&repeatedEnum=1&repeatedEnum=2&repeatedEnum=0&repeatedValue=a&repeatedValue=b&repeatedValue=c&stringValue=str&struct_value=%7B%7D&struct_value_value=%22%22×tampValue=2016-12-15T12%3A23%3A32.000000049Z&uint32Value=4&uint64Value=3&wrapperBoolValue=true&wrapperBytesValue=Ynl0ZXM%3D&wrapperDoubleValue=2.5&wrapperFloatValue=1.5&wrapperInt32Value=-2&wrapperInt64Value=-1&wrapperStringValue=str&wrapperUInt32Value=4&wrapperUInt64Value=3") f.Add("enum_value=Z&repeated_enum=X&repeated_enum=2&repeated_enum=0&struct_value=%7B%22c%22%3A%5B1%2C2%5D%2C%22d%22%3A%5B%7B%22e%22%3A1%2C%22f%22%3A%7B%7D%7D%5D%7D&struct_value_value=%7B%7D") f.Add("struct_value_value=%5B%5D") f.Add("bool_value=true&double_value=2.5&float_value=1.5&int32_value=-2&int64_value=-1&repeated_value=a&repeated_value=b&repeated_value=c&string_value=str&uint32_value=4&uint64_value=3") f.Add("boolValue=true&doubleValue=2.5&floatValue=1.5&int32Value=-2&int64Value=-1&repeatedValue=a&repeatedValue=b&repeatedValue=c&stringValue=str&uint32Value=4&uint64Value=") f.Add("nested.nested.map_value%5Bfirst%5D=foo&nested.nested.map_value%5Bsecond%5D=bar&nested.nested.nested.repeated_value=a&nested.nested.nested.repeated_value=b&nested.nested.nested.repeated_value=c&nested.nested.nested.string_value=s&nested.nested.string_value=t&nested.string_value=u") f.Add("oneof_string_value=foobar") f.Add("nested_oneof_value_one.int64Value=-1&nested_oneof_value_one.string_value=foo") f.Fuzz(func(t *testing.T, query string) { in := &examplepb.ABitOfEverything{} values, err := url.ParseQuery(query) if err != nil { return } err = runtime.PopulateQueryParameters(in, values, utilities.NewDoubleArray(nil)) if err != nil { return } }) } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/runtime/query_test.go000066400000000000000000000527161465037340600261150ustar00rootroot00000000000000package runtime_test import ( "errors" "net/url" "strconv" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/durationpb" field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) func BenchmarkPopulateQueryParameters(b *testing.B) { timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) timeStr := timeT.Format(time.RFC3339Nano) durationT := 13 * time.Hour durationStr := durationT.String() fieldmaskStr := "float_value,double_value" msg := &examplepb.Proto3Message{} values := url.Values{ "float_value": {"1.5"}, "double_value": {"2.5"}, "int64_value": {"-1"}, "int32_value": {"-2"}, "uint64_value": {"3"}, "uint32_value": {"4"}, "bool_value": {"true"}, "string_value": {"str"}, "bytes_value": {"Ynl0ZXM="}, "repeated_value": {"a", "b", "c"}, "enum_value": {"1"}, "repeated_enum": {"1", "2", "0"}, "timestamp_value": {timeStr}, "duration_value": {durationStr}, "fieldmask_value": {fieldmaskStr}, "optional_string_value": {"optional-str"}, "wrapper_float_value": {"1.5"}, "wrapper_double_value": {"2.5"}, "wrapper_int64_value": {"-1"}, "wrapper_int32_value": {"-2"}, "wrapper_u_int64_value": {"3"}, "wrapper_u_int32_value": {"4"}, "wrapper_bool_value": {"true"}, "wrapper_string_value": {"str"}, "wrapper_bytes_value": {"Ynl0ZXM="}, "map_value[key]": {"value"}, "map_value[second]": {"bar"}, "map_value[third]": {"zzz"}, "map_value[fourth]": {""}, `map_value[~!@#$%^&*()]`: {"value"}, "map_value2[key]": {"-2"}, "map_value3[-2]": {"value"}, "map_value4[key]": {"-1"}, "map_value5[-1]": {"value"}, "map_value6[key]": {"3"}, "map_value7[3]": {"value"}, "map_value8[key]": {"4"}, "map_value9[4]": {"value"}, "map_value10[key]": {"1.5"}, "map_value11[1.5]": {"value"}, "map_value12[key]": {"2.5"}, "map_value13[2.5]": {"value"}, "map_value14[key]": {"true"}, "map_value15[true]": {"value"}, } filter := utilities.NewDoubleArray([][]string{ {"bool_value"}, {"repeated_value"}, }) for i := 0; i < b.N; i++ { _ = runtime.PopulateQueryParameters(msg, values, filter) } } func TestPopulateParameters(t *testing.T) { timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) timeStr := timeT.Format(time.RFC3339Nano) timePb := timestamppb.New(timeT) durationT := 13 * time.Hour durationStr := durationT.String() durationPb := durationpb.New(durationT) fieldmaskStr := "float_value,double_value" fieldmaskPb := &field_mask.FieldMask{Paths: []string{"float_value", "double_value"}} structValueJsonStrings := []string{`{"a":{"b":1}}`, `""`, "{}", "[]", "true", "0"} structValueValues := make([]*structpb.Value, len(structValueJsonStrings)) for i := range structValueValues { structValueValues[i] = &structpb.Value{} err := structValueValues[i].UnmarshalJSON([]byte(structValueJsonStrings[i])) if err != nil { t.Errorf("build struct.Value value failed: %s", err.Error()) } } structJsonStrings := []string{`{"a":{"b":1}}`, "{}", `{"c":[1,2],"d":[{"e":1,"f":{}}]}`} structValues := make([]*structpb.Struct, len(structJsonStrings)) for i := range structValues { structValues[i] = &structpb.Struct{} err := structValues[i].UnmarshalJSON([]byte(structJsonStrings[i])) if err != nil { t.Errorf("build struct.Struct value failed: %s", err.Error()) } } for i, spec := range []struct { values url.Values filter *utilities.DoubleArray want proto.Message wanterr error }{ { values: url.Values{ "float_value": {"1.5"}, "double_value": {"2.5"}, "int64_value": {"-1"}, "int32_value": {"-2"}, "uint64_value": {"3"}, "uint32_value": {"4"}, "bool_value": {"true"}, "string_value": {"str"}, "bytes_value": {"YWJjMTIzIT8kKiYoKSctPUB-"}, "repeated_value": {"a", "b", "c"}, "repeated_message": {"1", "2", "3"}, "enum_value": {"1"}, "repeated_enum": {"1", "2", "0"}, "timestamp_value": {timeStr}, "duration_value": {durationStr}, "fieldmask_value": {fieldmaskStr}, "wrapper_float_value": {"1.5"}, "wrapper_double_value": {"2.5"}, "wrapper_int64_value": {"-1"}, "wrapper_int32_value": {"-2"}, "wrapper_u_int64_value": {"3"}, "wrapper_u_int32_value": {"4"}, "wrapper_bool_value": {"true"}, "wrapper_string_value": {"str"}, "wrapper_bytes_value": {"YWJjMTIzIT8kKiYoKSctPUB-"}, "map_value[key]": {"value"}, "map_value[second]": {"bar"}, "map_value[third]": {"zzz"}, "map_value[fourth]": {""}, `map_value[~!@#$%^&*()]`: {"value"}, "map_value2[key]": {"-2"}, "map_value3[-2]": {"value"}, "map_value4[key]": {"-1"}, "map_value5[-1]": {"value"}, "map_value6[key]": {"3"}, "map_value7[3]": {"value"}, "map_value8[key]": {"4"}, "map_value9[4]": {"value"}, "map_value10[key]": {"1.5"}, "map_value11[1.5]": {"value"}, "map_value12[key]": {"2.5"}, "map_value13[2.5]": {"value"}, "map_value14[key]": {"true"}, "map_value15[true]": {"value"}, "map_value16[key]": {"2"}, "struct_value_value": {structValueJsonStrings[0]}, "struct_value": {structJsonStrings[0]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: -1, Int32Value: -2, Uint64Value: 3, Uint32Value: 4, BoolValue: true, StringValue: "str", BytesValue: []byte("abc123!?$*&()'-=@~"), RepeatedValue: []string{"a", "b", "c"}, RepeatedMessage: []*wrapperspb.UInt64Value{{Value: 1}, {Value: 2}, {Value: 3}}, EnumValue: examplepb.EnumValue_Y, RepeatedEnum: []examplepb.EnumValue{examplepb.EnumValue_Y, examplepb.EnumValue_Z, examplepb.EnumValue_X}, TimestampValue: timePb, DurationValue: durationPb, FieldmaskValue: fieldmaskPb, WrapperFloatValue: wrapperspb.Float(1.5), WrapperDoubleValue: wrapperspb.Double(2.5), WrapperInt64Value: wrapperspb.Int64(-1), WrapperInt32Value: wrapperspb.Int32(-2), WrapperUInt64Value: wrapperspb.UInt64(3), WrapperUInt32Value: wrapperspb.UInt32(4), WrapperBoolValue: wrapperspb.Bool(true), WrapperStringValue: wrapperspb.String("str"), WrapperBytesValue: wrapperspb.Bytes([]byte("abc123!?$*&()'-=@~")), MapValue: map[string]string{ "key": "value", "second": "bar", "third": "zzz", "fourth": "", `~!@#$%^&*()`: "value", }, MapValue2: map[string]int32{"key": -2}, MapValue3: map[int32]string{-2: "value"}, MapValue4: map[string]int64{"key": -1}, MapValue5: map[int64]string{-1: "value"}, MapValue6: map[string]uint32{"key": 3}, MapValue7: map[uint32]string{3: "value"}, MapValue8: map[string]uint64{"key": 4}, MapValue9: map[uint64]string{4: "value"}, MapValue10: map[string]float32{"key": 1.5}, MapValue12: map[string]float64{"key": 2.5}, MapValue14: map[string]bool{"key": true}, MapValue15: map[bool]string{true: "value"}, MapValue16: map[string]*wrapperspb.UInt64Value{"key": {Value: 2}}, StructValueValue: structValueValues[0], StructValue: structValues[0], }, }, { values: url.Values{ "floatValue": {"1.5"}, "doubleValue": {"2.5"}, "int64Value": {"-1"}, "int32Value": {"-2"}, "uint64Value": {"3"}, "uint32Value": {"4"}, "boolValue": {"true"}, "stringValue": {"str"}, "bytesValue": {"Ynl0ZXM="}, "repeatedValue": {"a", "b", "c"}, "enumValue": {"1"}, "repeatedEnum": {"1", "2", "0"}, "timestampValue": {timeStr}, "durationValue": {durationStr}, "fieldmaskValue": {fieldmaskStr}, "wrapperFloatValue": {"1.5"}, "wrapperDoubleValue": {"2.5"}, "wrapperInt64Value": {"-1"}, "wrapperInt32Value": {"-2"}, "wrapperUInt64Value": {"3"}, "wrapperUInt32Value": {"4"}, "wrapperBoolValue": {"true"}, "wrapperStringValue": {"str"}, "wrapperBytesValue": {"Ynl0ZXM="}, "struct_value_value": {structValueJsonStrings[1]}, "struct_value": {structJsonStrings[1]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: -1, Int32Value: -2, Uint64Value: 3, Uint32Value: 4, BoolValue: true, StringValue: "str", BytesValue: []byte("bytes"), RepeatedValue: []string{"a", "b", "c"}, EnumValue: examplepb.EnumValue_Y, RepeatedEnum: []examplepb.EnumValue{examplepb.EnumValue_Y, examplepb.EnumValue_Z, examplepb.EnumValue_X}, TimestampValue: timePb, DurationValue: durationPb, FieldmaskValue: fieldmaskPb, WrapperFloatValue: wrapperspb.Float(1.5), WrapperDoubleValue: wrapperspb.Double(2.5), WrapperInt64Value: wrapperspb.Int64(-1), WrapperInt32Value: wrapperspb.Int32(-2), WrapperUInt64Value: wrapperspb.UInt64(3), WrapperUInt32Value: wrapperspb.UInt32(4), WrapperBoolValue: wrapperspb.Bool(true), WrapperStringValue: wrapperspb.String("str"), WrapperBytesValue: wrapperspb.Bytes([]byte("bytes")), StructValueValue: structValueValues[1], StructValue: structValues[1], }, }, { values: url.Values{ "enum_value": {"Z"}, "repeated_enum": {"X", "2", "0"}, "struct_value_value": {structValueJsonStrings[2]}, "struct_value": {structJsonStrings[2]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ EnumValue: examplepb.EnumValue_Z, RepeatedEnum: []examplepb.EnumValue{examplepb.EnumValue_X, examplepb.EnumValue_Z, examplepb.EnumValue_X}, StructValueValue: structValueValues[2], StructValue: structValues[2], }, }, { values: url.Values{ "struct_value_value": {structValueJsonStrings[3]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ StructValueValue: structValueValues[3], }, }, { values: url.Values{ "struct_value_value": {structValueJsonStrings[4]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ StructValueValue: structValueValues[4], }, }, { values: url.Values{ "struct_value_value": {structValueJsonStrings[5]}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ StructValueValue: structValueValues[5], }, }, { values: url.Values{ "float_value": {"1.5"}, "double_value": {"2.5"}, "int64_value": {"-1"}, "int32_value": {"-2"}, "uint64_value": {"3"}, "uint32_value": {"4"}, "bool_value": {"true"}, "string_value": {"str"}, "repeated_value": {"a", "b", "c"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto2Message{ FloatValue: proto.Float32(1.5), DoubleValue: proto.Float64(2.5), Int64Value: proto.Int64(-1), Int32Value: proto.Int32(-2), Uint64Value: proto.Uint64(3), Uint32Value: proto.Uint32(4), BoolValue: proto.Bool(true), StringValue: proto.String("str"), RepeatedValue: []string{"a", "b", "c"}, }, }, { values: url.Values{ "floatValue": {"1.5"}, "doubleValue": {"2.5"}, "int64Value": {"-1"}, "int32Value": {"-2"}, "uint64Value": {"3"}, "uint32Value": {"4"}, "boolValue": {"true"}, "stringValue": {"str"}, "repeatedValue": {"a", "b", "c"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto2Message{ FloatValue: proto.Float32(1.5), DoubleValue: proto.Float64(2.5), Int64Value: proto.Int64(-1), Int32Value: proto.Int32(-2), Uint64Value: proto.Uint64(3), Uint32Value: proto.Uint32(4), BoolValue: proto.Bool(true), StringValue: proto.String("str"), RepeatedValue: []string{"a", "b", "c"}, }, }, { values: url.Values{ "nested.nested.nested.repeated_value": {"a", "b", "c"}, "nested.nested.nested.string_value": {"s"}, "nested.nested.string_value": {"t"}, "nested.string_value": {"u"}, "nested.nested.map_value[first]": {"foo"}, "nested.nested.map_value[second]": {"bar"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ Nested: &examplepb.Proto3Message{ Nested: &examplepb.Proto3Message{ MapValue: map[string]string{ "first": "foo", "second": "bar", }, Nested: &examplepb.Proto3Message{ RepeatedValue: []string{"a", "b", "c"}, StringValue: "s", }, StringValue: "t", }, StringValue: "u", }, }, }, { values: url.Values{ "oneof_string_value": {"foobar"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ OneofValue: &examplepb.Proto3Message_OneofStringValue{ OneofStringValue: "foobar", }, }, }, { values: url.Values{ "oneofStringValue": {"foobar"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ OneofValue: &examplepb.Proto3Message_OneofStringValue{ OneofStringValue: "foobar", }, }, }, { values: url.Values{ "oneof_bool_value": {"true"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ OneofValue: &examplepb.Proto3Message_OneofBoolValue{ OneofBoolValue: true, }, }, }, { values: url.Values{ "nested_oneof_value_one.int64Value": {"-1"}, "nested_oneof_value_one.string_value": {"foo"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{ NestedOneofValue: &examplepb.Proto3Message_NestedOneofValueOne{ NestedOneofValueOne: &examplepb.Proto3Message{ Int64Value: -1, StringValue: "foo", }, }, }, }, { // Error on "null" values: url.Values{ "timestampValue": {"null"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{}, wanterr: errors.New(`parsing field "timestamp_value": parsing time "null" as "2006-01-02T15:04:05.999999999Z07:00": cannot parse "null" as "2006"`), }, { // Error on "null" values: url.Values{ "durationValue": {"null"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{}, wanterr: errors.New(`parsing field "duration_value": time: invalid duration "null"`), }, { // Don't allow setting a oneof more than once values: url.Values{ "oneof_bool_value": {"true"}, "oneof_string_value": {"foobar"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{}, wanterr: errors.New("field already set for oneof \"oneof_value\""), }, { // Error when there are too many values values: url.Values{ "uint64_value": {"1", "2"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{}, wanterr: errors.New("too many values for field \"uint64_value\": 1, 2"), }, { // Error when dereferencing a list of messages values: url.Values{ "repeated_message.value": {"1"}, }, filter: utilities.NewDoubleArray(nil), want: &examplepb.Proto3Message{}, wanterr: errors.New("invalid path: \"repeated_message\" is not a message"), }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { msg := spec.want.ProtoReflect().New().Interface() err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) if spec.wanterr != nil { if err == nil || err.Error() != spec.wanterr.Error() { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %q; want error %q", spec.values, spec.filter, err, spec.wanterr) } return } if err != nil { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) return } if diff := cmp.Diff(spec.want, msg, protocmp.Transform()); diff != "" { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v): %s", spec.values, spec.filter, diff) } }) } } func TestPopulateParametersWithFilters(t *testing.T) { for _, spec := range []struct { values url.Values filter *utilities.DoubleArray want proto.Message }{ { values: url.Values{ "bool_value": {"true"}, "string_value": {"str"}, "repeated_value": {"a", "b", "c"}, }, filter: utilities.NewDoubleArray([][]string{ {"bool_value"}, {"repeated_value"}, }), want: &examplepb.Proto3Message{ StringValue: "str", }, }, { values: url.Values{ "nested.nested.bool_value": {"true"}, "nested.nested.string_value": {"str"}, "nested.string_value": {"str"}, "string_value": {"str"}, }, filter: utilities.NewDoubleArray([][]string{ {"nested"}, }), want: &examplepb.Proto3Message{ StringValue: "str", }, }, { values: url.Values{ "nested.nested.bool_value": {"true"}, "nested.nested.string_value": {"str"}, "nested.string_value": {"str"}, "string_value": {"str"}, }, filter: utilities.NewDoubleArray([][]string{ {"nested", "nested"}, }), want: &examplepb.Proto3Message{ Nested: &examplepb.Proto3Message{ StringValue: "str", }, StringValue: "str", }, }, { values: url.Values{ "nested.nested.bool_value": {"true"}, "nested.nested.string_value": {"str"}, "nested.string_value": {"str"}, "string_value": {"str"}, }, filter: utilities.NewDoubleArray([][]string{ {"nested", "nested", "string_value"}, }), want: &examplepb.Proto3Message{ Nested: &examplepb.Proto3Message{ StringValue: "str", Nested: &examplepb.Proto3Message{ BoolValue: true, }, }, StringValue: "str", }, }, } { msg := spec.want.ProtoReflect().New().Interface() err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) if err != nil { t.Errorf("runtime.PoplateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) continue } if got, want := msg, spec.want; !proto.Equal(got, want) { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v = %v; want %v", spec.values, spec.filter, got, want) } } } func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { for _, spec := range []struct { msg proto.Message values url.Values filter *utilities.DoubleArray }{ { msg: &examplepb.Proto3Message{}, values: url.Values{ "float_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "double_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "int64_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "int32_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "uint64_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "uint32_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "bool_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "string_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "repeated_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "enum_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "enum_value.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, { msg: &examplepb.Proto3Message{}, values: url.Values{ "repeated_enum.nested": {"test"}, }, filter: utilities.NewDoubleArray(nil), }, } { spec.msg = spec.msg.ProtoReflect().New().Interface() err := runtime.PopulateQueryParameters(spec.msg, spec.values, spec.filter) if err == nil { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) did not fail; want error", spec.values, spec.filter) } } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/000077500000000000000000000000001465037340600236775ustar00rootroot00000000000000golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/BUILD.bazel000066400000000000000000000012121465037340600255510ustar00rootroot00000000000000load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) go_library( name = "utilities", srcs = [ "doc.go", "pattern.go", "readerfactory.go", "string_array_flag.go", "trie.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", ) go_test( name = "utilities_test", size = "small", srcs = [ "string_array_flag_test.go", "trie_test.go", ], deps = [":utilities"], ) alias( name = "go_default_library", actual = ":utilities", visibility = ["//visibility:public"], ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/doc.go000066400000000000000000000001321465037340600247670ustar00rootroot00000000000000// Package utilities provides members for internal use in grpc-gateway. package utilities golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/pattern.go000066400000000000000000000011571465037340600257070ustar00rootroot00000000000000package utilities // An OpCode is a opcode of compiled path patterns. type OpCode int // These constants are the valid values of OpCode. const ( // OpNop does nothing OpNop = OpCode(iota) // OpPush pushes a component to stack OpPush // OpLitPush pushes a component to stack if it matches to the literal OpLitPush // OpPushM concatenates the remaining components and pushes it to stack OpPushM // OpConcatN pops N items from stack, concatenates them and pushes it back to stack OpConcatN // OpCapture pops an item and binds it to the variable OpCapture // OpEnd is the least positive invalid opcode. OpEnd ) golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/readerfactory.go000066400000000000000000000006021465037340600270560ustar00rootroot00000000000000package utilities import ( "bytes" "io" ) // IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins // at the start of the stream func IOReaderFactory(r io.Reader) (func() io.Reader, error) { b, err := io.ReadAll(r) if err != nil { return nil, err } return func() io.Reader { return bytes.NewReader(b) }, nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/string_array_flag.go000066400000000000000000000016431465037340600277270ustar00rootroot00000000000000package utilities import ( "flag" "strings" ) // flagInterface is an cut down interface to `flag` type flagInterface interface { Var(value flag.Value, name string, usage string) } // StringArrayFlag defines a flag with the specified name and usage string. // The return value is the address of a `StringArrayFlags` variable that stores the repeated values of the flag. func StringArrayFlag(f flagInterface, name string, usage string) *StringArrayFlags { value := &StringArrayFlags{} f.Var(value, name, usage) return value } // StringArrayFlags is a wrapper of `[]string` to provider an interface for `flag.Var` type StringArrayFlags []string // String returns a string representation of `StringArrayFlags` func (i *StringArrayFlags) String() string { return strings.Join(*i, ",") } // Set appends a value to `StringArrayFlags` func (i *StringArrayFlags) Set(value string) error { *i = append(*i, value) return nil } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/string_array_flag_test.go000066400000000000000000000020341465037340600307610ustar00rootroot00000000000000package utilities_test import ( "flag" "reflect" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) func TestStringArrayFlag(t *testing.T) { tests := []struct { name string flags []string want string }{ { name: "No Value", flags: []string{}, want: "", }, { name: "Single Value", flags: []string{"--my_flag=1"}, want: "1", }, { name: "Repeated Value", flags: []string{"--my_flag=1", "--my_flag=2"}, want: "1,2", }, { name: "Repeated Same Value", flags: []string{"--my_flag=1", "--my_flag=1"}, want: "1,1", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { flagSet := flag.NewFlagSet("test", flag.PanicOnError) result := utilities.StringArrayFlag(flagSet, "my_flag", "repeated flag") if err := flagSet.Parse(tt.flags); err != nil { t.Errorf("flagSet.Parse() failed with %v", err) } if !reflect.DeepEqual(result.String(), tt.want) { t.Errorf("StringArrayFlag() = %v, want %v", result.String(), tt.want) } }) } } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/trie.go000066400000000000000000000067101465037340600251750ustar00rootroot00000000000000package utilities import ( "sort" ) // DoubleArray is a Double Array implementation of trie on sequences of strings. type DoubleArray struct { // Encoding keeps an encoding from string to int Encoding map[string]int // Base is the base array of Double Array Base []int // Check is the check array of Double Array Check []int } // NewDoubleArray builds a DoubleArray from a set of sequences of strings. func NewDoubleArray(seqs [][]string) *DoubleArray { da := &DoubleArray{Encoding: make(map[string]int)} if len(seqs) == 0 { return da } encoded := registerTokens(da, seqs) sort.Sort(byLex(encoded)) root := node{row: -1, col: -1, left: 0, right: len(encoded)} addSeqs(da, encoded, 0, root) for i := len(da.Base); i > 0; i-- { if da.Check[i-1] != 0 { da.Base = da.Base[:i] da.Check = da.Check[:i] break } } return da } func registerTokens(da *DoubleArray, seqs [][]string) [][]int { var result [][]int for _, seq := range seqs { encoded := make([]int, 0, len(seq)) for _, token := range seq { if _, ok := da.Encoding[token]; !ok { da.Encoding[token] = len(da.Encoding) } encoded = append(encoded, da.Encoding[token]) } result = append(result, encoded) } for i := range result { result[i] = append(result[i], len(da.Encoding)) } return result } type node struct { row, col int left, right int } func (n node) value(seqs [][]int) int { return seqs[n.row][n.col] } func (n node) children(seqs [][]int) []*node { var result []*node lastVal := int(-1) last := new(node) for i := n.left; i < n.right; i++ { if lastVal == seqs[i][n.col+1] { continue } last.right = i last = &node{ row: i, col: n.col + 1, left: i, } result = append(result, last) } last.right = n.right return result } func addSeqs(da *DoubleArray, seqs [][]int, pos int, n node) { ensureSize(da, pos) children := n.children(seqs) var i int for i = 1; ; i++ { ok := func() bool { for _, child := range children { code := child.value(seqs) j := i + code ensureSize(da, j) if da.Check[j] != 0 { return false } } return true }() if ok { break } } da.Base[pos] = i for _, child := range children { code := child.value(seqs) j := i + code da.Check[j] = pos + 1 } terminator := len(da.Encoding) for _, child := range children { code := child.value(seqs) if code == terminator { continue } j := i + code addSeqs(da, seqs, j, *child) } } func ensureSize(da *DoubleArray, i int) { for i >= len(da.Base) { da.Base = append(da.Base, make([]int, len(da.Base)+1)...) da.Check = append(da.Check, make([]int, len(da.Check)+1)...) } } type byLex [][]int func (l byLex) Len() int { return len(l) } func (l byLex) Swap(i, j int) { l[i], l[j] = l[j], l[i] } func (l byLex) Less(i, j int) bool { si := l[i] sj := l[j] var k int for k = 0; k < len(si) && k < len(sj); k++ { if si[k] < sj[k] { return true } if si[k] > sj[k] { return false } } return k < len(sj) } // HasCommonPrefix determines if any sequence in the DoubleArray is a prefix of the given sequence. func (da *DoubleArray) HasCommonPrefix(seq []string) bool { if len(da.Base) == 0 { return false } var i int for _, t := range seq { code, ok := da.Encoding[t] if !ok { break } j := da.Base[i] + code if len(da.Check) <= j || da.Check[j] != i+1 { break } i = j } j := da.Base[i] + len(da.Encoding) if len(da.Check) <= j || da.Check[j] != i+1 { return false } return true } golang-github-grpc-ecosystem-grpc-gateway-2.20.0/utilities/trie_test.go000066400000000000000000000157621465037340600262430ustar00rootroot00000000000000package utilities_test import ( "reflect" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) func TestMaxCommonPrefix(t *testing.T) { for _, spec := range []struct { da utilities.DoubleArray tokens []string want bool }{ { da: utilities.DoubleArray{}, tokens: nil, want: false, }, { da: utilities.DoubleArray{}, tokens: []string{"foo"}, want: false, }, { da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, }, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}, }, tokens: nil, want: false, }, { da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, }, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}, }, tokens: []string{"foo"}, want: true, }, { da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, }, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}, }, tokens: []string{"bar"}, want: false, }, { // foo|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^foo$ // 4: ^bar$ }, tokens: []string{"foo"}, want: true, }, { // foo|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^foo$ // 4: ^bar$ }, tokens: []string{"bar"}, want: true, }, { // foo|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^foo$ // 4: ^bar$ }, tokens: []string{"something-else"}, want: false, }, { // foo|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^foo$ // 4: ^bar$ }, tokens: []string{"foo", "bar"}, want: true, }, { // foo|foo\.bar|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 3, 1, 0, 4, 0, 0}, Check: []int{0, 1, 1, 3, 2, 2, 5}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^bar$ // 4: ^foo.bar // 5: ^foo$ // 6: ^foo.bar$ }, tokens: []string{"foo"}, want: true, }, { // foo|foo\.bar|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 3, 1, 0, 4, 0, 0}, Check: []int{0, 1, 1, 3, 2, 2, 5}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^bar$ // 4: ^foo.bar // 5: ^foo$ // 6: ^foo.bar$ }, tokens: []string{"foo", "bar"}, want: true, }, { // foo|foo\.bar|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 3, 1, 0, 4, 0, 0}, Check: []int{0, 1, 1, 3, 2, 2, 5}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^bar$ // 4: ^foo.bar // 5: ^foo$ // 6: ^foo.bar$ }, tokens: []string{"bar"}, want: true, }, { // foo|foo\.bar|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 3, 1, 0, 4, 0, 0}, Check: []int{0, 1, 1, 3, 2, 2, 5}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^bar$ // 4: ^foo.bar // 5: ^foo$ // 6: ^foo.bar$ }, tokens: []string{"something-else"}, want: false, }, { // foo|foo\.bar|bar da: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 3, 1, 0, 4, 0, 0}, Check: []int{0, 1, 1, 3, 2, 2, 5}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^bar$ // 4: ^foo.bar // 5: ^foo$ // 6: ^foo.bar$ }, tokens: []string{"foo", "bar", "baz"}, want: true, }, } { got := spec.da.HasCommonPrefix(spec.tokens) if got != spec.want { t.Errorf("%#v.HasCommonPrefix(%v) = %v; want %v", spec.da, spec.tokens, got, spec.want) } } } func TestAdd(t *testing.T) { for _, spec := range []struct { tokens [][]string want utilities.DoubleArray }{ { want: utilities.DoubleArray{ Encoding: make(map[string]int), }, }, { tokens: [][]string{{"foo"}}, want: utilities.DoubleArray{ Encoding: map[string]int{"foo": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}, // 0: ^ // 1: ^foo // 2: ^foo$ }, }, { tokens: [][]string{{"foo"}, {"bar"}}, want: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, }, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}, // 0: ^ // 1: ^foo // 2: ^bar // 3: ^foo$ // 4: ^bar$ }, }, { tokens: [][]string{{"foo", "bar"}, {"foo", "baz"}}, want: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, "baz": 2, }, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 2, 2, 3, 4}, // 0: ^ // 1: ^foo // 2: ^foo.bar // 3: ^foo.baz // 4: ^foo.bar$ // 5: ^foo.baz$ }, }, { tokens: [][]string{{"foo", "bar"}, {"foo", "baz"}, {"qux"}}, want: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, "baz": 2, "qux": 3, }, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 1, 3, 4, 5}, // 0: ^ // 1: ^foo // 2: ^foo.bar // 3: ^foo.baz // 4: ^qux // 5: ^foo.bar$ // 6: ^foo.baz$ // 7: ^qux$ }, }, { tokens: [][]string{ {"foo", "bar"}, {"foo", "baz", "bar"}, {"qux", "foo"}, }, want: utilities.DoubleArray{ Encoding: map[string]int{ "foo": 0, "bar": 1, "baz": 2, "qux": 3, }, Base: []int{1, 1, 1, 5, 8, 0, 3, 0, 5, 0}, Check: []int{0, 1, 2, 2, 1, 3, 4, 7, 5, 9}, // 0: ^ // 1: ^foo // 2: ^foo.bar // 3: ^foo.baz // 4: ^qux // 5: ^foo.bar$ // 6: ^foo.baz.bar // 7: ^foo.baz.bar$ // 8: ^qux.foo // 9: ^qux.foo$ }, }, } { da := utilities.NewDoubleArray(spec.tokens) if got, want := da.Encoding, spec.want.Encoding; !reflect.DeepEqual(got, want) { t.Errorf("da.Encoding = %v; want %v; tokens = %#v", got, want, spec.tokens) } if got, want := da.Base, spec.want.Base; !compareArray(got, want) { t.Errorf("da.Base = %v; want %v; tokens = %#v", got, want, spec.tokens) } if got, want := da.Check, spec.want.Check; !compareArray(got, want) { t.Errorf("da.Check = %v; want %v; tokens = %#v", got, want, spec.tokens) } } } func compareArray(got, want []int) bool { var i int for i = 0; i < len(got) && i < len(want); i++ { if got[i] != want[i] { return false } } if i < len(want) { return false } for ; i < len(got); i++ { if got[i] != 0 { return false } } return true }