In my API's model assembly, I heavily use the ApiMember attribute to provide descriptions for the properties for Swagger UI, e.g.
public class FindVendorItems : IReturn<List<VendorItem>>, IGet
{
[ApiMember(Descripton = Description.ItemId)]
public int ItemId { get; set; }
}
The descriptions are constant strings in a static Description class so that they can be used throughout the model to keep the description consistent.
This works great for Swagger, but the problem I'd like to solve is getting those same descriptions into the summary tag of the XML documentation comments so they are usable and visible in Visual Studio. I don't want to copy/paste the description from the constant into the summary tag, as it's proven to be prone to errors and the two can quickly get out of sync.
public class FindVendorItems : IReturn<List<VendorItem>>, IGet
{
/// <summary>
/// Same Description.ItemId here
/// </summary>
[ApiMember(Descripton = Description.ItemId)]
public int ItemId { get; set; }
}
Is there any way to do this automatically? Even if it's not visible like this in Visual Studio, it's fine as long as the resulting XML file generated by the build contains all the descriptions so IntelliSense is provided when the NuGet package built from this is consumed.