Skip to content

Commit

Permalink
render annotations only in > v0.20.0 webrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 18, 2024
1 parent bec4137 commit 4449474
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
webrpc-tests:
strategy:
matrix:
webrpc-version: [v0.18.0]
webrpc-version: [v0.20.0]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const WebRPCSchemaVersion = "{{.SchemaVersion}}"
// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = "{{.SchemaHash}}"

{{template "types" dict "Types" .Types "Services" .Services "TypeMap" $typeMap}}
{{template "types" dict "Types" .Types "Services" .Services "TypeMap" $typeMap "WebrpcVersion" .WebrpcVersion}}

{{- if $opts.client}}
{{template "client" dict "Services" .Services "Opts" $opts "TypeMap" $typeMap}}
Expand Down
5 changes: 4 additions & 1 deletion types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{- $typeMap := .TypeMap -}}
{{- $types := .Types -}}
{{- $services := .Services -}}
{{- $webrpcVersion := .WebrpcVersion -}}

//
// Types
Expand Down Expand Up @@ -44,6 +45,7 @@ export interface {{$type.Name}} {
{{- range $_, $service := $services}}
export interface {{$service.Name}} {
{{- range $_, $method := $service.Methods}}
{{- if not (minVersion $webrpcVersion "v0.20.0") }}
{{- $deprecated := index $method.Annotations "deprecated" -}}
{{- if or (gt (len $method.Comments) 0) ($deprecated) }}
/**
Expand All @@ -54,7 +56,8 @@ export interface {{$service.Name}} {
* @deprecated {{ if ne $deprecated.Value "" }}use {{ $deprecated.Value }}{{ end }}
{{- end }}
*/
{{- end }}
{{- end }}
{{- end }}
{{firstLetterToLower $method.Name}}({{template "methodInputs" dict "Method" $method "TypeMap" $typeMap}}): Promise<{{if $method.StreamOutput}}void{{else}}{{$method.Name}}Return{{end}}>
{{- end}}
}
Expand Down

0 comments on commit 4449474

Please sign in to comment.