Azure / Azure/typespec-azure

Improve constant value names

Open
#4,941 1 comment 0 reactions 1 assignee Claimed by @jhendrixMSFT View on GitHub
emitter:go feature
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

> Migrated from https://github.com/Azure/autorest.go/issues/1689

---

In [`types.ts@getConstantValues()`](https://github.com/Azure/autorest.go/blob/main/packages/typespec-go/src/tcgcadapter/types.ts#L609) we call `naming.ensureNameCase()` which, as part of its work, calls [`deconstruct()`](https://github.com/Azure/autorest.go/blob/main/packages/naming.go/src/naming.ts#L69-L75) to split names into chunks.

This has some reasonable behavior, e.g. `user,system` is renamed to `UserSystem`. However, there are some screwy cases. This list isn't meant to be exhaustive but shows some cases that were noticed.
- `v1_0` becomes `V10`
- `application/*+json` becomes `ApplicationJSON`
- `3.14` becomes `314`

While it would be nice to fix this, it would result in breaking changes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.