Add stub repository structure
This commit is contained in:
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# My Swagger Service
|
||||
|
||||
Minimal repo to test Jenkins pipeline with buf + docker.
|
||||
2
buf.yaml
Normal file
2
buf.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
version: v1
|
||||
name: buf.build/example/my-swagger-service
|
||||
5
bug.gen.yaml
Normal file
5
bug.gen.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
version: v1
|
||||
plugins:
|
||||
- plugin: buf.build/grpc-ecosystem/openapiv2
|
||||
out: deployments/docker
|
||||
opt: logtostderr=true
|
||||
3
deployments/docker/Dockerfile
Normal file
3
deployments/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY openapi.yaml /usr/share/nginx/html/openapi.yaml
|
||||
15
protos/service.proto
Normal file
15
protos/service.proto
Normal file
@@ -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;
|
||||
}
|
||||
17
scripts/process_openapiv2.py
Normal file
17
scripts/process_openapiv2.py
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user