Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
toEnumVarNameinAbstractTypeScriptClientCodegenstrips chars with ASCII\W, so enum values likeÀ,Москваor日本語end up with empty key and generated code is{ : 'À' }, which is TS1136 in every typescript-* generator with default settingsNow if nothing is left after
sanitizeName, value is sanitized again with unicode(?U)\W, soМоскваgivesМосква: 'Москва'I know
allowUnicodeIdentifiersexists and gives valid output, but default output should not be invalid TypeScript. Only keys that are empty today change, anything that already produced non-empty key is untouchd (Caféis stillCaf,Москва 2is still_2). Same idea as #24427, default sanitization fixed in this class without new optionAdded test with
À,МоскваandНур-СултанinTypeScriptAngularClientCodegenTest, it fails on master (expected [À] but found [])Full
./mvnw clean packagepasses apart from Kotlin tests (embedded Kotlin compiler fails on my JDK 25). Regenerated all 93bin/configs/typescript*.yaml, no sample changes. Did not run other configs, only typescript abstract class is touched. Generated typescript-angular and typescript-fetch for a spec withÀandМоскваenums passtsc --strict, typescript-axios has no syntax errors (only missingaxiosmodule in my scratch dir)This is typescript part of #16928, dart part is not touched
Fixes #9739
PR checklist
@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim
Summary by cubic
Fixes
toEnumVarNameinAbstractTypeScriptClientCodegenso enum values containing only non-Latin characters no longer produce invalid TypeScript like{ : 'Москва' }.À,Москва, orНур-Султан.Caféstill becomesCaf).TypeScriptAngularClientCodegenTestand fixes [BUG] [typescript-axios] utf8 values enum generated wrong #9739.Written for commit 9336037. Summary will update on new commits.