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
5 changes: 3 additions & 2 deletions _examples/openapi.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# example v0.0.1 ee5a444237d744dbda91bc77751f0b0d698e7502
# example v0.0.1 9814b024890e4f9bf0fb6406686c29bcc402b24a
# --
# Code generated by webrpc-gen@v0.25.0 with ../ generator; DO NOT EDIT
#
Expand Down Expand Up @@ -587,7 +587,6 @@ paths:
security:
- JWT: []
description: |

Replaces GetUser endpoint.
requestBody:
content:
Expand Down Expand Up @@ -633,6 +632,8 @@ paths:
description: |

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

The minimal length of the "q" filter is 3 characters.
requestBody:
content:
application/json:
Expand Down
46 changes: 24 additions & 22 deletions _examples/proto.ridl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
webrpc = v1 # version of webrpc schema format (ridl or json)
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 = v0.0.1 # version of your schema

enum Kind: uint32
- USER
Expand Down Expand Up @@ -45,35 +45,37 @@ struct Optional
- email?: string

service ExampleService
@deprecated
@deprecated
- Ping()
@deprecated:"Use GetUserV2 instead."
@auth:JWT

@deprecated:"Use GetUserV2 instead."
@auth:JWT
- GetUser(header: map<string,string>, userID: uint64) => (code: uint32, user: User)

# GetUserV2 returns user based on given userID.
#
# Replaces GetUser endpoint.
@auth:JWT

# GetUserV2 returns user based on given userID.
# Replaces GetUser endpoint.
@auth:JWT
- GetUserV2(header: map<string,string>, userID: uint64) => (code: uint32, user: User, profilePicture: string)

# FindUser searches for a user using the given search filter.
#
# The filters are q (string) and active (bool).
@auth:JWT
# 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(s: SearchFilter) => (name: string, user: User)

# ListUsers returns all users.
@auth:JWT
# ListUsers returns all users.
@auth:JWT
- ListUsers() => (users: []User)

- GetComplex() => (complex: ComplexType)
- GetComplex() => (complex: ComplexType)
- GetAllOptional() => (optional: Optional)

service AdminService
@auth:JWT
@auth:JWT
- ListUsers() => (users: []User)

error 100 RateLimited "too many requests" HTTP 429
error 101 DatabaseDown "service outage" HTTP 503
error 100 RateLimited "too many requests" HTTP 429
error 101 DatabaseDown "service outage" HTTP 503

6 changes: 2 additions & 4 deletions main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ paths:
{{- $deprecated := index $method.Annotations "deprecated" }}
/rpc/{{$service.Name}}/{{$method.Name}}:
post:
summary: "{{ if $deprecated }}{{ if $deprecated.Value }}Deprecated: {{$deprecated.Value}}{{else}}Deprecated.{{end}}{{else if gt (len $method.Comments) 0}}{{index $method.Comments 0}}{{end}}"
summary: {{ if $deprecated }}{{ if $deprecated.Value }}{{printf "%q" (print "Deprecated: " $deprecated.Value)}}{{else}}"Deprecated."{{end}}{{else if gt (len $method.Comments) 0}}{{printf "%q" (index $method.Comments 0)}}{{else}}""{{end}}
{{- if $deprecated }}
deprecated: true
{{- end }}
Expand All @@ -151,11 +151,9 @@ paths:
{{- end }}
{{- if gt (len $method.Comments) 1 }}
description: |
{{- range $i, $comment := $method.Comments }}
{{- if gt $i 0 }}
{{- range $i, $comment := (slice $method.Comments 1) }}
{{$comment}}
{{- end }}
{{- end }}
{{- end }}
requestBody:
content:
Expand Down