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
44 changes: 44 additions & 0 deletions _examples/api.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ service ExampleService
- GetComplex() => (complex: ComplexType)
- GetAllOptional() => (optional: Optional)

- StreamUserNotifications() => stream (StreamNotificationsResponse)

service ExampleService2
@deprecated
- Ping()

# GetUserV2 returns user based on given userID.
@auth:JWT
- GetUserV2(GetUserRequest) => (GetUserResponse)

# FindUser searches for a user using the given search filter.
#
# The filters are q (string) and active (bool).
#
# The minimal length of the "q" filter is 3 characters.
@auth:JWT
- FindUser(FindUserRequest) => (FindUserResponse)

# ListUsers returns all users.
@auth:JWT
- ListUsers(ListUsersRequest) => (ListUsersResponse)

- StreamUserNotifications(StreamNotificationsRequest) => stream (StreamNotificationsResponse)

service AdminService
Expand Down Expand Up @@ -90,3 +112,25 @@ struct StreamNotificationsResponse
struct Notification
- message: string
- timestamp: timestamp

struct GetUserRequest
- header: map<string,string>
- userID: uint64

struct GetUserResponse
- code: uint32
- user: User

struct FindUserRequest
- s: SearchFilter

struct FindUserResponse
- name: string
- user: User

struct ListUsersRequest
- header: map<string,string>

struct ListUsersResponse
- users: []User

294 changes: 285 additions & 9 deletions _examples/openapi.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# example v0.0.1 55eeccc8db95e08d65f0da63acfdcbd92cc1e6fa
# example v0.0.1 7fb0c7ec825a4b11489f18f6be64880a8b72ccee
# --
# Code generated by webrpc-gen@v0.31.0 with ../ generator; DO NOT EDIT
#
Expand Down Expand Up @@ -430,6 +430,66 @@ components:
type: string
timestamp:
type: string
GetUserRequest:
type: object
required:
- header
- userID
properties:
header:
type: object
description: 'map<string,string>'
additionalProperties:
type: string
userID:
type: number
GetUserResponse:
type: object
required:
- code
- user
properties:
code:
type: number
user:
$ref: '#/components/schemas/User'
FindUserRequest:
type: object
required:
- s
properties:
s:
$ref: '#/components/schemas/SearchFilter'
FindUserResponse:
type: object
required:
- name
- user
properties:
name:
type: string
user:
$ref: '#/components/schemas/User'
ListUsersRequest:
type: object
required:
- header
properties:
header:
type: object
description: 'map<string,string>'
additionalProperties:
type: string
ListUsersResponse:
type: object
required:
- users
properties:
users:
type: array
description: '[]User'
items:
$ref: '#/components/schemas/User'
ExampleService_Ping_Request:
type: object
ExampleService_GetUser_Request:
Expand Down Expand Up @@ -465,9 +525,6 @@ components:
type: object
ExampleService_StreamUserNotifications_Request:
type: object
properties:
streamNotificationsRequest:
$ref: '#/components/schemas/StreamNotificationsRequest'
ExampleService_Ping_Response:
type: object
ExampleService_GetUser_Response:
Expand Down Expand Up @@ -511,11 +568,10 @@ components:
properties:
optional:
$ref: '#/components/schemas/Optional'
ExampleService_StreamUserNotifications_Response:
ExampleService2_Ping_Request:
type: object
ExampleService2_Ping_Response:
type: object
properties:
streamNotificationsResponse:
$ref: '#/components/schemas/StreamNotificationsResponse'
AdminService_ListUsers_Request:
type: object
AdminService_ListUsers_Response:
Expand Down Expand Up @@ -848,7 +904,7 @@ paths:
content:
application/x-ndjson:
schema:
$ref: '#/components/schemas/ExampleService_StreamUserNotifications_Response'
$ref: '#/components/schemas/StreamNotificationsResponse'
# OpenAPI 3.2.0 streaming (itemSchema) is not supported by 3.1.0 tooling:
# itemSchema:
# $ref: '#/components/schemas/ExampleService_StreamUserNotifications_Response'
Expand Down Expand Up @@ -876,6 +932,226 @@ paths:
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/Ping:
post:
operationId: ExampleService2-Ping
tags: ["ExampleService2"]
summary: "Deprecated."
deprecated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ExampleService2_Ping_Request'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ExampleService2_Ping_Response'
'4XX':
description: Client error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcEndpoint'
- $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
description: Server error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcBadResponse'
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/GetUserV2:
post:
operationId: ExampleService2-GetUserV2
tags: ["ExampleService2"]
summary: "GetUserV2 returns user based on given userID."
security:
- JWT: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetUserRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetUserResponse'
'4XX':
description: Client error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcEndpoint'
- $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
description: Server error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcBadResponse'
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/FindUser:
post:
operationId: ExampleService2-FindUser
tags: ["ExampleService2"]
summary: "FindUser searches for a user using the given search filter."
security:
- JWT: []
description: |

The filters are q (string) and active (bool).

The minimal length of the "q" filter is 3 characters.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FindUserRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FindUserResponse'
'4XX':
description: Client error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcEndpoint'
- $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
description: Server error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcBadResponse'
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/ListUsers:
post:
operationId: ExampleService2-ListUsers
tags: ["ExampleService2"]
summary: "ListUsers returns all users."
security:
- JWT: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ListUsersRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ListUsersResponse'
'4XX':
description: Client error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcEndpoint'
- $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
description: Server error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcBadResponse'
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/ExampleService2/StreamUserNotifications:
post:
operationId: ExampleService2-StreamUserNotifications
tags: ["ExampleService2"]
summary: ""
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/StreamNotificationsRequest'
responses:
'200':
description: OK
content:
application/x-ndjson:
schema:
$ref: '#/components/schemas/StreamNotificationsResponse'
# OpenAPI 3.2.0 streaming (itemSchema) is not supported by 3.1.0 tooling:
# itemSchema:
# $ref: '#/components/schemas/ExampleService2_StreamUserNotifications_Response'
'4XX':
description: Client error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcEndpoint'
- $ref: '#/components/schemas/ErrorWebrpcRequestFailed'
- $ref: '#/components/schemas/ErrorWebrpcBadRoute'
- $ref: '#/components/schemas/ErrorWebrpcBadMethod'
- $ref: '#/components/schemas/ErrorWebrpcBadRequest'
- $ref: '#/components/schemas/ErrorWebrpcClientAborted'
- $ref: '#/components/schemas/ErrorWebrpcStreamLost'
- $ref: '#/components/schemas/ErrorRateLimited'
'5XX':
description: Server error
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ErrorWebrpcBadResponse'
- $ref: '#/components/schemas/ErrorWebrpcServerPanic'
- $ref: '#/components/schemas/ErrorWebrpcInternalError'
- $ref: '#/components/schemas/ErrorDatabaseDown'
/rpc/AdminService/ListUsers:
post:
operationId: AdminService-ListUsers
Expand Down
Loading