[API Proposal]: Add Protobuf and ProtobufJson to MediaTypeNames.Application
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Background and motivation
The `application/protobuf` and `application/protobuf+json` MIME types were certified by the [IANA](https://www.iana.org/assignments/media-types#application) in [RFC 9996](https://www.rfc-editor.org/info/rfc9996/). I think it'd be useful to have them under the MediaTypeNames class.
### API Proposal
```csharp
namespace System.Net.Mime
{
public static class MediaTypeNames
{
/// Specifies the kind of application data in an email message attachment.
public static class Application
{
/// Specifies that the data is in Protobuf binary format.
public const string Protobuf = "application/protobuf";
/// Specifies that the data is in Protobuf JSON format.
public const string ProtobufJson = "application/protobuf+json";
}
}
}
```
### API Usage
```csharp
public class MyApiController : ControllerBase
{
[Consumes(MediaTypeNames.Application.Protobuf)]
public async Task AddSession()
{
// ...
}
}
```
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Research direction
Start by locating the System.Net.Mime.MediaTypeNames.Application entry point and review how its existing media type constants are declared and documented. Add the proposed Protobuf and ProtobufJson constants with the specified MIME values, then verify that the public API matches the proposal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100