Skip to content
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
95ff624
Add ability to inject and read additional properties for IJsonModels
m-nash Jul 22, 2025
58c4e54
Makes the ValueKind a flag
m-nash Jul 22, 2025
9bb933b
more progress / pr fb
m-nash Jul 24, 2025
0bc5e9c
extract ByteArrayEqualityComparer to its own file
m-nash Jul 24, 2025
18a39ff
more coverage for arrays and anon models
m-nash Jul 24, 2025
c15a081
add more coverage for arrays for unknown scenarios
m-nash Jul 25, 2025
2fa1817
refactor classes
m-nash Jul 25, 2025
93a6194
add the rest of jsonpointer and some test cases for it
m-nash Jul 25, 2025
33b1b23
switch to JsonPath and add more array cases
m-nash Jul 29, 2025
97076cd
Make advancing utf8jsonreader based on path generic for set, add, get…
m-nash Jul 29, 2025
ee1bd24
refactor for jsonpath and add first dictionary tests
m-nash Aug 1, 2025
5670a5c
various perf improvements
m-nash Aug 4, 2025
5d998d3
refactor and fix a test
m-nash Aug 4, 2025
be312c5
Add more test cases to hand dictionary and root array cases
m-nash Aug 4, 2025
af14401
Finish more of the common scenarios
m-nash Aug 4, 2025
a4411d5
update api
m-nash Aug 4, 2025
b2893b8
fix aot warnings
m-nash Aug 4, 2025
979f6ba
refactor / simplify jsonpathreader and add some unit tests
m-nash Aug 5, 2025
e7ae881
Add comparer that uses jsonreader tokens to normalize how to write th…
m-nash Aug 6, 2025
5df8dee
remove temp code
m-nash Aug 6, 2025
fc7bb71
target net9.0 to use some new features for perf
m-nash Aug 7, 2025
95ecad8
Propagate on set / get to improve performance
m-nash Aug 8, 2025
87657ae
update api
m-nash Aug 8, 2025
e1c0998
refactor alternate key usage
m-nash Aug 8, 2025
fa90f6f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
m-nash Aug 8, 2025
f3eb1b4
update api after merge
m-nash Aug 8, 2025
443ec57
Finish array insert tests and start on AP solo usage
m-nash Aug 8, 2025
c866f63
merge main
m-nash Aug 12, 2025
800ba0f
Make AP experimental
m-nash Aug 13, 2025
0fba353
update api
m-nash Aug 13, 2025
1703e92
Add more coverage for jsonpathreader handling of special characters i…
m-nash Aug 13, 2025
a333eeb
normalize jsonPaths
m-nash Aug 13, 2025
6ca8a26
optimize dictionary member lookup
m-nash Aug 14, 2025
e9f7cc2
rename to JsonPatch
m-nash Aug 18, 2025
858f485
Hide all members on EncodedValue
m-nash Aug 18, 2025
569e065
update property names
m-nash Aug 18, 2025
0fe0991
remove normalization loophole in byte[] path
m-nash Aug 19, 2025
acd11e6
normalize with dot in property name
m-nash Aug 19, 2025
6914095
Add Append and drop custom jsonPath for array insert
m-nash Aug 19, 2025
abdadab
update on json projection
m-nash Aug 20, 2025
fea1bdd
fix net8 tests
m-nash Aug 20, 2025
121a500
Add more coverage for single dim arrays
m-nash Aug 22, 2025
e36faa4
more append coverage
m-nash Aug 24, 2025
321de81
add more unit tests around jsonpathreaderextensions
m-nash Aug 25, 2025
b800057
Add test for out of order inserts
m-nash Aug 25, 2025
0eef89a
minor cleanup
m-nash Aug 25, 2025
7c91347
update api and experimental attribute
m-nash Aug 25, 2025
d56d513
add Get/Set/TryGet overloads
m-nash Aug 25, 2025
aac8e70
merge main
m-nash Aug 25, 2025
d0783c3
Add SCME to cspell
m-nash Aug 25, 2025
a40632b
expand tests for set and add append overloads / tests
m-nash Aug 27, 2025
d688a7b
clean up some extension methods
m-nash Aug 27, 2025
215739e
Add tests for remaining public / internal JsonPathReaderExtensions
m-nash Aug 28, 2025
c622e51
add serialize extension and rename Write methods
m-nash Aug 29, 2025
41c10e9
update tests to use serialize method
m-nash Aug 29, 2025
043189a
Add ability to write as application/json-patch+json
m-nash Aug 29, 2025
0e74e91
add tests with model usage for JsonPatch.ToString
m-nash Sep 5, 2025
c245af6
Drop serialize extension
m-nash Sep 5, 2025
4d7dcc4
rename ContainsChildOf to be an overload of Contains
m-nash Sep 5, 2025
9e39678
Drop write array to and use the writeto overload that takes a subpath
m-nash Sep 5, 2025
d3dd835
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
m-nash Sep 5, 2025
acc5aeb
regen api
m-nash Sep 5, 2025
bea0aec
minor clean up
m-nash Sep 5, 2025
8cbd4a6
refactor for readability
m-nash Sep 5, 2025
73f976d
refactor normalization in get array path
m-nash Sep 5, 2025
c1bc38a
remove magic numbers for utf8 format buffers
m-nash Sep 5, 2025
9cc9efa
update api
m-nash Sep 5, 2025
f95776d
pr feedback
m-nash Sep 8, 2025
bfef91b
pr feedback
m-nash Sep 8, 2025
d7c606b
Rename TryGetRawValue
m-nash Sep 9, 2025
f021032
Drop is flattened propagator
m-nash Sep 9, 2025
6afd4bf
pr feedback
m-nash Sep 9, 2025
75b9601
move helper to helper class
m-nash Sep 9, 2025
85ec5ba
refactor encoding and decoding
m-nash Sep 16, 2025
6653cfc
update to fix netstandard2.0 test cases
m-nash Sep 16, 2025
90ac585
update api
m-nash Sep 16, 2025
e507abe
remove extension methods
m-nash Sep 17, 2025
c751ec7
escape special characters in jsonpointer conversion
m-nash Sep 17, 2025
2fd41c7
cleanup unused
m-nash Sep 17, 2025
4421fb5
refactor append impl
m-nash Sep 17, 2025
4644ecd
fill in more tests for Remove
m-nash Sep 17, 2025
154dd07
remove unused append parsing
m-nash Sep 17, 2025
5b53716
add more coverage for edge cases
m-nash Sep 17, 2025
200d6cb
Add additional tests for Removing Json
m-nash Sep 18, 2025
290f255
Add more use cases for testing
m-nash Sep 18, 2025
19da4f2
Fill in rest of coverage for JsonPatch
m-nash Sep 18, 2025
89a1a16
Fill in JsonPathComparer coverage
m-nash Sep 18, 2025
ac47b61
fix a framework assert and add some additiona JsonPathExtensions cove…
m-nash Sep 19, 2025
abf3713
merge main
m-nash Sep 22, 2025
d4b9bf7
more coverage for Advance
m-nash Sep 22, 2025
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
1 change: 1 addition & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"referer",
"renormalize",
"retriable",
"SCME",
"Serp",
"Servfail",
"setsas",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace Azure.Core.Tests.ModelReaderWriterTests.Models
[PersistableModelProxy(typeof(UnknownBaseModel))]
public abstract class BaseModel : IUtf8JsonSerializable, IJsonModel<BaseModel>
Comment thread
m-nash marked this conversation as resolved.
{
private Dictionary<string, BinaryData> _rawData;
private Dictionary<string, BinaryData> _serializedAdditionalRawData;
Comment thread
m-nash marked this conversation as resolved.

protected internal BaseModel(Dictionary<string, BinaryData> rawData)
{
_rawData = rawData ?? new Dictionary<string, BinaryData>();
_serializedAdditionalRawData = rawData ?? new Dictionary<string, BinaryData>();
}

public string Kind { get; internal set; }
Expand All @@ -25,7 +25,7 @@ protected internal BaseModel(Dictionary<string, BinaryData> rawData)
protected internal void SerializeRawData(Utf8JsonWriter writer)
{
//write out the raw data
foreach (var property in _rawData)
foreach (var property in _serializedAdditionalRawData)
Comment thread
m-nash marked this conversation as resolved.
{
writer.WritePropertyName(property.Key);
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Azure.Core.Tests.ModelReaderWriterTests.Models
/// <summary> The InputAdditionalPropertiesModelStruct. </summary>
public readonly partial struct ModelAsStruct : IUtf8JsonSerializable, IJsonModel<ModelAsStruct>, IJsonModel<object>
{
private readonly Dictionary<string, BinaryData> _rawData;
private readonly Dictionary<string, BinaryData> _serializedAdditionalRawData;

/// <summary> Initializes a new instance of InputAdditionalPropertiesModelStruct. </summary>
/// <param name="id"></param>
Expand All @@ -24,7 +24,7 @@ namespace Azure.Core.Tests.ModelReaderWriterTests.Models
public ModelAsStruct(int id, Dictionary<string, BinaryData> rawData)
{
Id = id;
_rawData = rawData;
_serializedAdditionalRawData = rawData;
}

/// <summary> Gets the id. </summary>
Expand All @@ -41,9 +41,9 @@ private void Serialize(Utf8JsonWriter writer, ModelReaderWriterOptions options)
writer.WriteStartObject();
writer.WritePropertyName("id"u8);
writer.WriteNumberValue(Id);
if (_rawData is not null && options.Format == "J")
if (_serializedAdditionalRawData is not null && options.Format == "J")
{
foreach (var property in _rawData)
foreach (var property in _serializedAdditionalRawData)
{
writer.WritePropertyName(property.Key);
#if NET6_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ internal static Dictionary<string, BinaryData> GetRawData(object model)
{
modelType = modelType.BaseType;
}
var propertyInfo = modelType.GetField("_rawData", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var propertyInfo = modelType.GetField("_serializedAdditionalRawData", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
return propertyInfo.GetValue(model) as Dictionary<string, BinaryData>;
}

Expand Down
124 changes: 124 additions & 0 deletions sdk/core/System.ClientModel/api/System.ClientModel.net8.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,130 @@ public JsonModelConverter(System.ClientModel.Primitives.ModelReaderWriterOptions
public override System.ClientModel.Primitives.IJsonModel<object>? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { throw null; }
public override void Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.IJsonModel<object> value, System.Text.Json.JsonSerializerOptions options) { }
}
[System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0001")]
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct JsonPatch
{
private object _dummy;
private int _dummyPrimitive;
public JsonPatch(System.ReadOnlyMemory<byte> utf8Json) { throw null; }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.BinaryData utf8Json) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, bool value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, byte value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, byte[] utf8Json) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.DateTime value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.DateTimeOffset value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, decimal value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, double value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.Guid value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, short value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, int value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, long value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.ReadOnlySpan<byte> utf8Json) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, sbyte value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, float value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, string value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, System.TimeSpan value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, ushort value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, uint value) { }
public void Append(System.ReadOnlySpan<byte> arrayPath, ulong value) { }
public void AppendNull(System.ReadOnlySpan<byte> arrayPath) { }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Contains(System.ReadOnlySpan<byte> jsonPath) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool Contains(System.ReadOnlySpan<byte> prefix, System.ReadOnlySpan<byte> property) { throw null; }
public bool GetBoolean(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public byte GetByte(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public System.DateTime GetDateTime(System.ReadOnlySpan<byte> jsonPath, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public System.DateTimeOffset GetDateTimeOffset(System.ReadOnlySpan<byte> jsonPath, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public decimal GetDecimal(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public double GetDouble(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public float GetFloat(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public System.Guid GetGuid(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public short GetInt16(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public int GetInt32(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public long GetInt64(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public sbyte GetInt8(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public System.BinaryData GetJson(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public T? GetNullableValue<T>(System.ReadOnlySpan<byte> jsonPath) where T : struct { throw null; }
public string? GetString(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public System.TimeSpan GetTimeSpan(System.ReadOnlySpan<byte> jsonPath, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public ushort GetUInt16(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public uint GetUInt32(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public ulong GetUInt64(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public bool IsRemoved(System.ReadOnlySpan<byte> jsonPath) { throw null; }
public void Remove(System.ReadOnlySpan<byte> jsonPath) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.BinaryData utf8Json) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, bool value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, byte value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, byte[] utf8Json) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void Set(System.ReadOnlySpan<byte> jsonPath, System.ClientModel.Primitives.JsonPatch.EncodedValue value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.DateTime value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.DateTimeOffset value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, decimal value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, double value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.Guid value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, short value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, int value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, long value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.ReadOnlySpan<byte> utf8Json) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, sbyte value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, float value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, string value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, System.TimeSpan value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, ushort value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, uint value) { }
public void Set(System.ReadOnlySpan<byte> jsonPath, ulong value) { }
public void SetNull(System.ReadOnlySpan<byte> jsonPath) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void SetPropagators(System.ClientModel.Primitives.JsonPatch.PropagatorSetter setter, System.ClientModel.Primitives.JsonPatch.PropagatorGetter getter, System.ClientModel.Primitives.JsonPatch.PropagatorIsFlattened? isFlattened) { }
public override string ToString() { throw null; }
public string ToString(string format) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool TryGetEncodedValue(System.ReadOnlySpan<byte> jsonPath, out System.ClientModel.Primitives.JsonPatch.EncodedValue value) { throw null; }
public bool TryGetJson(System.ReadOnlySpan<byte> jsonPath, out System.ReadOnlyMemory<byte> value) { throw null; }
public bool TryGetNullableValue<T>(System.ReadOnlySpan<byte> jsonPath, out T? value) where T : struct { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out bool value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out byte value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out System.DateTime value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out System.DateTimeOffset value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out decimal value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out double value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out System.Guid value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out short value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out int value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out long value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out sbyte value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out float value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out string? value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out System.TimeSpan value, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out ushort value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out uint value) { throw null; }
public bool TryGetValue(System.ReadOnlySpan<byte> jsonPath, out ulong value) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void WriteTo(System.Text.Json.Utf8JsonWriter writer) { }
Comment thread
m-nash marked this conversation as resolved.
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, System.ReadOnlySpan<byte> jsonPath) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct EncodedValue
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public delegate bool PropagatorGetter(System.ReadOnlySpan<byte> jsonPath, out System.ClientModel.Primitives.JsonPatch.EncodedValue value);
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public delegate bool PropagatorIsFlattened(System.ReadOnlySpan<byte> jsonPath);
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public delegate bool PropagatorSetter(System.ReadOnlySpan<byte> jsonPath, System.ClientModel.Primitives.JsonPatch.EncodedValue value);
}
[System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0001")]
public static partial class JsonPatchExtensions
{
public static void Append<T>(this ref System.ClientModel.Primitives.JsonPatch jsonPatch, System.ReadOnlySpan<byte> jsonPath, T value) where T : System.ClientModel.Primitives.IJsonModel<T> { }
public static void Set<T>(this ref System.ClientModel.Primitives.JsonPatch jsonPatch, System.ReadOnlySpan<byte> jsonPath, T value) where T : System.ClientModel.Primitives.IJsonModel<T> { }
}
public partial class MessageLoggingPolicy : System.ClientModel.Primitives.PipelinePolicy
{
public MessageLoggingPolicy(System.ClientModel.Primitives.ClientLoggingOptions? options = null) { }
Expand Down
Loading
Loading