Skip to content

Commit 37056c9

Browse files
authored
Add grpc-ecosystem/openapiv3 v2.30.0 (#2668)
Add the new openapi v3 plugin (currently in alpha) provided by grpc-gateway. Fixes #2664.
1 parent d63a613 commit 37056c9

8 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source:
2+
github:
3+
owner: grpc-ecosystem
4+
repository: grpc-gateway
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM --platform=$BUILDPLATFORM golang:1.26.6-trixie@sha256:b75d466dd608587fd66cca705a307ba65b889827d06ad61d6a75f0482b51b7c7 AS build
3+
4+
ARG TARGETOS TARGETARCH
5+
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
6+
7+
RUN --mount=type=cache,target=/go/pkg/mod \
8+
go install -ldflags="-s -w" -trimpath github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv3@v2.30.0 \
9+
&& mv /go/bin/${GOOS}_${GOARCH}/protoc-gen-openapiv3 /go/bin/protoc-gen-openapiv3 || true
10+
11+
FROM scratch
12+
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd
13+
COPY --from=build --link /go/bin/protoc-gen-openapiv3 /
14+
USER nobody
15+
ENTRYPOINT [ "/protoc-gen-openapiv3" ]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v1
2+
name: buf.build/grpc-ecosystem/openapiv3
3+
plugin_version: v2.30.0
4+
source_url: https://github.com/grpc-ecosystem/grpc-gateway
5+
description: Generates OpenAPI v3 definitions for Protobuf services.
6+
spdx_license_id: BSD-3-Clause
7+
license_url: https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.30.0/LICENSE

‎tests/plugins_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ exec docker run --log-driver=none --rm -i {{.ImageName}}:{{.Version}} "$@"
8989
allowedEmptyPluginSums = map[string]map[string]bool{
9090
"buf.build/bufbuild/validate-java": {"eliza": true, "petapis": true},
9191
"buf.build/grpc-ecosystem/gateway": {"eliza": true, "petapis": true},
92+
"buf.build/grpc-ecosystem/openapiv3": {"eliza": true, "petapis": true},
9293
"buf.build/community/mercari-grpc-federation": {"eliza": true, "petapis": true},
9394
"buf.build/googlecloudplatform/bq-schema": {"eliza": true, "petapis": true},
9495
}
@@ -154,6 +155,8 @@ func TestGeneration(t *testing.T) {
154155
if semver.Compare(toTest.PluginVersion, "v2.16.0") >= 0 {
155156
testPluginWithImage(t, toTest, "grpc-gateway")
156157
}
158+
case "grpc-ecosystem/openapiv3":
159+
testPluginWithImage(t, toTest, "grpc-gateway")
157160
case "community/mercari-grpc-federation":
158161
switch {
159162
case semver.Compare(toTest.PluginVersion, "v1.4.1") >= 0:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:sDv/LdN7stRRvSCZnvvCnl7pXGppD04NgjjsDGgKboY=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=

0 commit comments

Comments
 (0)