Skip to content

Commit

Permalink
mark deprecated methods and print which method use instead
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 18, 2024
1 parent 5275eca commit ccce583
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
14 changes: 11 additions & 3 deletions _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions _examples/golang-basics/example.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ service ExampleService
@internal
- Status() => (status: bool)
- Version() => (version: Version)
# Get user endpoint
#
# gives you basic info about user
@deprecated:GetUserV2
- GetUser(header: map<string,string>, userID: uint64) => (user: User)
- FindUser(s: SearchFilter) => (name: string, user: User)
- LogEvent(event: string)
2 changes: 1 addition & 1 deletion _examples/golang-basics/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
client ExampleService
client ExampleServiceClient
)

// func TestMain()
Expand Down
8 changes: 8 additions & 0 deletions types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type {{$service.Name}} interface {
// {{ replaceAll $comment "\"" "'" }}
{{- end }}
{{- end }}
{{- $deprecated := index $method.Annotations "deprecated" -}}
{{- if $deprecated }}
// Deprecated: {{ if ne $deprecated.Value "" }}use {{ $deprecated.Value }}{{ end }}
{{- end }}
{{ if eq $method.StreamOutput true -}}
{{$method.Name}}(ctx context.Context{{range $_, $input := $method.Inputs}}, {{$input.Name}} {{template "field" dict "Name" $input.Name "Type" $input.Type "TypeMap" $typeMap "TypePrefix" $typePrefix "Optional" $input.Optional "TypeMeta" $input.Meta}}{{end}}, stream {{$method.Name}}StreamWriter) error
{{- else -}}
Expand Down Expand Up @@ -172,6 +176,10 @@ type {{$service.Name}}Client interface {
// {{ replaceAll $comment "\"" "'" }}
{{- end }}
{{- end }}
{{- $deprecated := index $method.Annotations "deprecated" -}}
{{- if $deprecated }}
// Deprecated: {{ if ne $deprecated.Value "" }}use {{ $deprecated.Value }}{{ end }}
{{- end }}
{{ if eq $method.StreamOutput true -}}
{{$method.Name}}(ctx context.Context{{range $_, $input := $method.Inputs}}, {{$input.Name}} {{template "field" dict "Name" $input.Name "Type" $input.Type "TypeMap" $typeMap "TypePrefix" $typePrefix "Optional" $input.Optional "TypeMeta" $input.Meta}}{{end}}) ({{$method.Name}}StreamReader, error)
{{- else -}}
Expand Down

0 comments on commit ccce583

Please sign in to comment.