I’m not seeing any of our AutoQuery endpoints at /swagger-ui. Is there a setting I need to set?
@MikeOtown, did you add your own [Route("/myroute")]
to the AutoQuery DTOs? The OpenApiFeature
doesn’t expose the Request DTO named routes, eg /api/MyDto
or /json/reply/MyDto
.
We specify the Route Attribute on the classes in our ServiceModel Operations project. Here is an example of one of our AutoQuery endpoints:
[Route("/query/Company/", "GET")]
[RequiredPermission(Permissions.GET_Company)]
public class FindCompanies : QueryDb<Company>
{
}
Not sure if it’s going to help but [RequiredPermission]
is a Request Filter Attribute implementation which has a reference to ServiceStack.dll which should only be on Service Implementation classes. All DTOs should be in a impl-free ServiceModel project that only references ServiceStack.Interfaces.dll.
You’d instead use Declarative Validation Attributes to define authorization requirements on Request DTOs, e.g:
[Route("/query/Company", "GET")]
[ValidateHasPermission(Permissions.GET_Company)]
public class FindCompanies : QueryDb<Company>
{
}
I’ve added this AutoQuery API to a new vue-mjs project that shows up in OpenApiFeature’s /swagger-ui:
Note: also routes shouldn’t have trailing slashes
Ok. The AutoQuery endpoints are under “query” in /swagger-ui. Didn’t realize that. Thanks.
Yeah they’re structured by your user-defined routes.
Also REST-ful routes are typically (noun) resource identifiers where IMO it’s more appropriate to use:
[Route("/company/query", "GET")]
Which reads like a noun “this is the query endpoint for companies” rather then /query/company
which reads like a verb, “query companies with this API”