microsoft / microsoft/typespec
[http-client-csharp] Disambiguate property names that collide after date-time normalization
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
## Description
C# date-time normalization is many-to-one and can map two distinct properties on the same model to the same generated identifier. The generator currently emits duplicate properties and constructor parameters rather than disambiguating the collision.
Examples:
```text
StartOn -> StartsOn
StartTime -> StartsOn
```
and, with the `Expire` verb normalization used to align date-time naming:
```text
ExpireOn -> ExpiresOn
ExpirationTime -> ExpiresOn
```
The general collision behavior predates the `Expire` rule; that rule adds another instance of the same existing class of collision.
## Expected behavior
When distinct input properties normalize to the same C# identifier, the generator should apply a deterministic collision policy that:
- emits valid C# with unique property and constructor-parameter names;
- preserves exact/custom names and GA compatibility requirements where applicable;
- keeps serialization mapped to each original input property;
- is independent of input declaration order; and
- applies consistently to properties, constructor parameters, canonical views, and serialization providers.
## Regression coverage
Cover at least:
1. Date-time `StartOn` and `StartTime` on the same model.
2. Date-time `ExpireOn` and `ExpirationTime` on the same model.
3. A GA contract where one colliding name was already shipped.
4. Custom code targeting one of the colliding properties.
5. Distinct wire names remain correctly serialized after disambiguation.
Follow-up to #11773. This should not block preserving established GA names in that PR.
- by copilot
Contributor guide
Research direction
Start by tracing C# date-time normalization and the generation paths for properties, constructor parameters, canonical views, and serialization providers. Reproduce the listed Start and Expire collisions, then inspect existing GA, custom-code, and wire-name coverage. Done means deterministic unique identifiers, preserved established names, and correct serialization across all requested cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100