hey-api / openapi-ts

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.4k stars 106 forks source link

Investigate sanitized names with prefix #1321

Open mrlubos opened 3 days ago

mrlubos commented 3 days ago

By default, we will sanitize illegal names so the output doesn't throw. For example, a schema with the name "400" gets generated as const _400 = 400. I noticed that using "name builders" unnecessarily preserves the sanitized name. For example, the pattern z{{name}} would generate const z_400 = 400. This is no longer needed since the original name would've been legal, i.e. const z400 = 400. Need to investigate how widespread this issue is before deciding how to address it.