Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install webrpc-gen
run: |
curl -o ./webrpc-gen -fLJO https://github.com/webrpc/webrpc/releases/download/v0.31.0/webrpc-gen.linux-amd64
curl -o ./webrpc-gen -fLJO https://github.com/webrpc/webrpc/releases/download/v0.32.3/webrpc-gen.linux-amd64
chmod +x ./webrpc-gen
echo $PWD >> $GITHUB_PATH

Expand Down
5 changes: 3 additions & 2 deletions _examples/api.ridl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
webrpc = v1 # version of webrpc schema format (ridl or json)

name = example # name of your backend app
version = v0.0.1 # version of your schema
name = example # name of your backend app
version = v1.0.0 # version of your schema
basepath = /v1 # base path for the API routes

service ExampleService
@deprecated
Expand Down
32 changes: 16 additions & 16 deletions _examples/openapi.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# example v0.0.1 7fb0c7ec825a4b11489f18f6be64880a8b72ccee
# example v1.0.0 78160f3365e4f91df80f171a445efde0a288026e
# --
# Code generated by webrpc-gen@v0.31.0 with ../ generator; DO NOT EDIT
# Code generated by webrpc-gen@v0.32.3 with ../ generator; DO NOT EDIT
#
# webrpc-gen -schema=./api.ridl -target=../ -out=./openapi.gen.yaml -title=Example webrpc API -apiVersion=v22.11.8 -serverUrl=https://api.example.com -serverDescription=Production -securityAnnotation=@auth -securitySchemes={ 'ApiKeyAuth': { 'type': 'apiKey', 'in': 'header', 'description': 'Project access key for authenticating requests', 'name': 'X-Access-Key' }, 'ServiceAuth': { 'type': 'apiKey', 'in': 'header', 'description': 'Project access key for authenticating requests', 'name': 'X-Access-Key' } }
openapi: 3.0.0
Expand Down Expand Up @@ -582,7 +582,7 @@ components:
$ref: '#/components/schemas/User'

paths:
/rpc/ExampleService/Ping:
/v1/ExampleService/Ping:
post:
operationId: ExampleService-Ping
tags: ["ExampleService"]
Expand Down Expand Up @@ -624,7 +624,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/GetUser:
/v1/ExampleService/GetUser:
post:
operationId: ExampleService-GetUser
tags: ["ExampleService"]
Expand Down Expand Up @@ -668,7 +668,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/GetUserV2:
/v1/ExampleService/GetUserV2:
post:
operationId: ExampleService-GetUserV2
tags: ["ExampleService"]
Expand Down Expand Up @@ -713,7 +713,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/FindUser:
/v1/ExampleService/FindUser:
post:
operationId: ExampleService-FindUser
tags: ["ExampleService"]
Expand Down Expand Up @@ -761,7 +761,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/ListUsers:
/v1/ExampleService/ListUsers:
post:
operationId: ExampleService-ListUsers
tags: ["ExampleService"]
Expand Down Expand Up @@ -804,7 +804,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/GetComplex:
/v1/ExampleService/GetComplex:
post:
operationId: ExampleService-GetComplex
tags: ["ExampleService"]
Expand Down Expand Up @@ -845,7 +845,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/GetAllOptional:
/v1/ExampleService/GetAllOptional:
post:
operationId: ExampleService-GetAllOptional
tags: ["ExampleService"]
Expand Down Expand Up @@ -886,7 +886,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService/StreamUserNotifications:
/v1/ExampleService/StreamUserNotifications:
post:
operationId: ExampleService-StreamUserNotifications
tags: ["ExampleService"]
Expand Down Expand Up @@ -930,7 +930,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/Ping:
/v1/ExampleService2/Ping:
post:
operationId: ExampleService2-Ping
tags: ["ExampleService2"]
Expand Down Expand Up @@ -972,7 +972,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/GetUserV2:
/v1/ExampleService2/GetUserV2:
post:
operationId: ExampleService2-GetUserV2
tags: ["ExampleService2"]
Expand Down Expand Up @@ -1015,7 +1015,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/FindUser:
/v1/ExampleService2/FindUser:
post:
operationId: ExampleService2-FindUser
tags: ["ExampleService2"]
Expand Down Expand Up @@ -1063,7 +1063,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/ListUsers:
/v1/ExampleService2/ListUsers:
post:
operationId: ExampleService2-ListUsers
tags: ["ExampleService2"]
Expand Down Expand Up @@ -1106,7 +1106,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/StreamUserNotifications:
/v1/ExampleService2/StreamUserNotifications:
post:
operationId: ExampleService2-StreamUserNotifications
tags: ["ExampleService2"]
Expand Down Expand Up @@ -1150,7 +1150,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/AdminService/ListUsers:
/v1/AdminService/ListUsers:
post:
operationId: AdminService-ListUsers
tags: ["AdminService"]
Expand Down
3 changes: 2 additions & 1 deletion main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
{{- set $typeMap "[]" "array" -}}

{{- $types := .Types -}}
{{- $basepath := .BasePath -}}
{{- $services := .Services -}}
{{- $webrpcErrors := .WebrpcErrors -}}
{{- $schemaErrors := .Errors -}}
Expand Down Expand Up @@ -141,7 +142,7 @@ paths:
{{- $isSuccinctInput := $method.Succinct -}}
{{- $isSuccinctOutput := $method.Succinct -}}
{{- $deprecated := index $method.Annotations "deprecated" }}
/rpc/{{$service.Name}}/{{$method.Name}}:
{{$basepath}}{{$service.Name}}/{{$method.Name}}:
post:
operationId: {{$service.Name}}-{{$method.Name}}
tags: ["{{$service.Name}}"]
Expand Down