commit 3ccb0fda2cfa80f0145b00cfe08d1d8fe930ff42 Author: Mateusz Wójcik Date: Tue Jun 3 22:32:01 2025 +0200 Add stub repository structure diff --git a/README.md b/README.md new file mode 100644 index 0000000..ddc3516 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# My Swagger Service + +Minimal repo to test Jenkins pipeline with buf + docker. diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..fb835ac --- /dev/null +++ b/buf.yaml @@ -0,0 +1,2 @@ +version: v1 +name: buf.build/example/my-swagger-service diff --git a/bug.gen.yaml b/bug.gen.yaml new file mode 100644 index 0000000..90a455b --- /dev/null +++ b/bug.gen.yaml @@ -0,0 +1,5 @@ +version: v1 +plugins: + - plugin: buf.build/grpc-ecosystem/openapiv2 + out: deployments/docker + opt: logtostderr=true diff --git a/deployments/docker/Dockerfile b/deployments/docker/Dockerfile new file mode 100644 index 0000000..67ce05e --- /dev/null +++ b/deployments/docker/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine + +COPY openapi.yaml /usr/share/nginx/html/openapi.yaml diff --git a/protos/service.proto b/protos/service.proto new file mode 100644 index 0000000..6b10719 --- /dev/null +++ b/protos/service.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package example; + +service HelloService { + rpc SayHello (HelloRequest) returns (HelloReply); +} + +message HelloRequest { + string name = 1; +} + +message HelloReply { + string message = 1; +} diff --git a/scripts/process_openapiv2.py b/scripts/process_openapiv2.py new file mode 100644 index 0000000..b6ffa6c --- /dev/null +++ b/scripts/process_openapiv2.py @@ -0,0 +1,17 @@ +import shutil +import os + + +def main(): + src = 'deployments/docker/openapiv2.json' + dst = 'deployments/docker/openapi.yaml' + print("Simulating OpenAPI v2 to v3 conversion...") + if os.path.exists(src): + shutil.copyfile(src, dst) + else: + with open(dst, 'w') as f: + f.write('# dummy OpenAPI v3 content\nopenapi: 3.0.0\ninfo:\n title: Example\n version: 1.0.0\n') + + +if __name__ == '__main__': + main()