[typescript] fix: escaped multiline comments; implementation option 1
Currently, generated Typescript-code has escaped 's, etc. in the generated comment parts. This is due to the fact, that we currently use escapeText
everywhere, which has varying implementations for each target language. For Typescript it has:
which results in the aforementioned escaped sequence.
Example:
(origin here)
This pull request only escapes unsafe characters (currently multiline comments) for the descriptions of parameters, etc.
Note: The current implementation of escapeUnsafeCharacters does not guard for null, which is a possibility for any string passed. escapeText has the null guard. There are about a dozen @Overrides for escapeUnsafeCharacters, none of them guarding null (as it hasn't been used directly before, but only through escapeText, which has the guard). There were two options:
- Add
null guards to all existing implementations
- Introduce a wrapper function like
escapeText that guards for null and calls to escapeUnsafeCharacters
I chose 2) as it seemed more resilient, testable and also makes sure that other implementations out there and new ones in pull requests keep on working as expected. Let me know if you prefer 1) instead.
PR checklist
- Read the contribution guidelines.
- Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
- Run the following to build the project and update samples:
./mvnw clean package ./bin/generate-samples.sh ./bin/configs/*.yaml ./bin/utils/export_docs_generators.sh - File the PR against the correct branch:
master(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks) - If your PR is targeting a particular programming language, @mention the technical committee: @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04)