Abp generate-proxy -t ng skips api version 2 and always generate version 1

Discussão em 'Angular' iniciado por Ahmed Halawa, Novembro 9, 2024.

  1. Ahmed Halawa

    Ahmed Halawa Guest

    I am using ABP with Angular and have an API that supports multiple versions. Both versions (v1 and v2) show up correctly in Swagger, but when I run abp generate-proxy -t ng, only the endpoints for version 1 are generated in the Angular project. Here are my dependencies:


    "dependencies": {
    "@abp/ng.account": "~8.1.4",
    "@abp/ng.components": "~8.1.4",
    "@abp/ng.core": "~8.1.4",
    "@abp/ng.oauth": "~8.1.4",
    "@abp/ng.identity": "~8.1.4",
    "@abp/ng.setting-management": "~8.1.4",
    "@abp/ng.tenant-management": "~8.1.4",
    "@abp/ng.theme.shared": "~8.1.4",
    "@abp/ng.theme.basic": "~8.1.4",
    "@angular/animations": "~17.3.0",
    "@angular/common": "~17.3.0",
    "@angular/compiler": "~17.3.0",
    "@angular/core": "~17.3.0",
    "@angular/forms": "~17.3.0",
    "@angular/localize": "~17.3.0",
    "@angular/platform-browser": "~17.3.0",
    "@angular/platform-browser-dynamic": "~17.3.0",
    "@angular/router": "~17.3.0",
    ...
    }

    "devDependencies": {
    "@abp/ng.schematics": "~8.1.4",
    ....
    }



    Swagger Generate Both Version 1 and 2

    [​IMG]

    Here's an example of one of my versioned API endpoints:

    [HttpGet]
    [ApiVersion(version: "2.0")]
    [Route("api/lookups/v{version:apiVersion}/classifications")]
    [Authorize(Policy = DefaultAPIPolicies.PolicyNameForManager)]
    public async Task<List<LookupDto>> GetClassificationsAsync_V2()
    {
    return await _GetClassificationsQueryHandler.GetAsync();
    }



    What I've Tried I confirmed that both versions are present in Swagger. I tried adjusting the generate-proxy command, but there doesn’t seem to be an option to specify API version. I also checked for any proxy configuration in appsettings.json and angular.json but didn't find anything restricting it to version 1.

    Questions How can I generate the Angular proxies for both versions' endpoints?

    Continue reading...

Compartilhe esta Página