dotnet / dotnet/runtime

[API Proposal]: Add Protobuf and ProtobufJson to MediaTypeNames.Application

Open Beginner friendly
#133,365 5 comments 0 reactions 0 assignees View on GitHub
api-suggestion area-System.Net
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.