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

[API Proposal]: Add ReadOnlySequence<char> overload for WriteRawValue #102491

Open
Tragetaschen opened this issue May 21, 2024 · 1 comment
Open
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Text.Json
Milestone

Comments

@Tragetaschen
Copy link
Contributor

Tragetaschen commented May 21, 2024

Background and motivation

In #68223, two overloads for Utf8JsonWriter were proposed, one for ReadOnlySequence<byte> and one for ReadOnlySequence<char>. The latter was rejected due to the necessary surrogate pair state handling while writing the ReadOnlySpan<char> segments.

However, #67337 is currently underway to add the building blocks and state handling for that. Adding the rejected overload now seems like an easy addition.

API Proposal

namespace System.Text.Json
{
    public sealed partial class Utf8JsonWriter
    {
+        public void WriteRawValue(ReadOnlySequence<char> json, bool skipInputValidation = false);
    }
}

API Usage

I could avoid building an entire in-memory, contiguous string just to have it written out as JSON. Other proposals like #97570 or #87362 would tie in very nicely as well.

Alternative Designs

No response

Risks

No response

@Tragetaschen Tragetaschen added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label May 21, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 21, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

@eiriktsarpalis eiriktsarpalis removed the untriaged New issue has not been triaged by the area owner label May 21, 2024
@eiriktsarpalis eiriktsarpalis added this to the Future milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Text.Json
Projects
None yet
Development

No branches or pull requests

2 participants