fix(typescript-angular): restore basePath override from additional properties

TH
19h ago
+25-0

Since 7.13.0 (#20816) basePath field in api.base.service.ts is rendered from supporting files bundle
DefaultGenerator copies additional properties into that bundle first and then puts server URL as basePath on top, so --additional-properties=basePath= (or <additionalProperties>basePath=</additionalProperties> in maven plugin) is ignored and client always gets server URL from spec
Override worked up to 7.11.0 while field lived in api.service.ts, api templates get additional properties last

Now TypeScriptAngularClientCodegen puts user supplied basePath back in postProcessSupportingFileData, without it bundle stays as is
Fix is kept in angular generator, reordering in DefaultGenerator would change supporting files of every generator that reads basePath

Added testBasePathFromAdditionalProperties next to testBasePath, it generates with basePath set to '' and /api and checks field in api.base.service.ts, it fails on master
Sample configs dont set basePath, regenerated typescript-angular samples have no diff

Fixes #21438

Open #25353 adds postProcessSupportingFileData to same class too, whichever lands second needs to merge both into one override

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    Commit all changed files.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim


Summary by cubic

Restores the basePath override from additional properties in the typescript-angular generator, which has been ignored since 7.13.0. The generated client now honors a user-supplied basePath instead of always falling back to the server URL from the spec.

  • Adds postProcessSupportingFileData in TypeScriptAngularClientCodegen; the fix is scoped to the angular generator so other generators that read basePath are unaffected.
  • Adds a regression test covering basePath set to '' and /api.