Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8013865
Json prototype (#1)
kasiabulat Jul 17, 2019
0f7df28
Json prototype - transformation API (#2)
kasiabulat Jul 19, 2019
6cd2efb
Json prototype (#1)
kasiabulat Jul 17, 2019
409e575
Json prototype - transformation API (#2)
kasiabulat Jul 19, 2019
25109c3
Merge branch 'master' of https://github.com/kasiabulat/corefx
kasiabulat Jul 29, 2019
9dcfc4b
JsonNumber implementation and tests (#3)
kasiabulat Jul 30, 2019
38af6d9
Merge remote-tracking branch 'upstream/master'
kasiabulat Jul 30, 2019
08f4734
all unimplemented classes and methods with accompanying tests removed
kasiabulat Jul 30, 2019
63ff329
First part of documentation added
kasiabulat Jul 30, 2019
0e0fb7c
documentation completed
kasiabulat Jul 31, 2019
47666ce
missing exceptions added
kasiabulat Jul 31, 2019
d856681
JsonElement changes removed
kasiabulat Jul 31, 2019
22e6558
part of the review comments included
kasiabulat Aug 1, 2019
04441f1
work on review comments
kasiabulat Aug 1, 2019
30c5dd0
code refactor
kasiabulat Aug 5, 2019
8f3e510
more decimal tests added using MemberData
kasiabulat Aug 5, 2019
c6ab148
more decimal tests added using MemberData
kasiabulat Aug 5, 2019
259590b
more test cases added
kasiabulat Aug 5, 2019
c4d6ef2
equals summary adjusted, equals tests added
kasiabulat Aug 5, 2019
01c230f
more Equals tests added, GetHashCode tests added, minor changes
kasiabulat Aug 6, 2019
392142a
scientifing notation support added, rational numbers tests fixes
kasiabulat Aug 6, 2019
310a5a6
rational overflow tests added
kasiabulat Aug 6, 2019
e03b803
ulong maxvalue tests added to rational types
kasiabulat Aug 6, 2019
95a9401
presision problems fixes
kasiabulat Aug 6, 2019
2bd6871
exception strings fixed
kasiabulat Aug 6, 2019
f0c4814
CI failing fixes (hopefully), review comments included
kasiabulat Aug 7, 2019
c22b36d
missing == tests added to achieve 100% branch coverage
kasiabulat Aug 7, 2019
7dfc891
review comments included
kasiabulat Aug 8, 2019
07746d8
Merge remote-tracking branch 'upstream/master' into kasiabulat/json-n…
kasiabulat Aug 8, 2019
d479fa7
Merge remote-tracking branch 'upstream/master' into kasiabulat/json-n…
kasiabulat Aug 8, 2019
ab1401a
trailing whitespaces fixes
kasiabulat Aug 8, 2019
217bade
equals comments added
kasiabulat Aug 8, 2019
40a6649
equals object refactored to call quals json number
kasiabulat Aug 8, 2019
af4aed3
Merge conflicts resolved
kasiabulat Aug 8, 2019
f534415
merge fix
kasiabulat Aug 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Json prototype (#1)
Basic API for Json writable DOM with scenarios including collection initialization, accessing and modifying Json nodes.
  • Loading branch information
kasiabulat committed Jul 29, 2019
commit 6cd2efbdf4997c811b593b466a94edffaba19d76
224 changes: 224 additions & 0 deletions src/System.Text.Json/ref/System.Text.Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,97 @@

namespace System.Text.Json
{
public partial class JsonArray : System.Text.Json.JsonNode, System.Collections.Generic.ICollection<System.Text.Json.JsonNode>, System.Collections.Generic.IEnumerable<System.Text.Json.JsonNode>, System.Collections.Generic.IList<System.Text.Json.JsonNode>, System.Collections.Generic.IReadOnlyCollection<System.Text.Json.JsonNode>, System.Collections.Generic.IReadOnlyList<System.Text.Json.JsonNode>, System.Collections.IEnumerable
{
public JsonArray() { }
public JsonArray(System.Collections.Generic.IEnumerable<bool> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<byte> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<double> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<short> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<int> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<long> values) { }
[System.CLSCompliantAttribute(false)]
public JsonArray(System.Collections.Generic.IEnumerable<sbyte> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<float> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<string> values) { }
public JsonArray(System.Collections.Generic.IEnumerable<System.Text.Json.JsonNode> values) { }
[System.CLSCompliantAttribute(false)]
public JsonArray(System.Collections.Generic.IEnumerable<ushort> values) { }
[System.CLSCompliantAttribute(false)]
public JsonArray(System.Collections.Generic.IEnumerable<uint> values) { }
[System.CLSCompliantAttribute(false)]
public JsonArray(System.Collections.Generic.IEnumerable<ulong> values) { }
public int Count { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public System.Text.Json.JsonNode this[int idx] { get { throw null; } set { } }
public void Add(bool value) { }
public void Add(byte value) { }
public void Add(double value) { }
public void Add(short value) { }
public void Add(int value) { }
public void Add(long value) { }
[System.CLSCompliantAttribute(false)]
public void Add(sbyte value) { }
public void Add(float value) { }
public void Add(string value) { }
public void Add(System.Text.Json.JsonNode value) { }
[System.CLSCompliantAttribute(false)]
public void Add(ushort value) { }
[System.CLSCompliantAttribute(false)]
public void Add(uint value) { }
[System.CLSCompliantAttribute(false)]
public void Add(ulong value) { }
public void Clear() { }
public bool Contains(bool value) { throw null; }
public bool Contains(byte value) { throw null; }
public bool Contains(double value) { throw null; }
public bool Contains(short value) { throw null; }
public bool Contains(int value) { throw null; }
public bool Contains(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Contains(sbyte value) { throw null; }
public bool Contains(float value) { throw null; }
public bool Contains(string value) { throw null; }
public bool Contains(System.Text.Json.JsonNode value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Contains(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Contains(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Contains(ulong value) { throw null; }
public System.Collections.Generic.IEnumerator<System.Text.Json.JsonNode> GetEnumerator() { throw null; }
public int IndexOf(System.Text.Json.JsonNode item) { throw null; }
public void Insert(int index, bool item) { }
public void Insert(int index, byte item) { }
public void Insert(int index, double item) { }
public void Insert(int index, short item) { }
public void Insert(int index, int item) { }
public void Insert(int index, long item) { }
[System.CLSCompliantAttribute(false)]
public void Insert(int index, sbyte item) { }
public void Insert(int index, float item) { }
public void Insert(int index, string item) { }
public void Insert(int index, System.Text.Json.JsonNode item) { }
[System.CLSCompliantAttribute(false)]
public void Insert(int index, ushort item) { }
[System.CLSCompliantAttribute(false)]
public void Insert(int index, uint item) { }
[System.CLSCompliantAttribute(false)]
public void Insert(int index, ulong item) { }
public bool Remove(System.Text.Json.JsonNode item) { throw null; }
public void RemoveAt(int index) { }
void System.Collections.Generic.ICollection<System.Text.Json.JsonNode>.CopyTo(System.Text.Json.JsonNode[] array, int arrayIndex) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class JsonBoolean : System.Text.Json.JsonNode
{
public JsonBoolean() { }
public JsonBoolean(bool value) { }
public bool Value { get { throw null; } set { } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
public static implicit operator System.Text.Json.JsonBoolean (bool value) { throw null; }
}
public enum JsonCommentHandling : byte
{
Disallow = (byte)0,
Expand Down Expand Up @@ -156,6 +247,130 @@ protected JsonNamingPolicy() { }
public static System.Text.Json.JsonNamingPolicy CamelCase { get { throw null; } }
public abstract string ConvertName(string name);
}
public partial class JsonNode
{
public JsonNode() { }
}
public partial class JsonNumber : System.Text.Json.JsonNode
{
public JsonNumber() { }
public JsonNumber(byte value) { }
public JsonNumber(double value) { }
public JsonNumber(short value) { }
public JsonNumber(int value) { }
public JsonNumber(long value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(sbyte value) { }
public JsonNumber(float value) { }
public JsonNumber(string value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(ushort value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(uint value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(ulong value) { }
public override bool Equals(object obj) { throw null; }
public byte GetByte() { throw null; }
public double GetDouble() { throw null; }
public override int GetHashCode() { throw null; }
public short GetInt16() { throw null; }
public int GetInt32() { throw null; }
public long GetInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte GetSByte() { throw null; }
public float GetSingle() { throw null; }
public string GetString() { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort GetUInt16() { throw null; }
[System.CLSCompliantAttribute(false)]
public uint GetUInt32() { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong GetUInt64() { throw null; }
public static implicit operator System.Text.Json.JsonNumber (byte value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (double value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (short value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (int value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (sbyte value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (ulong value) { throw null; }
public void SetByte(byte value) { }
public void SetDouble(double value) { }
public void SetInt16(short value) { }
public void SetInt32(int value) { }
public void SetInt64(long value) { }
[System.CLSCompliantAttribute(false)]
public void SetSByte(sbyte value) { }
public void SetSingle(float value) { }
public void SetString(string value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt16(ushort value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt32(uint value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt64(ulong value) { }
public bool TryGetByte(out byte value) { throw null; }
public bool TryGetDouble(out double value) { throw null; }
public bool TryGetInt16(out short value) { throw null; }
public bool TryGetInt32(out int value) { throw null; }
public bool TryGetInt64(out long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetSByte(out sbyte value) { throw null; }
public bool TryGetSingle(out float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt16(out ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt32(out uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt64(out ulong value) { throw null; }
}
public partial class JsonObject : System.Text.Json.JsonNode, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Text.Json.JsonNode>>, System.Collections.IEnumerable
{
public JsonObject() { }
public JsonObject(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Text.Json.JsonNode>> jsonProperties) { }
public System.Text.Json.JsonNode this[string key] { get { throw null; } set { } }
public System.Collections.Generic.ICollection<string> PropertyNames { get { throw null; } }
public System.Collections.Generic.ICollection<System.Text.Json.JsonNode> Values { get { throw null; } }
public void Add(System.Collections.Generic.KeyValuePair<string, System.Text.Json.JsonNode> jsonProperty) { }
public void Add(string propertyName, bool propertyValue) { }
public void Add(string propertyName, byte propertyValue) { }
public void Add(string propertyName, System.Collections.Generic.IEnumerable<System.Text.Json.JsonNode> propertyValue) { }
public void Add(string propertyName, double propertyValue) { }
public void Add(string propertyName, short propertyValue) { }
public void Add(string propertyName, int propertyValue) { }
public void Add(string propertyName, long propertyValue) { }
[System.CLSCompliantAttribute(false)]
public void Add(string propertyName, sbyte propertyValue) { }
public void Add(string propertyName, float propertyValue) { }
public void Add(string propertyName, string propertyValue) { }
public void Add(string propertyName, System.Text.Json.JsonArray propertyValue) { }
public void Add(string propertyName, System.Text.Json.JsonNode propertyValue) { }
[System.CLSCompliantAttribute(false)]
public void Add(string propertyName, ushort propertyValue) { }
[System.CLSCompliantAttribute(false)]
public void Add(string propertyName, uint propertyValue) { }
[System.CLSCompliantAttribute(false)]
public void Add(string propertyName, ulong propertyValue) { }
public void AddRange(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Text.Json.JsonNode>> jsonProperties) { }
public bool ContainsProperty(string propertyName) { throw null; }
public System.Collections.Generic.IEnumerable<System.Text.Json.JsonNode> GetAllProperties(string propertyName) { throw null; }
public System.Text.Json.JsonArray GetArrayProperty(string propertyName) { throw null; }
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, System.Text.Json.JsonNode>> GetEnumerator() { throw null; }
public System.Text.Json.JsonObject GetObjectProperty(string propertyName) { throw null; }
public System.Text.Json.JsonNode GetProperty(string propertyName) { throw null; }
public bool ModifyPropertyName(string oldName, string newName) { throw null; }
public bool Remove(string propertyName) { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetArrayProperty(string propertyName, out System.Text.Json.JsonArray jsonArray) { throw null; }
public bool TryGetObjectProperty(string propertyName, out System.Text.Json.JsonObject jsonObject) { throw null; }
public bool TryGetProperty(string propertyName, out System.Text.Json.JsonNode jsonNode) { throw null; }
}
public readonly partial struct JsonProperty
{
private readonly object _dummy;
Expand Down Expand Up @@ -217,6 +432,15 @@ public JsonSerializerOptions() { }
public bool WriteIndented { get { throw null; } set { } }
public System.Text.Json.Serialization.JsonConverter GetConverter(System.Type typeToConvert) { throw null; }
}
public partial class JsonString : System.Text.Json.JsonNode
{
public JsonString() { }
public JsonString(string value) { }
public string Value { get { throw null; } set { } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
public static implicit operator System.Text.Json.JsonString (string value) { throw null; }
}
public enum JsonTokenType : byte
{
None = (byte)0,
Expand Down
6 changes: 6 additions & 0 deletions src/System.Text.Json/src/System.Text.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
<Compile Include="System\Text\Json\JsonException.cs" />
<Compile Include="System\Text\Json\JsonHelpers.cs" />
<Compile Include="System\Text\Json\JsonHelpers.Date.cs" />
<Compile Include="System\Text\Json\Node\JsonArray.cs" />
<Compile Include="System\Text\Json\Node\JsonBoolean.cs" />
<Compile Include="System\Text\Json\Node\JsonNode.cs" />
<Compile Include="System\Text\Json\JsonTokenType.cs" />
<Compile Include="System\Text\Json\Node\JsonNumber.cs" />
<Compile Include="System\Text\Json\Node\JsonObject.cs" />
<Compile Include="System\Text\Json\Node\JsonString.cs" />
<Compile Include="System\Text\Json\ThrowHelper.cs" />
<Compile Include="System\Text\Json\ThrowHelper.Serialization.cs" />
<Compile Include="System\Text\Json\Document\JsonDocument.cs" />
Expand Down
104 changes: 104 additions & 0 deletions src/System.Text.Json/src/System/Text/Json/Node/JsonArray.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// 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.

using System.Collections;
using System.Collections.Generic;

// for now disabling error caused by not adding documentation to methods
#pragma warning disable CS1591

namespace System.Text.Json
{
public partial class JsonArray : JsonNode, IList<JsonNode>, IReadOnlyList<JsonNode>
{
public JsonArray() { }
public JsonArray(IEnumerable<JsonNode> values) { }
public JsonArray(IEnumerable<string> values) { }
public JsonArray(IEnumerable<bool> values) { }
public JsonArray(IEnumerable<byte> values) { }
public JsonArray(IEnumerable<short> values) { }
public JsonArray(IEnumerable<int> values) { }
public JsonArray(IEnumerable<long> values) { }
public JsonArray(IEnumerable<float> values) { }
public JsonArray(IEnumerable<double> values) { }
[CLSCompliant(false)]
public JsonArray(IEnumerable<sbyte> values) { }
[CLSCompliant(false)]
public JsonArray(IEnumerable<ushort> values) { }
[CLSCompliant(false)]
public JsonArray(IEnumerable<uint> values) { }
[CLSCompliant(false)]
public JsonArray(IEnumerable<ulong> values) { }

public JsonNode this[int idx] { get => throw null; set => throw null; }

public void Add(JsonNode value) { }
public void Add(string value) { }
public void Add(bool value) { }
public void Add(byte value) { }
public void Add(short value) { }
public void Add(int value) { }
public void Add(long value) { }
public void Add(float value) { }
public void Add(double value) { }
[CLSCompliant(false)]
public void Add(sbyte value) { }
[CLSCompliant(false)]
public void Add(ushort value) { }
[CLSCompliant(false)]
public void Add(uint value) { }
[CLSCompliant(false)]
public void Add(ulong value) { }

public void Insert(int index, JsonNode item) { throw null; }
public void Insert(int index, string item) { throw null; }
public void Insert(int index, bool item) { throw null; }
public void Insert(int index, byte item) { throw null; }
public void Insert(int index, short item) { throw null; }
public void Insert(int index, int item) { throw null; }
public void Insert(int index, long item) { throw null; }
public void Insert(int index, float item) { throw null; }
public void Insert(int index, double item) { throw null; }
[CLSCompliant(false)]
public void Insert(int index, sbyte item) { throw null; }
[CLSCompliant(false)]
public void Insert(int index, ushort item) { throw null; }
[CLSCompliant(false)]
public void Insert(int index, uint item) { throw null; }
[CLSCompliant(false)]
public void Insert(int index, ulong item) { throw null; }

public bool Contains(JsonNode value) { throw null; }
public bool Contains(string value) { throw null; }
public bool Contains(bool value) { throw null; }
public bool Contains(byte value) { throw null; }
public bool Contains(short value) { throw null; }
public bool Contains(int value) { throw null; }
public bool Contains(long value) { throw null; }
public bool Contains(float value) { throw null; }
public bool Contains(double value) { throw null; }
[CLSCompliant(false)]
public bool Contains(sbyte value) { throw null; }
[CLSCompliant(false)]
public bool Contains(ushort value) { throw null; }
[CLSCompliant(false)]
public bool Contains(uint value) { throw null; }
[CLSCompliant(false)]
public bool Contains(ulong value) { throw null; }

public int Count => throw new NotImplementedException();
public bool IsReadOnly => throw new NotImplementedException();

public int IndexOf(JsonNode item) { throw null; }
public void RemoveAt(int index) { throw null; }
public void Clear() { throw null; }
public bool Remove(JsonNode item) { throw null; }

void ICollection<JsonNode>.CopyTo(JsonNode[] array, int arrayIndex) { throw null; }
IEnumerator IEnumerable.GetEnumerator() { throw null; }
public IEnumerator<JsonNode> GetEnumerator() { throw null; }
}
}

#pragma warning restore CS1591
Loading