Reputation: 462
I'm having a problem with excluding a specific DTO from Swagger in my ServiceStack application. Here's my setup:
[Route("/lists", "GET")]
public class GetLists : IReturn<GetListsResponse>
{
}
[Route("/lists", "POST")]
[Exclude(Feature.Metadata)]
public class CreateList : IReturn<CreateListResponse>
{
}
The behavior I'm expecting is the Swagger will remove the POST request docs but not the GET. Instead I'm getting both of them listed. Any help with what I'm doing wrong is appreciated.
UPDATE: I have tried adding the following attribute to no success:
[Restrict(VisibilityTo = RequestAttributes.None)]
Upvotes: 1
Views: 225
Reputation: 143339
The visibility of different Request DTO's should now be resolved from this commit that's available from v4.0.55 that's now available on MyGet.
Upvotes: 3
Reputation: 2203
You can restrict Visibility using the [Restrict] attribute. (see documentation). This is a class based attribute and should be placed on your Service class. Visibility affects whether or not the service shows up on the public /metadata pages (& I am hoping for Swagger as well).
Have you tried the below?
[Route("/lists", "POST")]
[Restrict(VisibilityTo = RequestAttributes.None)]
public class CreateList : IReturn<CreateListResponse>
{
}
Upvotes: 2
Reputation: 14677
From looking at the documentation, it looks like you can either exclude properties of a DTO or all services using a DTO -- but it doesn't say anything about excluding only certain verbs.
Upvotes: 2