- ABP Framework version: v4.2.2
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
- How i can version api in ABP
12 Answer(s)
-
0
Hi,
You can check this: https://github.com/abpframework/abp/blob/dev/docs/en/API/API-Versioning.md
-
0
Hello liangshiwei, few points:
1- https://github.com/abpframework/abp/blob/dev/docs/en/API/API-Versioning.md#enable-api-versioning which project --> file i have to make change i.e. Host, API, identity or all 2- do i have to follow all sections?
-
0
Hi,
which project
Usually is
HttpAPI.Host
No, you don't need to follow all sections.
If you are using the Auto API Controller, you just need to follow this section: https://github.com/abpframework/abp/blob/dev/docs/en/API/API-Versioning.md#auto-api-controller
You can also check the unit tests: https://github.com/abpframework/abp/tree/dev/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests
-
0
i am using default ABP application so assuming it is using Auto API Controller. Now question is which project --> class file i need to make these changes
-
0
Hello liangshiwei, if i am following https://github.com/abpframework/abp/blob/dev/docs/en/API/API-Versioning.md#enable-api-versioning then swagger is not able to load due to error:
2022-03-14 14:09:08.056 +05:30 [ERR] An unhandled exception has occurred while executing the request. Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Conflicting method/path combination "GET api/app/user-extensions" for actions - EzpandCC.Domain.Controllers.UserExtensions.UserExtensionController.GetListAsync (EzpandCC.HttpApi),EzpandCC.Domain.Controllers.UserExtensions.UserExtensionV2Controller.GetListAsync (EzpandCC.HttpApi). Actions require a unique method/path combination for Swagger/OpenAPI 3.0. Use ConflictingActionsResolver as a workaround at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable
1 apiDescriptions, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable
1 apiDescriptions, SchemaRepository schemaRepository) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()but if i change path like "[Route("api/v1/app/user-extensions")]" and "[Route("api/v2/app/user-extensions")]" then dynamic api working fine but i am looking for querystring version parameters?
-
0
Hi,
but i am looking for querystring version parameters?
Angular service proxies does not support API versioning yet, see : https://github.com/abpframework/abp/issues/11969 You need to use
RestService
to send http requests manually -
0
Hi liangshiwei, i have looked the api sample code and api version document also. it is cofusing and i am not sure what exactly i have to change. can you help me:
ABP: 4.2.2 Angular Auto controller
-
0
-
0
Hello liangshiwei, Thanks for sample. i observerd that in in host project we have preConfigure method to define version for every interface. Now i have 2 understanding challenges:
- do i have to rename all my classes namespace
- do i have to specify all interfaces (i have 100) classes in preConfigure method as higlited below.
- What is the other best alternate without impacting current project. current api should be considered as V1 by default and next we can specify as required.
-
0
HI,
No, you don't need it, the
TypePredicate
is a selector, you can use any methodNo, you don't need it, but you need to write an appropriate
TypePredicate
selector, it will process all application services that match the current selector.I recommend using namespaces as we did so your solution structure will be very clear, by default all application services are v1 unless you configure selectors for them.
-
0
Hello @liangshiwei, Thanks. can you share 1 application sample with me. for all above points, so that we can follow in our project.
-
0
Hi,
The example already includes all points.
https://github.com/realLiangshiwei/Qa2716