[http-client-csharp] Handling types that are both experimental and obsolete, including omitting unused types

オープン
#12,408 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp

調査の方向性

Start with the C# generator changes in Azure/azure-sdk-for-net#64227 and inspect how it emits [Obsolete] and [Experimental] attributes, then trace model reachability and type suppression customization. The issue asks for a safe policy covering backward compatibility, retained SDK references, serialization, custom code, and generated suppressions. Done means proposing and implementing a policy or opt-in mechanism that handles these cases without breaking generated or custom code.

索引モデルが issue の本文から書いたものです。

説明

emitter:client:csharp feature

Context

While updating the C# generator in Azure/azure-sdk-for-net#64227 to @typespec/http-client-csharp 1.0.0-alpha.20261026.4, regeneration added [Obsolete] to three types that already have [Experimental("AAIP001")]:

  • Azure.AI.Extensions.OpenAI.BrowserAutomationPreviewTool
  • Azure.AI.Projects.Agents.BrowserAutomationPreviewToolboxTool
  • Azure.AI.Projects.Agents.WorkflowAgentDefinition

This produces obsolete diagnostics at existing use sites. It also exposes a compiler interaction: adding [Obsolete] to an experimental type causes references inside that type to other experimental APIs to start reporting their diagnostics. For example, BrowserAutomationPreviewTool derives from OpenAI's experimental ResponseTool, so both generated and custom partial declarations start reporting OPENAI001.

Minimal reproduction

Verified with .NET SDK 10.0.401:

using System;
using System.Diagnostics.CodeAnalysis;

[Experimental("OPENAI001")]
public class ExperimentalBase { }

[Experimental("AAIP001")]
[Obsolete("Legacy")]
public class Derived : ExperimentalBase { }

The base-class reference reports OPENAI001. Removing only [Obsolete("Legacy")] makes the example compile without diagnostics.

Desired direction / questions

What should the generator's policy be for types that are both experimental and deprecated?

Ideally, we would not generate the type when it is not required for backward compatibility and is not otherwise used. Could we consider:

  • Omitting these types when the configured backward-compatibility baseline does not require them and no retained SDK surface depends on them, or providing an explicit opt-in policy for this behavior.
  • Defining the reachability rules carefully: client signatures, other models, polymorphic serialization/deserialization, and custom code may still require a type. Generator-created model factories or model-reader/writer context registrations should not accidentally make an otherwise unused type impossible to omit.
  • Providing a supported per-type exclusion customization when automatic omission cannot be determined safely. The current C# CodeGenSuppress attribute suppresses members, not top-level types.
  • When the type must remain, generating the necessary narrowly scoped suppressions for experimental dependencies so that adding [Obsolete] does not break generated code. Custom-code references may still need explicit acknowledgement.

The types above are examples of the attribute interaction, not a claim that they can all be removed as-is: there are existing custom dispatch, telemetry, test, and sample references that must be accounted for. The goal is to discuss a safe policy and customization mechanism rather than dropping every deprecated experimental type unconditionally.

主要言語
Java
スター
5.9k
フォーク
421
平均マージ
2日 3時間
マージ済み PR(30日)
176

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/typespec のほかの issue

microsoft/typespec の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。