-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add JsonUtf8Reader (for ReadOnlySpan) along with unit tests #33216
Changes from all commits
71e24b1
1a95dbe
3351e23
b6602f8
9db92d5
8a72210
d46d82e
da3d8cd
9c28ea6
1add330
2352633
fa41f2c
887f3f3
bb97e67
795bd8e
cbaf257
0bbd761
ccabdda
b3ec7d5
2fc7ece
223ab30
39fa595
e85f44f
ae59f2d
05305e0
5b649e2
8bb7f25
6a24093
b5188d7
5d50dea
e4ee6f1
1c4aa4f
1e02e09
c154053
96df849
130c287
6e2dcd3
40e66a3
e2fd647
c23b9d8
e220c9d
9622303
9f7767b
c5b323d
f06b098
991cbb9
7f46956
6df3276
cb9fef7
9a5b901
6fd5434
80ec541
87d6edd
3452682
de267e0
e80cdbf
903a8c8
3d24832
cae7b87
d33c7b7
21f4313
4a2aa63
95bab37
c12f500
1b3d16a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| <BuildConfigurations> | ||
| netstandard; | ||
| netfx; | ||
| netcoreapp; | ||
| </BuildConfigurations> | ||
| </PropertyGroup> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,32 @@ | |
|
|
||
| namespace System.Text.Json | ||
| { | ||
| public enum JsonCommentHandling : byte | ||
| { | ||
| Allow = (byte)1, | ||
| Disallow = (byte)0, | ||
| Skip = (byte)2, | ||
| } | ||
| public sealed partial class JsonReaderException : System.Exception | ||
| { | ||
| public JsonReaderException(string message, long lineNumber, long bytePositionInLine) { } | ||
| public long BytePositionInLine { get { throw null; } } | ||
| public long LineNumber { get { throw null; } } | ||
| public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } | ||
| } | ||
| public partial struct JsonReaderOptions | ||
| { | ||
| private object _dummy; | ||
| public System.Text.Json.JsonCommentHandling CommentHandling { get { throw null; } set { } } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that comments are the big one, but are there any other options up for consideration (e.g. single-quote strings, etc.)?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifically single-quote strings, no. For any other options, the bar is much higher and there needs to be a strong scenario that would push us to add it. Ideally, the 90%+ case is valid RFC-compliant JSON, and maybe certain variations can be built on top or worked around in user code. I would be interested in getting feedback on potential other options coupled with the scenario to drive it. |
||
| } | ||
| public partial struct JsonReaderState | ||
| { | ||
| private object _dummy; | ||
| public JsonReaderState(int maxDepth = 64, System.Text.Json.JsonReaderOptions options = default(System.Text.Json.JsonReaderOptions)) { throw null; } | ||
| public long BytesConsumed { get { throw null; } } | ||
| public int MaxDepth { get { throw null; } } | ||
|
ahsonkhan marked this conversation as resolved.
|
||
| public System.Text.Json.JsonReaderOptions Options { get { throw null; } } | ||
|
ahsonkhan marked this conversation as resolved.
|
||
| } | ||
| public enum JsonTokenType : byte | ||
| { | ||
| Comment = (byte)11, | ||
|
|
@@ -22,4 +48,22 @@ public enum JsonTokenType : byte | |
| String = (byte)6, | ||
| True = (byte)8, | ||
| } | ||
| public ref partial struct Utf8JsonReader | ||
| { | ||
| private object _dummy; | ||
| public Utf8JsonReader(System.ReadOnlySpan<byte> jsonData, bool isFinalBlock, System.Text.Json.JsonReaderState state) { throw null; } | ||
| public long BytesConsumed { get { throw null; } } | ||
| public int CurrentDepth { get { throw null; } } | ||
| public System.Text.Json.JsonReaderState CurrentState { get { throw null; } } | ||
| public System.Text.Json.JsonTokenType TokenType { get { throw null; } } | ||
| public System.ReadOnlySpan<byte> ValueSpan { get { throw null; } } | ||
| public bool GetBooleanValue() { throw null; } | ||
| public string GetStringValue() { throw null; } | ||
| public bool Read() { throw null; } | ||
| public bool TryGetDecimalValue(out decimal value) { throw null; } | ||
| public bool TryGetDoubleValue(out double value) { throw null; } | ||
| public bool TryGetInt32Value(out int value) { throw null; } | ||
| public bool TryGetInt64Value(out long value) { throw null; } | ||
| public bool TryGetSingleValue(out float value) { throw null; } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ' Licensed to the .NET Foundation under one or more agreements. | ||
| ' The .NET Foundation licenses this file to you under the MIT license. | ||
| ' See the LICENSE file in the project root for more information. | ||
| ' Requires PlantUML to interpret: http://plantuml.com/ | ||
| ' See license info under http://plantuml.com/faq for more details | ||
|
|
||
| @startuml | ||
| license | ||
| @enduml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ViktorHofer, please review the changes to S.R.Serialization.Formatters tests. I added a netcoreapp specific config.