Skip to content

Regen index setting blocks based on fixed spec #7718

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

Merged
merged 1 commit into from
May 12, 2023
Merged
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 @@ -33,13 +33,17 @@ public sealed partial class IndexSettingBlocks
[JsonConverter(typeof(StringifiedBoolConverter))]
public bool? Metadata { get; set; }
[JsonInclude, JsonPropertyName("read")]
[JsonConverter(typeof(StringifiedBoolConverter))]
public bool? Read { get; set; }
[JsonInclude, JsonPropertyName("read_only")]
[JsonConverter(typeof(StringifiedBoolConverter))]
public bool? ReadOnly { get; set; }
[JsonInclude, JsonPropertyName("read_only_allow_delete")]
[JsonConverter(typeof(StringifiedBoolConverter))]
public bool? ReadOnlyAllowDelete { get; set; }
[JsonInclude, JsonPropertyName("write")]
public Union<bool?, string?>? Write { get; set; }
[JsonConverter(typeof(StringifiedBoolConverter))]
public bool? Write { get; set; }
}

public sealed partial class IndexSettingBlocksDescriptor : SerializableDescriptor<IndexSettingBlocksDescriptor>
Expand All @@ -54,7 +58,7 @@ public IndexSettingBlocksDescriptor() : base()
private bool? ReadValue { get; set; }
private bool? ReadOnlyValue { get; set; }
private bool? ReadOnlyAllowDeleteValue { get; set; }
private Union<bool?, string?>? WriteValue { get; set; }
private bool? WriteValue { get; set; }

public IndexSettingBlocksDescriptor Metadata(bool? metadata = true)
{
Expand All @@ -80,7 +84,7 @@ public IndexSettingBlocksDescriptor ReadOnlyAllowDelete(bool? readOnlyAllowDelet
return Self;
}

public IndexSettingBlocksDescriptor Write(Union<bool?, string?>? write)
public IndexSettingBlocksDescriptor Write(bool? write = true)
{
WriteValue = write;
return Self;
Expand All @@ -95,22 +99,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
JsonSerializer.Serialize(writer, MetadataValue, options);
}

if (ReadValue.HasValue)
if (ReadValue is not null)
{
writer.WritePropertyName("read");
writer.WriteBooleanValue(ReadValue.Value);
JsonSerializer.Serialize(writer, ReadValue, options);
}

if (ReadOnlyValue.HasValue)
if (ReadOnlyValue is not null)
{
writer.WritePropertyName("read_only");
writer.WriteBooleanValue(ReadOnlyValue.Value);
JsonSerializer.Serialize(writer, ReadOnlyValue, options);
}

if (ReadOnlyAllowDeleteValue.HasValue)
if (ReadOnlyAllowDeleteValue is not null)
{
writer.WritePropertyName("read_only_allow_delete");
writer.WriteBooleanValue(ReadOnlyAllowDeleteValue.Value);
JsonSerializer.Serialize(writer, ReadOnlyAllowDeleteValue, options);
}

if (WriteValue is not null)
Expand Down