コード例 #1
0
        public static void WriteSingleProperty(this IOpenApiWriter writer, string name, string value, bool optional = true)
        {
            if (value == null && !optional)
            {
                return;
            }

            writer.WritePropertyInternal(name, value);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        public static void WriteOptionalProperty <T>(this IOpenApiWriter writer, string name, T?value)
            where T : struct
        {
            if (value == null)
            {
                return;
            }

            writer.WritePropertyInternal(name, value.Value);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
 public static void WriteRequiredProperty <T>(this IOpenApiWriter writer, string name, T?value)
     where T : struct
 {
     writer.WritePropertyInternal(name, value);
 }
コード例 #7
0
 public static void WriteRequiredProperty(this IOpenApiWriter writer, string name, string value)
 {
     writer.WritePropertyInternal(name, value);
 }