| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 12 | | { |
| | 13 | | public partial class ParameterSpecification : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("type"); |
| 0 | 19 | | writer.WriteStringValue(Type.ToString()); |
| 0 | 20 | | if (Optional.IsDefined(DefaultValue)) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("defaultValue"); |
| 0 | 23 | | writer.WriteObjectValue(DefaultValue); |
| | 24 | | } |
| 0 | 25 | | writer.WriteEndObject(); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | internal static ParameterSpecification DeserializeParameterSpecification(JsonElement element) |
| | 29 | | { |
| 0 | 30 | | ParameterType type = default; |
| 0 | 31 | | Optional<object> defaultValue = default; |
| 0 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 0 | 34 | | if (property.NameEquals("type")) |
| | 35 | | { |
| 0 | 36 | | type = new ParameterType(property.Value.GetString()); |
| 0 | 37 | | continue; |
| | 38 | | } |
| 0 | 39 | | if (property.NameEquals("defaultValue")) |
| | 40 | | { |
| 0 | 41 | | defaultValue = property.Value.GetObject(); |
| | 42 | | continue; |
| | 43 | | } |
| | 44 | | } |
| 0 | 45 | | return new ParameterSpecification(type, defaultValue.Value); |
| | 46 | | } |
| | 47 | | } |
| | 48 | | } |