abp icon indicating copy to clipboard operation
abp copied to clipboard

Defining custom route for AppService method in Swagger

Open improwise opened this issue 4 years ago • 2 comments

Is this the recommended way to set a custom route for a method in Swagger?

[HttpGet]
[Route("/api/app/country")]
public async Task<List<CountryDto>> GetCountryListAsync()

Is it possible to get the "/api/app" part generated automatically so that it will always match any changes made to RootPath in startup? You can of course decorate the class rather than each method with the prefix but it would still be hard coded and not match changes in startup.

improwise avatar Jan 10 '22 11:01 improwise

You can check these classes.

https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs#L44 https://github.com/abpframework/abp/blob/e3e1779de6df5d26f01cdc8e99ac9cbcb3d24d3c/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs#L13

maliming avatar Jan 11 '22 02:01 maliming

@improwise what did you end up with?

I too would like to customize the route for some AppService actions, without having to hardcode the conventional base route...

sanghel-payoff avatar Mar 16 '22 18:03 sanghel-payoff