diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index c807af7..15c09c8 100644 --- a/_examples/golang-basics/example.gen.go +++ b/_examples/golang-basics/example.gen.go @@ -1,4 +1,4 @@ -// example v0.0.1 05b7a5c86b98738f4fe6ce9bb1fccd4af064847a +// example v0.0.1 152ac66bd1ba0c23ff47f7a70749eaffa9704886 // -- // Code generated by webrpc-gen@v0.20.3-1-gf6584bc with ../../../gen-golang generator. DO NOT EDIT. // @@ -33,7 +33,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "05b7a5c86b98738f4fe6ce9bb1fccd4af064847a" + return "152ac66bd1ba0c23ff47f7a70749eaffa9704886" } // @@ -180,7 +180,7 @@ var ( "/rpc/ExampleService/GetUser": { Name: "GetUser", Service: "ExampleService", - Annotations: map[string]string{}, + Annotations: map[string]string{"deprecated": "GetUserV2"}, }, "/rpc/ExampleService/FindUser": { Name: "FindUser", @@ -217,6 +217,10 @@ type ExampleService interface { // gives you current status of running application Status(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) + // Get user endpoint + // + // gives you basic info about user + // Deprecated: use GetUserV2 GetUser(ctx context.Context, header map[string]string, userID uint64) (*User, error) FindUser(ctx context.Context, s *SearchFilter) (string, *User, error) LogEvent(ctx context.Context, event string) error @@ -233,6 +237,10 @@ type ExampleServiceClient interface { // gives you current status of running application Status(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) + // Get user endpoint + // + // gives you basic info about user + // Deprecated: use GetUserV2 GetUser(ctx context.Context, header map[string]string, userID uint64) (*User, error) FindUser(ctx context.Context, s *SearchFilter) (string, *User, error) LogEvent(ctx context.Context, event string) error diff --git a/_examples/golang-basics/example.ridl b/_examples/golang-basics/example.ridl index d60169f..c31dc91 100644 --- a/_examples/golang-basics/example.ridl +++ b/_examples/golang-basics/example.ridl @@ -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, userID: uint64) => (user: User) - FindUser(s: SearchFilter) => (name: string, user: User) - LogEvent(event: string) diff --git a/_examples/golang-basics/example_test.go b/_examples/golang-basics/example_test.go index 1da0f52..312b79e 100644 --- a/_examples/golang-basics/example_test.go +++ b/_examples/golang-basics/example_test.go @@ -10,7 +10,7 @@ import ( ) var ( - client ExampleService + client ExampleServiceClient ) // func TestMain() diff --git a/types.go.tmpl b/types.go.tmpl index a9cefeb..ed3a41a 100644 --- a/types.go.tmpl +++ b/types.go.tmpl @@ -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 -}} @@ -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 -}}