fix(typescript-angular,typescript-nestjs): parse boolean options passed as strings
Boolean options of typescript-angular and typescript-nestjs arrive as strings when set with --additional-properties or with gradle configOptions
withInterfaces and taggedUnions go through Boolean.parseBoolean, but parsed value is never writen back, so templates read raw "false" from additionalProperties and mustache treats it as true
useSquareBracketsInArrayNames in angular and useSingleRequestParameter in nestjs are not parsed at all
With withInterfaces=false every service still imports and implements its *ServiceInterface and api.ts still re-exports it, while Java side does not add interface file, so generated client fails with TS2307
With taggedUnions=false models are still emitted as tagged unions (export type Pet = Cat)
Same for other two, angular keeps appending [] to array form field names and nestjs keeps generating request parameter objects
Now these options go through convertPropertyToBooleanAndWriteBack, angular already converts and writes back withHttpResource and useSingleRequestParameter this way
Added testBooleanOptionsPassedAsStrings to TypeScriptAngularClientCodegenTest and TypeScriptNestjsClientCodegenTest, it generates with option unset, false, "false", true and "true" like testFormObjectDotNotationOption does, string "false" cases fail on master
Sample configs set these options only to true or leave them out, so regenerated typescript-angular and typescript-nestjs samples have no diff
Fixes #19276
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
Commit all changed files../mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit - 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
Fixes #19276 where boolean options passed as strings to typescript-angular and typescript-nestjs were treated as always true.
withInterfaces and taggedUnions were parsed with Boolean.parseBoolean but the result was never written back, so templates read the raw string and Mustache treated "false" as truthy. useSquareBracketsInArrayNames (angular) and useSingleRequestParameter (nestjs) weren't parsed at all. All four options now go through convertPropertyToBooleanAndWriteBack, and tests cover unset, boolean, and string values for each.