public static void WriteSingleProperty(this IOpenApiWriter writer, string name, string value, bool optional = true) { if (value == null && !optional) { return; } writer.WritePropertyInternal(name, value); }
/// <summary> /// Write the single of Open API element if the element is not null, otherwise skip it. /// </summary> /// <param name="writer">The Open API writer.</param> /// <param name="name">The property name.</param> /// <param name="element">The Open API element.</param> public static void WriteOptionalObject(this IOpenApiWriter writer, string name, IOpenApiWritable element) { if (element == null) { return; } writer.WritePropertyInternal(name, element); }
public static void WriteOptionalProperty <T>(this IOpenApiWriter writer, string name, T?value) where T : struct { if (value == null) { return; } writer.WritePropertyInternal(name, value.Value); }
public static void WriteSingleProperty <T>(this IOpenApiWriter writer, string name, T value, T defaultValue = default(T), bool optional = true) { if (value.Equals(defaultValue)) { if (!optional) { return; } } writer.WritePropertyInternal(name, value); }
/// <summary> /// Write the single of Open API element. /// </summary> /// <param name="writer">The Open API writer.</param> /// <param name="name">The property name.</param> /// <param name="value">The Open API element.</param> public static void WriteRequiredObject(this IOpenApiWriter writer, string name, IOpenApiWritable value) { writer.WritePropertyInternal(name, value); }
public static void WriteRequiredProperty <T>(this IOpenApiWriter writer, string name, T?value) where T : struct { writer.WritePropertyInternal(name, value); }
public static void WriteRequiredProperty(this IOpenApiWriter writer, string name, string value) { writer.WritePropertyInternal(name, value); }