Skip to content

Commit 020c18e

Browse files
CopilotAniruddh25
andcommitted
Fix: Only write enabled property when UserProvidedEnabled is true
Co-authored-by: Aniruddh25 <3513779+Aniruddh25@users.noreply.github.com>
1 parent bd20e75 commit 020c18e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Config/Converters/DatasourceHealthOptionsConvertorFactory.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ public override void Write(Utf8JsonWriter writer, DatasourceHealthCheckConfig va
121121
if (value?.UserProvidedEnabled is true || value?.Name is not null || value?.UserProvidedThresholdMs is true)
122122
{
123123
writer.WriteStartObject();
124-
writer.WritePropertyName("enabled");
125-
JsonSerializer.Serialize(writer, value.Enabled, options);
124+
125+
// Only write enabled if it was explicitly provided by the user
126+
if (value?.UserProvidedEnabled is true)
127+
{
128+
writer.WritePropertyName("enabled");
129+
JsonSerializer.Serialize(writer, value.Enabled, options);
130+
}
131+
126132
if (value?.Name is not null)
127133
{
128134
writer.WritePropertyName("name");

0 commit comments

Comments
 (0)