Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Craftsman/Builders/Dtos/DtoFileTextGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ public static string DtoPropBuilder(List<EntityProperty> props, Dto dto)

var defaultValue = props[eachProp].IsStringArray ? " = Array.Empty<string>();" : "";

string summary = string.IsNullOrWhiteSpace(props[eachProp].Summary) ? "" : $@" ///<summary>{Environment.NewLine} ///{props[eachProp].Summary}{Environment.NewLine} ///</summary>{Environment.NewLine}";
string example = string.IsNullOrWhiteSpace(props[eachProp].Example) ? "" : $@" ///<example>{props[eachProp].Example}</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;
Expand Down
10 changes: 10 additions & 0 deletions Craftsman/Domain/EntityProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ public static EntityProperty GetPrimaryKey()
Type = "Guid"
};
}

/// <summary>
/// The summary used in the documentation - visible in swagger
/// </summary>
public string Summary { get; set; }

/// <summary>
/// An example value to fill swagger example
/// </summary>
public string Example { get; set; }
}

public class SmartOption
Expand Down