Skip to content

Commit f58d80c

Browse files
committed
render annotations only in > v0.20.0 webrpc
1 parent bec4137 commit f58d80c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

main.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const WebRPCSchemaVersion = "{{.SchemaVersion}}"
7676
// Schema hash generated from your RIDL schema
7777
export const WebRPCSchemaHash = "{{.SchemaHash}}"
7878

79-
{{template "types" dict "Types" .Types "Services" .Services "TypeMap" $typeMap}}
79+
{{template "types" dict "Types" .Types "Services" .Services "TypeMap" $typeMap "WebrpcVersion" .WebrpcVersion}}
8080

8181
{{- if $opts.client}}
8282
{{template "client" dict "Services" .Services "Opts" $opts "TypeMap" $typeMap}}

types.go.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{{- $typeMap := .TypeMap -}}
44
{{- $types := .Types -}}
55
{{- $services := .Services -}}
6+
{{- $webrpcVersion := .WebrpcVersion -}}
67

78
//
89
// Types
@@ -44,6 +45,7 @@ export interface {{$type.Name}} {
4445
{{- range $_, $service := $services}}
4546
export interface {{$service.Name}} {
4647
{{- range $_, $method := $service.Methods}}
48+
{{- if not (minVersion $webrpcVersion "v0.20.0") }}
4749
{{- $deprecated := index $method.Annotations "deprecated" -}}
4850
{{- if or (gt (len $method.Comments) 0) ($deprecated) }}
4951
/**
@@ -54,7 +56,8 @@ export interface {{$service.Name}} {
5456
* @deprecated {{ if ne $deprecated.Value "" }}use {{ $deprecated.Value }}{{ end }}
5557
{{- end }}
5658
*/
57-
{{- end }}
59+
{{- end }}
60+
{{- end }}
5861
{{firstLetterToLower $method.Name}}({{template "methodInputs" dict "Method" $method "TypeMap" $typeMap}}): Promise<{{if $method.StreamOutput}}void{{else}}{{$method.Name}}Return{{end}}>
5962
{{- end}}
6063
}

0 commit comments

Comments
 (0)