private static void ExtractEnum(List <EnumInfo> enums, SwaggerProperty prop) { var enumType = (from e in enums where e.EnumDataType == prop.EnumDataType select e).FirstOrDefault(); if (enumType == null) { enumType = new EnumInfo() { EnumDataType = prop.EnumDataType, Items = new List <EnumItem>() }; enums.Add(enumType); } // Add values if they are known if (prop.enumValues != null) { foreach (var s in prop.enumValues) { if (!enumType.Items.Any(i => i.Value == s)) { enumType.Items.Add(new EnumItem() { Value = s }); } } } }
private static bool ApplySchema(OpenApiSchema schema, string property, SwaggerProperty attr) { if (!schema.Properties.ContainsKey(property)) { return(false); } var val = schema.Properties[property]; val.Description = attr.Description; schema.Required.Add(property); return(true); }