Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark deprecated methods and print which method use instead #74

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -102,6 +102,10 @@ service ExampleService
@internal
- Status() => (status: bool)
- Version() => (version: Version)
# Get user endpoint
#
# gives you basic info about user
@deprecated:GetUserV2
LukasJenicek marked this conversation as resolved.
Show resolved Hide resolved
- 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
Loading