Skip to content

Commit

Permalink
Default to enable use-write-core for mgmt (#5126)
Browse files Browse the repository at this point in the history
  • Loading branch information
live1206 authored Oct 25, 2024
1 parent a355195 commit dc071e0
Show file tree
Hide file tree
Showing 269 changed files with 2,163 additions and 2,615 deletions.

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ internal partial class AdditionalCapabilities : IUtf8JsonSerializable, IJsonMode
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel<AdditionalCapabilities>)this).Write(writer, ModelSerializationExtensions.WireOptions);

void IJsonModel<AdditionalCapabilities>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
writer.WriteEndObject();
}

/// <param name="writer"> The JSON writer. </param>
/// <param name="options"> The client options for reading and writing models. </param>
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<AdditionalCapabilities>)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(AdditionalCapabilities)} does not support writing '{format}' format.");
}

writer.WriteStartObject();
if (Optional.IsDefined(UltraSSDEnabled))
{
writer.WritePropertyName("ultraSSDEnabled"u8);
Expand All @@ -48,7 +56,6 @@ void IJsonModel<AdditionalCapabilities>.Write(Utf8JsonWriter writer, ModelReader
#endif
}
}
writer.WriteEndObject();
}

AdditionalCapabilities IJsonModel<AdditionalCapabilities>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
Expand Down
Loading

0 comments on commit dc071e0

Please sign in to comment.