diff --git a/Craftsman/Builders/Dtos/DtoFileTextGenerator.cs b/Craftsman/Builders/Dtos/DtoFileTextGenerator.cs index 62e05e35..7c642ff2 100644 --- a/Craftsman/Builders/Dtos/DtoFileTextGenerator.cs +++ b/Craftsman/Builders/Dtos/DtoFileTextGenerator.cs @@ -55,9 +55,15 @@ public static string DtoPropBuilder(List props, Dto dto) var defaultValue = props[eachProp].IsStringArray ? " = Array.Empty();" : ""; + string summary = string.IsNullOrWhiteSpace(props[eachProp].Summary) ? "" : $@" ///{Environment.NewLine} ///{props[eachProp].Summary}{Environment.NewLine} ///{Environment.NewLine}"; + string example = string.IsNullOrWhiteSpace(props[eachProp].Example) ? "" : $@" ///{props[eachProp].Example}{Environment.NewLine}"; + + var attributes = AttributeBuilder(props[eachProp]); string newLine = eachProp == props.Count - 1 ? "" : Environment.NewLine; - propString += $@"{attributes} public {props[eachProp].Type} {props[eachProp].Name} {{ get; set; }}{defaultValue}{newLine}"; + + propString += $@"{Environment.NewLine}{summary}{example}{attributes} public {props[eachProp].Type} {props[eachProp].Name} {{ get; set; }}{defaultValue}{newLine}"; + } return propString; diff --git a/Craftsman/Domain/EntityProperty.cs b/Craftsman/Domain/EntityProperty.cs index 3cd10a80..e159956f 100644 --- a/Craftsman/Domain/EntityProperty.cs +++ b/Craftsman/Domain/EntityProperty.cs @@ -225,6 +225,16 @@ public static EntityProperty GetPrimaryKey() Type = "Guid" }; } + + /// + /// The summary used in the documentation - visible in swagger + /// + public string Summary { get; set; } + + /// + /// An example value to fill swagger example + /// + public string Example { get; set; } } public class SmartOption