Azure / Azure/typespec-rust

Consider adding switch to opt out of options type name disambiguation

Open
#246 3 comments 0 reactions 0 assignees View on GitHub
Blocked CodeGen
Dominant language
Rust
Stars
7
Forks
11
Avg merge
2d 5h
Merged PRs (30d)
5

Description

For `FooClient`, all client/client method options will have the prefix `FooClient`. This is to disambiguate the case when an SDK contains multiple clients and two (or more) clients have a method with the same name (e.g. `SomeMethod`), Without the prefix, `SomeMethodOptions` would collide.

For SDKs with a single client, and that will _always_ have a single client, the prefix is unnecessary and creates ugly names. We could consider adding a switch to opt out of this prefix. It works IFF an SDK contains a single client, else an error is generated (this is what we do in the go emitter). Note that opting in and then later opting out would result in a breaking change. So, one must be 100% confident that the SDK in question will always contain only one client.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Rust emitter's option-type naming behavior and compare it with the Go emitter's single-client handling. Define where the opt-out switch belongs, how multiple clients should produce an error, and verify that single-client SDKs omit the client prefix without changing the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.