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.25.0/webrpc-gen.linux-amd64
curl -o ./webrpc-gen -fLJO https://github.com/webrpc/webrpc/releases/download/v0.31.0/webrpc-gen.linux-amd64
chmod +x ./webrpc-gen
echo $PWD >> $GITHUB_PATH

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# webrpc OpenAPI 3.x (Swagger) generator <!-- omit in toc -->
# webrpc OpenAPI 3.2.0 (Swagger) generator <!-- omit in toc -->

This repo contains the templates used by the [webrpc-gen](https://github.com/webrpc/webrpc) cli to code-generate OpenAPI documentation from webrpc schema.

- [Generate OpenAPI 3.x YAML file](#generate-openapi-3x-yaml-file)
- [Generate OpenAPI 3.2.0 YAML file](#generate-openapi-320-yaml-file)
- [Set custom template variables](#set-custom-template-variables)
- [Open in Swagger UI](#open-in-swagger-ui)
- [Build static HTML documentation with Redocly](#build-static-html-documentation-with-redocly)
Expand All @@ -12,7 +12,7 @@ This repo contains the templates used by the [webrpc-gen](https://github.com/web
- [Authors](#authors)
- [License](#license)

# Generate OpenAPI 3.x YAML file
# Generate OpenAPI 3.2.0 YAML file
```bash
webrpc-gen -schema=./proto.ridl -target=openapi -out petstore.gen.yaml
```
Expand Down
26 changes: 13 additions & 13 deletions _examples/openapi.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# example v0.0.1 9814b024890e4f9bf0fb6406686c29bcc402b24a
# --
# Code generated by webrpc-gen@v0.25.0 with ../ generator; DO NOT EDIT
# Code generated by webrpc-gen@v0.31.0 with ../ generator; DO NOT EDIT
#
# webrpc-gen -schema=./proto.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
openapi: 3.2.0
info:
title: 'Example webrpc API'
version: 'v22.11.8'
Expand Down Expand Up @@ -189,7 +189,7 @@ components:
status:
type: number
example: 500
ErrorWebrpcClientDisconnected:
ErrorWebrpcClientAborted:
type: object
required:
- error
Expand All @@ -199,13 +199,13 @@ components:
properties:
error:
type: string
example: "WebrpcClientDisconnected"
example: "WebrpcClientAborted"
code:
type: number
example: -8
msg:
type: string
example: "client disconnected"
example: "request aborted by client"
cause:
type: string
status:
Expand Down Expand Up @@ -528,7 +528,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -572,7 +572,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -617,7 +617,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -665,7 +665,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -708,7 +708,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -749,7 +749,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -790,7 +790,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down Expand Up @@ -833,7 +833,7 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientDisconnected'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
Expand Down
2 changes: 1 addition & 1 deletion main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# Code generated by webrpc-gen@{{.WebrpcGenVersion}} with {{.WebrpcTarget}} generator; DO NOT EDIT
#
# {{.WebrpcGenCommand}}
openapi: 3.0.0
openapi: 3.2.0
info:
title: '{{ get $opts "title" }}'
version: '{{ get $opts "apiVersion" }}'
Expand Down