Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema Registry] Generating from TypeSpec for JSON GA #44881

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected SchemaRegistryClient() { }
public SchemaRegistryClient(string fullyQualifiedNamespace, Azure.Core.TokenCredential credential) { }
public SchemaRegistryClient(string fullyQualifiedNamespace, Azure.Core.TokenCredential credential, Azure.Data.SchemaRegistry.SchemaRegistryClientOptions options) { }
public string FullyQualifiedNamespace { get { throw null; } }
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
m-redding marked this conversation as resolved.
Show resolved Hide resolved
public virtual Azure.Response<Azure.Data.SchemaRegistry.SchemaRegistrySchema> GetSchema(string groupName, string schemaName, int schemaVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Data.SchemaRegistry.SchemaRegistrySchema> GetSchema(string schemaId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Data.SchemaRegistry.SchemaRegistrySchema>> GetSchemaAsync(string groupName, string schemaName, int schemaVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand All @@ -45,12 +46,12 @@ public SchemaRegistryClient(string fullyQualifiedNamespace, Azure.Core.TokenCred
}
public partial class SchemaRegistryClientOptions : Azure.Core.ClientOptions
{
public SchemaRegistryClientOptions(Azure.Data.SchemaRegistry.SchemaRegistryClientOptions.ServiceVersion version = Azure.Data.SchemaRegistry.SchemaRegistryClientOptions.ServiceVersion.V2023_07) { }
public SchemaRegistryClientOptions(Azure.Data.SchemaRegistry.SchemaRegistryClientOptions.ServiceVersion version = Azure.Data.SchemaRegistry.SchemaRegistryClientOptions.ServiceVersion.V2023_07_01) { }
public enum ServiceVersion
{
V2021_10 = 1,
V2022_10 = 2,
V2023_07 = 3,
V2023_07_01 = 3,
m-redding marked this conversation as resolved.
Show resolved Hide resolved
}
}
public static partial class SchemaRegistryModelFactory
Expand Down
2 changes: 1 addition & 1 deletion sdk/schemaregistry/Azure.Data.SchemaRegistry/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/schemaregistry/Azure.Data.SchemaRegistry",
"Tag": "net/schemaregistry/Azure.Data.SchemaRegistry_e2ef99a396"
"Tag": "net/schemaregistry/Azure.Data.SchemaRegistry_4b3f12dd0e"
}
24 changes: 19 additions & 5 deletions sdk/schemaregistry/Azure.Data.SchemaRegistry/src/ContentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,46 @@

using System;
using System.ComponentModel;
using Azure.Core;

namespace Azure.Data.SchemaRegistry
{
/// <summary> The SerializationType. </summary>
[CodeGenModel("ContentType")]
internal readonly partial struct ContentType : IEquatable<ContentType>
{
private const string AvroValue = "application/json; serialization=Avro";
private const string JsonValue = "application/json; serialization=json";
private const string CustomValue = "text/plain; charset=utf-8";
private const string ProtobufValue = "text/vnd.ms.protobuf";

private readonly string _value;

/// <summary> Initializes a new instance of <see cref="ContentType"/>. </summary>
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
public ContentType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}

/// <summary> application/json; serialization=Avro. </summary>
[CodeGenMember("ApplicationJsonSerializationAvro")]
public static ContentType Avro { get; } = new ContentType(AvroValue);

/// <summary> application/json; serialization=json. </summary>
[CodeGenMember("ApplicationJsonSerializationJson")]
public static ContentType Json { get; } = new ContentType(JsonValue);

/// <summary> text/plain; charset=utf-8. </summary>
[CodeGenMember("TextPlainCharsetUtf8")]
public static ContentType Custom { get; } = new ContentType(CustomValue);

///// <summary> text/vnd.ms.protobuf. </summary>
//[CodeGenMember("TextVndMsProtobuf")]
//public static ContentType Protobuf { get; } = new ContentType(ProtobufValue);

/// <summary> Determines if two <see cref="ContentType"/> values are the same. </summary>
public static bool operator ==(ContentType left, ContentType right) => left.Equals(right);
/// <summary> Determines if two <see cref="ContentType"/> values are not the same. </summary>
public static bool operator !=(ContentType left, ContentType right) => !left.Equals(right);
/// <summary> Converts a string to a <see cref="ContentType"/>. </summary>
public static implicit operator ContentType(string value) => new ContentType(value);

/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is ContentType other && Equals(other);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;

namespace Azure.Data.SchemaRegistry
{
[CodeGenClient("DataSchemaRegistryClientBuilderExtensions")]
internal static partial class DataSchemaRegistryClientBuilderExtensions
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading