Skip to content

Commit

Permalink
Add JsonDocumentOptions and use that instead of JsonReaderOptions. (d…
Browse files Browse the repository at this point in the history
…otnet/corefx#38866)

* Add JsonDocumentOptions and use that instead of JsonReaderOptions.

* Address PR feedback.

* Auto-generate the reference assembly.

* Auto-gen the ref from the source.

* Explicitly mark property getters as readonly.

* Cleanup and fix converter argument name to typeToConvert.


Commit migrated from dotnet/corefx@e4d3297
  • Loading branch information
ahsonkhan authored Jun 26, 2019
1 parent ffee4b2 commit e0f16ab
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 124 deletions.
48 changes: 28 additions & 20 deletions src/libraries/System.Text.Json/ref/System.Text.Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,22 @@ public sealed partial class JsonDocument : System.IDisposable
internal JsonDocument() { }
public System.Text.Json.JsonElement RootElement { get { throw null; } }
public void Dispose() { }
public static System.Text.Json.JsonDocument Parse(System.Buffers.ReadOnlySequence<byte> utf8Json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.IO.Stream utf8Json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.ReadOnlyMemory<byte> utf8Json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.ReadOnlyMemory<char> json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(string json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions)) { throw null; }
public static System.Threading.Tasks.Task<System.Text.Json.JsonDocument> ParseAsync(System.IO.Stream utf8Json, System.Text.Json.JsonReaderOptions readerOptions = default(System.Text.Json.JsonReaderOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.Buffers.ReadOnlySequence<byte> utf8Json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.IO.Stream utf8Json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.ReadOnlyMemory<byte> utf8Json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.ReadOnlyMemory<char> json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Text.Json.JsonDocument Parse(string json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Threading.Tasks.Task<System.Text.Json.JsonDocument> ParseAsync(System.IO.Stream utf8Json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Text.Json.JsonDocument ParseValue(ref System.Text.Json.Utf8JsonReader reader) { throw null; }
public static bool TryParseValue(ref System.Text.Json.Utf8JsonReader reader, out System.Text.Json.JsonDocument document) { throw null; }
}
public partial struct JsonDocumentOptions
{
private int _dummyPrimitive;
public bool AllowTrailingCommas { readonly get { throw null; } set { } }
public System.Text.Json.JsonCommentHandling CommentHandling { readonly get { throw null; } set { } }
public int MaxDepth { readonly get { throw null; } set { } }
}
public readonly partial struct JsonElement
{
private readonly object _dummy;
Expand Down Expand Up @@ -133,14 +140,15 @@ public void Reset() { }
}
public partial class JsonException : System.Exception
{
protected JsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public JsonException() { }
protected JsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public JsonException(string message) { }
public JsonException(string message, System.Exception innerException) { }
public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine) { }
public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine, System.Exception innerException) { }
public long? BytePositionInLine { get { throw null; } }
public long? LineNumber { get { throw null; } }
public override string Message { get { throw null; } }
public string Path { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
Expand All @@ -165,7 +173,7 @@ public partial struct JsonReaderOptions
private int _dummyPrimitive;
public bool AllowTrailingCommas { readonly get { throw null; } set { } }
public System.Text.Json.JsonCommentHandling CommentHandling { readonly get { throw null; } set { } }
public int MaxDepth { get { throw null; } set { } }
public int MaxDepth { readonly get { throw null; } set { } }
}
public partial struct JsonReaderState
{
Expand Down Expand Up @@ -202,14 +210,14 @@ public JsonSerializerOptions() { }
public System.Collections.Generic.IList<System.Text.Json.Serialization.JsonConverter> Converters { get { throw null; } }
public int DefaultBufferSize { get { throw null; } set { } }
public System.Text.Json.JsonNamingPolicy DictionaryKeyPolicy { get { throw null; } set { } }
public System.Text.Json.Serialization.JsonConverter GetConverter(System.Type typeToConvert) { throw null; }
public bool IgnoreNullValues { get { throw null; } set { } }
public bool IgnoreReadOnlyProperties { get { throw null; } set { } }
public int MaxDepth { get { throw null; } set { } }
public bool PropertyNameCaseInsensitive { get { throw null; } set { } }
public System.Text.Json.JsonNamingPolicy PropertyNamingPolicy { get { throw null; } set { } }
public System.Text.Json.JsonCommentHandling ReadCommentHandling { get { throw null; } set { } }
public bool WriteIndented { get { throw null; } set { } }
public System.Text.Json.Serialization.JsonConverter GetConverter(System.Type typeToConvert) { throw null; }
}
public enum JsonTokenType : byte
{
Expand Down Expand Up @@ -447,13 +455,13 @@ protected JsonAttribute() { }
public abstract partial class JsonConverter
{
internal JsonConverter() { }
public abstract bool CanConvert(System.Type type);
public abstract bool CanConvert(System.Type typeToConvert);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)]
public partial class JsonConverterAttribute : System.Text.Json.Serialization.JsonAttribute
{
public JsonConverterAttribute(System.Type converterType) { }
protected JsonConverterAttribute() { }
public JsonConverterAttribute(System.Type converterType) { }
public System.Type ConverterType { get { throw null; } }
public virtual System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert) { throw null; }
}
Expand All @@ -465,18 +473,11 @@ protected internal JsonConverterFactory() { }
public abstract partial class JsonConverter<T> : System.Text.Json.Serialization.JsonConverter
{
protected internal JsonConverter() { }
public override bool CanConvert(System.Type type) { throw null; }
public abstract T Read(ref System.Text.Json.Utf8JsonReader reader, System.Type type, System.Text.Json.JsonSerializerOptions options);
public override bool CanConvert(System.Type typeToConvert) { throw null; }
public abstract T Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options);
public virtual void Write(System.Text.Json.Utf8JsonWriter writer, T value, System.Text.Json.JsonEncodedText propertyName, System.Text.Json.JsonSerializerOptions options) { }
public abstract void Write(System.Text.Json.Utf8JsonWriter writer, T value, System.Text.Json.JsonSerializerOptions options);
}
public sealed class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
{
public JsonStringEnumConverter() { }
public JsonStringEnumConverter(System.Text.Json.JsonNamingPolicy namingPolicy = null, bool allowIntegerValues = true) { }
public override bool CanConvert(System.Type type) { throw null; }
protected override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type type) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false)]
public sealed partial class JsonExtensionDataAttribute : System.Text.Json.Serialization.JsonAttribute
{
Expand All @@ -493,4 +494,11 @@ public sealed partial class JsonPropertyNameAttribute : System.Text.Json.Seriali
public JsonPropertyNameAttribute(string name) { }
public string Name { get { throw null; } }
}
public sealed partial class JsonStringEnumConverter : System.Text.Json.Serialization.JsonConverterFactory
{
public JsonStringEnumConverter() { }
public JsonStringEnumConverter(System.Text.Json.JsonNamingPolicy namingPolicy = null, bool allowIntegerValues = true) { }
public override bool CanConvert(System.Type typeToConvert) { throw null; }
protected override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert) { throw null; }
}
}
1 change: 1 addition & 0 deletions src/libraries/System.Text.Json/src/System.Text.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<Compile Include="System\Text\Json\Document\JsonDocument.StackRow.cs" />
<Compile Include="System\Text\Json\Document\JsonDocument.StackRowStack.cs" />
<Compile Include="System\Text\Json\Document\JsonDocument.TryGetProperty.cs" />
<Compile Include="System\Text\Json\Document\JsonDocumentOptions.cs" />
<Compile Include="System\Text\Json\Document\JsonElement.cs" />
<Compile Include="System\Text\Json\Document\JsonElement.ArrayEnumerator.cs" />
<Compile Include="System\Text\Json\Document\JsonElement.ObjectEnumerator.cs" />
Expand Down
Loading

0 comments on commit e0f16ab

Please sign in to comment.