コード例 #1
0
        private static void WritePropertyInternal <T>(this IOpenApiWriter writer, string name, T element)
        {
            CheckArgument(writer, name);

            writer.WritePropertyName(name);
            writer.WriteValueInternal(element);
        }
コード例 #2
0
        private static void WriteCollectionInternal <T>(this IOpenApiWriter writer, string name, IEnumerable <T> elements)
        {
            CheckArgument(writer, name);

            writer.WritePropertyName(name);

            writer.WriteStartArray();

            if (elements != null)
            {
                foreach (T e in elements)
                {
                    writer.WriteValueInternal(e);
                }
            }

            writer.WriteEndArray();
        }
コード例 #3
0
        private static void WriteDictionaryInternal <T>(this IOpenApiWriter writer, string name, IDictionary <string, T> elements)
        {
            CheckArgument(writer, name);

            writer.WritePropertyName(name);

            writer.WriteStartObject();

            if (elements != null)
            {
                foreach (KeyValuePair <string, T> e in elements)
                {
                    writer.WritePropertyName(e.Key);
                    writer.WriteValueInternal(e.Value);
                }
            }

            writer.WriteEndObject();
        }