void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(EnvironmentId)) { if (EnvironmentId != null) { writer.WritePropertyName("environmentId"); writer.WriteStringValue(EnvironmentId); } else { writer.WriteNull("environmentId"); } } if (Optional.IsCollectionDefined(EnvironmentVariables)) { if (EnvironmentVariables != null) { writer.WritePropertyName("environmentVariables"); writer.WriteStartObject(); foreach (var item in EnvironmentVariables) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("environmentVariables"); } } if (Optional.IsCollectionDefined(Outputs)) { if (Outputs != null) { writer.WritePropertyName("outputs"); writer.WriteStartObject(); foreach (var item in Outputs) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("outputs"); } } if (Optional.IsDefined(Resources)) { if (Resources != null) { writer.WritePropertyName("resources"); writer.WriteObjectValue(Resources); } else { writer.WriteNull("resources"); } } writer.WritePropertyName("taskDetails"); writer.WriteObjectValue(TaskDetails); if (Optional.IsDefined(ComputeId)) { if (ComputeId != null) { writer.WritePropertyName("computeId"); writer.WriteStringValue(ComputeId); } else { writer.WriteNull("computeId"); } } if (Optional.IsDefined(DisplayName)) { if (DisplayName != null) { writer.WritePropertyName("displayName"); writer.WriteStringValue(DisplayName); } else { writer.WriteNull("displayName"); } } if (Optional.IsDefined(ExperimentName)) { if (ExperimentName != null) { writer.WritePropertyName("experimentName"); writer.WriteStringValue(ExperimentName); } else { writer.WriteNull("experimentName"); } } if (Optional.IsDefined(Identity)) { if (Identity != null) { writer.WritePropertyName("identity"); writer.WriteObjectValue(Identity); } else { writer.WriteNull("identity"); } } if (Optional.IsDefined(IsArchived)) { writer.WritePropertyName("isArchived"); writer.WriteBooleanValue(IsArchived.Value); } writer.WritePropertyName("jobType"); writer.WriteStringValue(JobType.ToString()); if (Optional.IsDefined(Schedule)) { if (Schedule != null) { writer.WritePropertyName("schedule"); writer.WriteObjectValue(Schedule); } else { writer.WriteNull("schedule"); } } if (Optional.IsCollectionDefined(Services)) { if (Services != null) { writer.WritePropertyName("services"); writer.WriteStartObject(); foreach (var item in Services) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("services"); } } if (Optional.IsDefined(Description)) { if (Description != null) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } else { writer.WriteNull("description"); } } if (Optional.IsCollectionDefined(Properties)) { if (Properties != null) { writer.WritePropertyName("properties"); writer.WriteStartObject(); foreach (var item in Properties) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("properties"); } } if (Optional.IsCollectionDefined(Tags)) { if (Tags != null) { writer.WritePropertyName("tags"); writer.WriteStartObject(); foreach (var item in Tags) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("tags"); } } writer.WriteEndObject(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(EarlyTermination)) { if (EarlyTermination != null) { writer.WritePropertyName("earlyTermination"); writer.WriteObjectValue(EarlyTermination); } else { writer.WriteNull("earlyTermination"); } } if (Optional.IsCollectionDefined(Inputs)) { if (Inputs != null) { writer.WritePropertyName("inputs"); writer.WriteStartObject(); foreach (var item in Inputs) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("inputs"); } } if (Optional.IsDefined(Limits)) { if (Limits != null) { writer.WritePropertyName("limits"); writer.WriteObjectValue(Limits); } else { writer.WriteNull("limits"); } } writer.WritePropertyName("objective"); writer.WriteObjectValue(Objective); if (Optional.IsCollectionDefined(Outputs)) { if (Outputs != null) { writer.WritePropertyName("outputs"); writer.WriteStartObject(); foreach (var item in Outputs) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("outputs"); } } writer.WritePropertyName("samplingAlgorithm"); writer.WriteObjectValue(SamplingAlgorithm); writer.WritePropertyName("searchSpace"); #if NET6_0_OR_GREATER writer.WriteRawValue(SearchSpace); #else JsonSerializer.Serialize(writer, JsonDocument.Parse(SearchSpace.ToString()).RootElement); #endif writer.WritePropertyName("trial"); writer.WriteObjectValue(Trial); if (Optional.IsDefined(ComputeId)) { if (ComputeId != null) { writer.WritePropertyName("computeId"); writer.WriteStringValue(ComputeId); } else { writer.WriteNull("computeId"); } } if (Optional.IsDefined(DisplayName)) { if (DisplayName != null) { writer.WritePropertyName("displayName"); writer.WriteStringValue(DisplayName); } else { writer.WriteNull("displayName"); } } if (Optional.IsDefined(ExperimentName)) { if (ExperimentName != null) { writer.WritePropertyName("experimentName"); writer.WriteStringValue(ExperimentName); } else { writer.WriteNull("experimentName"); } } if (Optional.IsDefined(Identity)) { if (Identity != null) { writer.WritePropertyName("identity"); writer.WriteObjectValue(Identity); } else { writer.WriteNull("identity"); } } if (Optional.IsDefined(IsArchived)) { writer.WritePropertyName("isArchived"); writer.WriteBooleanValue(IsArchived.Value); } writer.WritePropertyName("jobType"); writer.WriteStringValue(JobType.ToString()); if (Optional.IsDefined(Schedule)) { if (Schedule != null) { writer.WritePropertyName("schedule"); writer.WriteObjectValue(Schedule); } else { writer.WriteNull("schedule"); } } if (Optional.IsCollectionDefined(Services)) { if (Services != null) { writer.WritePropertyName("services"); writer.WriteStartObject(); foreach (var item in Services) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("services"); } } if (Optional.IsDefined(Description)) { if (Description != null) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } else { writer.WriteNull("description"); } } if (Optional.IsCollectionDefined(Properties)) { if (Properties != null) { writer.WritePropertyName("properties"); writer.WriteStartObject(); foreach (var item in Properties) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("properties"); } } if (Optional.IsCollectionDefined(Tags)) { if (Tags != null) { writer.WritePropertyName("tags"); writer.WriteStartObject(); foreach (var item in Tags) { writer.WritePropertyName(item.Key); writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } else { writer.WriteNull("tags"); } } writer.WriteEndObject(); }