Skip to content

Commit

Permalink
Move DynamicData to Experimental for release (#36145)
Browse files Browse the repository at this point in the history
* Move DynamicData to Experimental for release

* docs

* Changelog

* fix

* fix

* fix
  • Loading branch information
annelo-msft authored May 9, 2023
1 parent 34ce681 commit 1da99c3
Show file tree
Hide file tree
Showing 48 changed files with 402 additions and 710 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<ProjectReference Include="..\..\..\core\Azure.Core\src\Azure.Core.csproj" />
<ProjectReference Include="..\..\..\core\Azure.Core.Experimental\src\Azure.Core.Experimental.csproj" />
<ProjectReference Include="..\src\Azure.AI.Language.Conversations.csproj" />
</ItemGroup>

Expand Down
14 changes: 10 additions & 4 deletions sdk/core/Azure.Core.Experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# Release History

## 0.1.0-preview.27 (Unreleased)
## 0.1.0-preview.27 (2023-05-09)

### Features Added

- Added support for `== null` and value equality for primitives to `DynamicData`.
- Added support for `Length` property on `DynamicData` arrays.
- Made name mappings from PascalCase in C# to camelCase in JSON the default for `DynamicData`.
- Added implicit casts to all primitives supported by `JsonElement` and explicit casts for supported reference types.

### Breaking Changes

### Bugs Fixed

### Other Changes
- Made `MutableJsonDocument` and `MutableJsonElement` internal.
- Removed `DynamicDataOptions`, `DynamicDataNameMapping` and the `BinaryData` extensions that took parameters of those types.
- Removed `DynamicDataProperty`.

## 0.1.0-preview.26 (2023-04-10)

### Features Added

- Added basic debugger support for DynamicData

### Breaking Changes

- Removed `DynamicJson` type, and moved its functionality into `DynamicData`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace Azure
{
public static partial class BinaryDataExtensions
{
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct Value
{
Expand Down Expand Up @@ -106,3 +110,36 @@ public readonly partial struct Value
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool TryGetValue<T>(out T value) { throw null; }
}
}
namespace Azure.Core.Dynamic
{
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")]
public sealed partial class DynamicData : System.Dynamic.IDynamicMetaObjectProvider, System.IDisposable
{
internal DynamicData() { }
public void Dispose() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
public static explicit operator System.DateTime (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.DateTimeOffset (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.Guid (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator bool (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator byte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator decimal (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator double (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator short (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator int (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator long (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator sbyte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator float (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator string (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ushort (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator uint (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ulong (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; }
public override string ToString() { throw null; }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace Azure
{
public static partial class BinaryDataExtensions
{
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct Value
{
Expand Down Expand Up @@ -106,3 +110,36 @@ public readonly partial struct Value
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool TryGetValue<T>(out T value) { throw null; }
}
}
namespace Azure.Core.Dynamic
{
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")]
public sealed partial class DynamicData : System.Dynamic.IDynamicMetaObjectProvider, System.IDisposable
{
internal DynamicData() { }
public void Dispose() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
public static explicit operator System.DateTime (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.DateTimeOffset (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.Guid (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator bool (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator byte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator decimal (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator double (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator short (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator int (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator long (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator sbyte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator float (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator string (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ushort (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator uint (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ulong (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; }
public override string ToString() { throw null; }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace Azure
{
public static partial class BinaryDataExtensions
{
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct Value
{
Expand Down Expand Up @@ -106,3 +110,36 @@ public readonly partial struct Value
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool TryGetValue<T>(out T value) { throw null; }
}
}
namespace Azure.Core.Dynamic
{
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")]
public sealed partial class DynamicData : System.Dynamic.IDynamicMetaObjectProvider, System.IDisposable
{
internal DynamicData() { }
public void Dispose() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
public static explicit operator System.DateTime (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.DateTimeOffset (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.Guid (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator bool (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator byte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator decimal (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator double (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator short (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator int (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator long (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator sbyte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator float (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator string (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ushort (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator uint (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ulong (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; }
public override string ToString() { throw null; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core.Json;
using Azure.Core.Dynamic;

namespace Azure
{
/// <summary>
/// </summary>
public static class BinaryDataExtensions
{
/// <summary>
/// Return the content of the BinaryData as a dynamic type.
/// </summary>
public static dynamic ToDynamicFromJson(this BinaryData utf8Json)
{
MutableJsonDocument mdoc = MutableJsonDocument.Parse(utf8Json, DynamicData.DefaultSerializerOptions);
return new DynamicData(mdoc.RootElement);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public void CanAddPocoProperty()
Assert.IsTrue(value.Model.Number == 2);
Assert.IsTrue(value.model.number == 2);

RequestContent content = RequestContent.Create(value);
RequestContent content = RequestContent.Create((object)value);
Stream stream = new MemoryStream();
content.WriteTo(stream, default);
stream.Flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Azure.Core\src\Azure.Core.csproj" />
<ProjectReference Include="..\..\src\Azure.Core.Experimental.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<ProjectReference Include="..\..\src\Azure.Core.csproj" />
<ProjectReference Include="..\..\src\Azure.Core.Experimental.csproj" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
10 changes: 5 additions & 5 deletions sdk/core/Azure.Core/Azure.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Expressions.Data
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Expressions.DataFactory.Tests", "..\Azure.Core.Expressions.DataFactory\tests\Azure.Core.Expressions.DataFactory.Tests.csproj", "{E1E88CD0-609C-4B8C-B723-DB004B90E235}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Tests.Public", "tests\public\Azure.Core.Tests.Public.csproj", "{132374AD-FF07-40B0-887E-A73D45C91537}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Experimental.Tests.Public", "..\Azure.Core.Experimental\tests\public\Azure.Core.Experimental.Tests.Public.csproj", "{00955D8A-B387-474B-9FA9-449A1013990F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -127,10 +127,10 @@ Global
{E1E88CD0-609C-4B8C-B723-DB004B90E235}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1E88CD0-609C-4B8C-B723-DB004B90E235}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1E88CD0-609C-4B8C-B723-DB004B90E235}.Release|Any CPU.Build.0 = Release|Any CPU
{132374AD-FF07-40B0-887E-A73D45C91537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{132374AD-FF07-40B0-887E-A73D45C91537}.Debug|Any CPU.Build.0 = Debug|Any CPU
{132374AD-FF07-40B0-887E-A73D45C91537}.Release|Any CPU.ActiveCfg = Release|Any CPU
{132374AD-FF07-40B0-887E-A73D45C91537}.Release|Any CPU.Build.0 = Release|Any CPU
{00955D8A-B387-474B-9FA9-449A1013990F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00955D8A-B387-474B-9FA9-449A1013990F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00955D8A-B387-474B-9FA9-449A1013990F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00955D8A-B387-474B-9FA9-449A1013990F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
36 changes: 0 additions & 36 deletions sdk/core/Azure.Core/api/Azure.Core.net461.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) {
}
public static partial class AzureCoreExtensions
{
public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
public static System.Threading.Tasks.ValueTask<T?> ToObjectAsync<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static object? ToObjectFromJson(this System.BinaryData data) { throw null; }
public static T? ToObject<T>(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -536,7 +535,6 @@ protected internal virtual void SetHeader(string name, string value) { }
public abstract partial class RequestContent : System.IDisposable
{
protected RequestContent() { }
public static Azure.Core.RequestContent Create(Azure.Core.Dynamic.DynamicData content) { throw null; }
public static Azure.Core.RequestContent Create(System.BinaryData content) { throw null; }
public static Azure.Core.RequestContent Create(System.Buffers.ReadOnlySequence<byte> bytes) { throw null; }
public static Azure.Core.RequestContent Create(byte[] bytes) { throw null; }
Expand All @@ -546,7 +544,6 @@ protected RequestContent() { }
public static Azure.Core.RequestContent Create(System.ReadOnlyMemory<byte> bytes) { throw null; }
public static Azure.Core.RequestContent Create(string content) { throw null; }
public abstract void Dispose();
public static implicit operator Azure.Core.RequestContent (Azure.Core.Dynamic.DynamicData content) { throw null; }
public static implicit operator Azure.Core.RequestContent (System.BinaryData content) { throw null; }
public static implicit operator Azure.Core.RequestContent (string content) { throw null; }
public abstract bool TryComputeLength(out long length);
Expand Down Expand Up @@ -776,39 +773,6 @@ protected sealed override void OnEventSourceCreated(System.Diagnostics.Tracing.E
protected sealed override void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { }
}
}
namespace Azure.Core.Dynamic
{
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")]
public sealed partial class DynamicData : System.Dynamic.IDynamicMetaObjectProvider, System.IDisposable
{
internal DynamicData() { }
public void Dispose() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
public static explicit operator System.DateTime (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.DateTimeOffset (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static explicit operator System.Guid (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator bool (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator byte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator decimal (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator double (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator short (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator int (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator long (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator sbyte (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator float (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator string (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ushort (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator uint (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static implicit operator ulong (Azure.Core.Dynamic.DynamicData value) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.DynamicData? left, object? right) { throw null; }
System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; }
public override string ToString() { throw null; }
}
}
namespace Azure.Core.Extensions
{
public partial interface IAzureClientBuilder<TClient, TOptions> where TOptions : class
Expand Down
Loading

0 comments on commit 1da99c3

Please sign in to comment.