Пример #1
0
            private static string GenerateSampleString(CaseInsensitiveDictionary <SchemaObject> schemaDictionary, CaseInsensitiveDictionary <SchemaObject> properties)
            {
                var stringBuilder = new StringBuilder();

                stringBuilder.Append("{");

                foreach (var item in properties.Select((property, index) => new { property, index }))
                {
                    var index = item.index;
                    var(propertyKey, propertySchemaObject) = item.property;

                    var exampleString = index == properties.Count - 1
                        ? $"{GetExample(schemaDictionary, propertySchemaObject)}"
                        : $"{GetExample(schemaDictionary, propertySchemaObject)}, ";

                    stringBuilder.Append($"\"{propertyKey}\": {exampleString}");
                }

                stringBuilder.Append("}");

                return(stringBuilder.ToString());
            }