My model:
[Route("/Widget/{Id}", "PUT", Summary = "Updates a widget by Id.")]
public class UpdateWidgetReq : IReturn<string>
{
[ApiMember(IsRequired = true)]
public Guid Id { get; set; }
[ApiMember(IsRequired = true, ParameterType = "body", DataType = "WidgetDTO")]
public WidgetDTO widgetUpdate { get; set; }
}
How do I make Swagger generate and display the WidgetDTO model for the widgetUpdate property? Leaving the DataType off has Swagger expecting a string, which doesn’t help the end-user understand the json structure they need to submit at all (which is the whole purpose of even having swagger here). Specifying the name of the WidgetDTO type as I have above, or even fully qualified, causes the Swagger to show “undefined” as the type (and still no model shown).
according to the ServiceStack code for the DataType field:
For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype.
Not that it should matter, but I set DisableAutoDtoInBodyParam to true since that auto generated DTO was confusing, given the Id Path param.
thanks!