If you want to use
SaveWorkflow_POST(string name, string description, DefObject definition, string[] actions, Guid projectid)
instead of
SaveWorkflow_POST(Workflow data,Guid projectid)
you should use this DTO
public class WorkflowPostRequest: IReturn<Workflow>
{
public Guid ProjectId { get; set; }
public Workflow workflow { get; set; }
}
instead of deriving request from Workflow
class. And in that case Workflow parameter will be incapsulated in Open API parameter workflow
and in this case swagger ui generates correct sample which is shown in your post.
"workflow" {
{
"Definition": "string",
"Description": "string",
"ProjectId": "string",
"ScriptId": "string",
"WorkflowId": "string"
}
}
If you use DTO derived from other class it’s equal to this semantic:
SaveWorkflow_POST(string name, string description, DefObject definition, string[] actions, Guid projectid)
[Route("/workflow/{ProjectId}", "POST")]
[Api(BodyParameter = GenerateBodyParameter.Always, IsRequired = true)]
public class WorkflowPostRequest : Workflow, IReturn<Workflow>
{
[ApiMember(ParameterType = "path", ExcludeInSchema = true)]
public string ProjectId { get; set; }
}
Where model will be
WorkflowPostRequest : {
...
}
And parameter Model is WorkflowPostRequest
because ServiceStack handler expect WorkflowPostRequest
as parameter, not Workflow
and the definition is generated correctly too.
Do I correctly understand that if request is derived from another class you want to rename model name which is shown in swagger and declare all parameter from base class as body parameter while declare parameters of derived class as query/path params?