Skip to content

Commit

Permalink
JsonData Updates: Add WriteTo(), ==operators, and PR FB (#33038)
Browse files Browse the repository at this point in the history
* Add WriteTo(), ==operators, and PR FB

* export API

* pr fb
  • Loading branch information
annelo-msft authored Dec 14, 2022
1 parent e786c1b commit 210570d
Show file tree
Hide file tree
Showing 9 changed files with 419 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,30 @@ public static partial class BinaryDataExtensions
{
public static dynamic ToDynamic(this System.BinaryData data) { throw null; }
}
public abstract partial class DynamicData
{
protected DynamicData() { }
internal abstract void WriteTo(System.Text.Json.Utf8JsonWriter writer);
public static void WriteTo(System.Text.Json.Utf8JsonWriter writer, Azure.Core.Dynamic.DynamicData data) { }
}
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")]
public partial class JsonData : System.Dynamic.IDynamicMetaObjectProvider, System.IEquatable<Azure.Core.Dynamic.JsonData>
public partial class JsonData : Azure.Core.Dynamic.DynamicData, System.Dynamic.IDynamicMetaObjectProvider, System.IEquatable<Azure.Core.Dynamic.JsonData>
{
internal JsonData() { }
public bool Equals(Azure.Core.Dynamic.JsonData other) { throw null; }
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, bool right) { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, double right) { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, int right) { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, long right) { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, float right) { throw null; }
public static bool operator ==(Azure.Core.Dynamic.JsonData? left, string? right) { throw null; }
public static bool operator ==(bool left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator ==(double left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator ==(int left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator ==(long left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator ==(float left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator ==(string? left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static implicit operator bool (Azure.Core.Dynamic.JsonData json) { throw null; }
public static implicit operator double (Azure.Core.Dynamic.JsonData json) { throw null; }
Expand All @@ -134,9 +148,17 @@ internal JsonData() { }
public static implicit operator float? (Azure.Core.Dynamic.JsonData json) { throw null; }
public static implicit operator float (Azure.Core.Dynamic.JsonData json) { throw null; }
public static implicit operator string (Azure.Core.Dynamic.JsonData json) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, bool right) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, double right) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, int right) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, long right) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, float right) { throw null; }
public static bool operator !=(Azure.Core.Dynamic.JsonData? left, string? right) { throw null; }
public static bool operator !=(bool left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator !=(double left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator !=(int left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator !=(long left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator !=(float left, Azure.Core.Dynamic.JsonData? right) { throw null; }
public static bool operator !=(string? left, Azure.Core.Dynamic.JsonData? right) { throw null; }
System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; }
public override string ToString() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Azure.Core.Dynamic
public static class BinaryDataExtensions
{
/// <summary>
/// Return the content of the BinaryData as a dynamic type.
/// </summary>
public static dynamic ToDynamic(this BinaryData data)
{
Expand Down
28 changes: 28 additions & 0 deletions sdk/core/Azure.Core.Experimental/src/DynamicData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json;

namespace Azure.Core.Dynamic
{
/// <summary>
/// A dynamic abstraction over content data. Deriving types are implemented
/// for a specific format, such as JSON or XML.
///
/// This and related types are not intended to be mocked.
/// </summary>
public abstract class DynamicData
{
/// <summary>
/// Writes the data to the provided writer as a JSON value.
/// </summary>
/// <param name="writer">The writer to which to write the document.</param>
/// <param name="data">The dynamic data value to write.</param>
public static void WriteTo(Utf8JsonWriter writer, DynamicData data)
{
data.WriteTo(writer);
}

internal abstract void WriteTo(Utf8JsonWriter writer);
}
}
Loading

0 comments on commit 210570d

Please sign in to comment.