[typescript] fix: escaped multiline comments; implementation option 2 #19553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
alternative implementation for #19528, via #19528 (comment):
That changes the implementation of
escapeUnsafeCharacters
for all generators that are currently implemented in a non-null-safe way.There were two generators that already hard guards for
null
. Interestingly they return""
instead, most likely to prevent downstream NPEs; see:openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java
Lines 1152 to 1154 in 8171648
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java
Lines 1158 to 1160 in 8171648
Please let me know if you'd like to align.
I also changed the generator scaffold to automatically get the null guard.
@wing328 For the record, I am a bit ambivalent about which way is the better implementation. This one seems to produce less generic code, but puts a lot more stress on each generator. For a community project like this, I'd probably go with a solution that takes the onus away from the generator implementations, as it will need less education and increase general stability.
closes #19528 #19554