Skip to content

[csharp proto plugin] Apply Obsolete attribute to deprecated services and methods in C# generated code#32414

Merged
apolcyn merged 5 commits intogrpc:masterfrom
tonydnewell:csharp-plugin-deprecated-option
Apr 26, 2023
Merged

[csharp proto plugin] Apply Obsolete attribute to deprecated services and methods in C# generated code#32414
apolcyn merged 5 commits intogrpc:masterfrom
tonydnewell:csharp-plugin-deprecated-option

Conversation

@tonydnewell
Copy link
Copy Markdown
Contributor

Apply Obsolete attribute to deprecated services and methods in C# generated code

Fix for #28597

The fix in this PR adds Obsolete attribute to classes and methods for deprecated services and methods within services. e.g.

service Greeter {
  option deprecated=true; // service level deprecated
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option deprecated=true; // method level deprecated
  }
}

I couldn't find any protocol buffers plugin tests to update. Tested locally.

@tonydnewell tonydnewell changed the title Apply Obsolete attribute to deprecated services and methods in C# generated coe Apply Obsolete attribute to deprecated services and methods in C# generated code Feb 16, 2023
@tonydnewell
Copy link
Copy Markdown
Contributor Author

Added pragma to disable obsolete warnings in the generated code (added disabling warning 0612) after discussions in #28597 (comment)

@jtattermusch jtattermusch self-requested a review March 9, 2023 10:01
@jtattermusch jtattermusch self-assigned this Mar 9, 2023
@jtattermusch
Copy link
Copy Markdown
Contributor

I just merged #32734, so please consider providing a codegen bazel test.

@tonydnewell
Copy link
Copy Markdown
Contributor Author

@jtattermusch I've added bazel tests.

@apolcyn apolcyn changed the title Apply Obsolete attribute to deprecated services and methods in C# generated code [csharp proto plugin] Apply Obsolete attribute to deprecated services and methods in C# generated code Apr 26, 2023
@apolcyn apolcyn added release notes: yes Indicates if PR needs to be in release notes kokoro:force-run labels Apr 26, 2023
@apolcyn apolcyn merged commit 83cdbff into grpc:master Apr 26, 2023
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Apr 27, 2023
XuanWang-Amos pushed a commit to XuanWang-Amos/grpc that referenced this pull request May 1, 2023
… and methods in C# generated code (grpc#32414)

Apply Obsolete attribute to deprecated services and methods in C#
generated code

Fix for grpc#28597

- Deprecated support for enums and enum values is already fixed by
protocolbuffers/protobuf#10520 but this is not
yet released. It is fixed in Protocol Buffers v22.0-rc1 but the gRPC
repo currently has 21.12 as the protocol buffers submodule.

- Deprecated support for messages and fields already exists in the
protocol buffers compiler.

The fix in this PR adds `Obsolete` attribute to classes and methods for
deprecated services and methods within services. e.g.
```
service Greeter {
  option deprecated=true; // service level deprecated
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option deprecated=true; // method level deprecated
  }
}
```

I couldn't find any protocol buffers plugin tests to update. Tested
locally.
paulosjca pushed a commit to paulosjca/grpc that referenced this pull request May 4, 2023
… and methods in C# generated code (grpc#32414)

Apply Obsolete attribute to deprecated services and methods in C#
generated code

Fix for grpc#28597

- Deprecated support for enums and enum values is already fixed by
protocolbuffers/protobuf#10520 but this is not
yet released. It is fixed in Protocol Buffers v22.0-rc1 but the gRPC
repo currently has 21.12 as the protocol buffers submodule.

- Deprecated support for messages and fields already exists in the
protocol buffers compiler.

The fix in this PR adds `Obsolete` attribute to classes and methods for
deprecated services and methods within services. e.g.
```
service Greeter {
  option deprecated=true; // service level deprecated
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option deprecated=true; // method level deprecated
  }
}
```

I couldn't find any protocol buffers plugin tests to update. Tested
locally.
wanlin31 pushed a commit that referenced this pull request May 18, 2023
… and methods in C# generated code (#32414)

Apply Obsolete attribute to deprecated services and methods in C#
generated code

Fix for #28597

- Deprecated support for enums and enum values is already fixed by
protocolbuffers/protobuf#10520 but this is not
yet released. It is fixed in Protocol Buffers v22.0-rc1 but the gRPC
repo currently has 21.12 as the protocol buffers submodule.

- Deprecated support for messages and fields already exists in the
protocol buffers compiler.

The fix in this PR adds `Obsolete` attribute to classes and methods for
deprecated services and methods within services. e.g.
```
service Greeter {
  option deprecated=true; // service level deprecated
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option deprecated=true; // method level deprecated
  }
}
```

I couldn't find any protocol buffers plugin tests to update. Tested
locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat/none imported Specifies if the PR has been imported to the internal repository lang/C# per-call-memory/neutral per-channel-memory/neutral release notes: yes Indicates if PR needs to be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants