Problem
TypeSpec.HttpClient.@experimental currently records only that a declaration is experimental and optionally scopes that metadata to emitters. Client emitters may also need:
- a stable diagnostic identifier to surface in generated APIs;
- the diagnostic identifiers of experimental features used by the generated implementation;
- an explicit way to represent composed experiments without silently graduating an API when a dependency changes.
For example, the C# emitter needs to generate an API shaped like:
[Experimental("C")]
public void Bar()
{
#pragma warning disable A
#pragma warning disable B
// method body
#pragma warning restore A
#pragma warning restore B
}
Here, C is the public experiment and depends on experiments A and B.
Proposal
Extend FeatureLifecycleOptions with optional diagnosticId and dependsOn fields:
@experimental(#{
emitterScope: "@typespec/http-client-csharp",
diagnosticId: "C",
dependsOn: #["A", "B"]
})
op bar(): void;
Semantics
diagnosticId identifies the experiment surfaced on the generated public API.
dependsOn identifies experimental features used by that API's generated implementation.
- Emitters decide how to represent this metadata. For C#, this maps to
ExperimentalAttribute and scoped warning suppressions.
- Dependency graduation must not automatically remove the public API's experimental status. The API remains experimental until its
@experimental decorator is explicitly removed.
- The existing lifecycle query should remain compatible, with a details API exposing the additional metadata.
Acceptance criteria
Related work
Problem
TypeSpec.HttpClient.@experimentalcurrently records only that a declaration is experimental and optionally scopes that metadata to emitters. Client emitters may also need:For example, the C# emitter needs to generate an API shaped like:
Here,
Cis the public experiment and depends on experimentsAandB.Proposal
Extend
FeatureLifecycleOptionswith optionaldiagnosticIdanddependsOnfields:Semantics
diagnosticIdidentifies the experiment surfaced on the generated public API.dependsOnidentifies experimental features used by that API's generated implementation.ExperimentalAttributeand scoped warning suppressions.@experimentaldecorator is explicitly removed.Acceptance criteria
@experimentalaccepts optionaldiagnosticIdanddependsOnvalues.getFeatureLifecyclebehavior remains unchanged.Related work