2.65.0
(feat): Generate CONTRIBUTING.md for C# SDKs, matching the pattern used by the TypeScript generator.
The file is skipped for whitelabel SDKs.
2.64.2
(fix): Dedup auth-derived headers in the generated client constructor when
multiple auth schemes resolve to the same HTTP header name (for
example, an oauth2 bearer scheme plus an apiKey-in-header scheme
both named Authorization). Previously the constructor’s
Dictionary<string, string> collection initializer added the same
key twice and threw System.ArgumentException: An item with the same key has already been added at runtime. Earlier auth schemes
win, preserving the ordering established by the IR.
(fix): Fix literal boolean auth-header values being emitted as "True" regardless
of the configured value. The generated client constructor’s auth-header
dictionary tested the truthiness of the Literal discriminated-union
object instead of reading its boolean field, so a literal false header
incorrectly produced "True".
2.64.1
(fix): Fix namespace collision when referencing nested discriminated union variant
types in generated test code. When the enclosing type name matches a segment
of the test file’s namespace, the C# compiler resolves it as the namespace
instead of the SDK type (CS0234). Now emits fully qualified type references
in this case.
(fix): Fix OneOfSerializer to prefer strongly-typed deserialization over catch-all
matches. When a discriminated union type inside a OneOf uses a catch-all for
unknown discriminators, the serializer now tries all types and selects the
best match instead of returning the first success.
(fix): Fix serialization round-trip tests to account for WhenWritingNull normalization.
The Roundtrips test now verifies idempotency of the serialized form rather than
comparing against the raw input JSON, which may include null optional properties
that are intentionally omitted by the serializer.
2.64.0
(feat): Add retryStatusCodes config with "legacy" and "recommended" modes. Legacy (default)
preserves current behavior (408, 429, >= 500). Recommended retries only transient
codes (408, 429, 502, 503, 504), avoiding idempotency issues with 500. A 3.0.0
migration auto-pins legacy for upgrading users.
2.63.3
(fix): Fix dynamic snippets emitting wrong property name when PascalCase(property)
collides with class name (e.g. CatalogV1Id.catalog_v1_id). The snippet
generator now uses the same rename logic as the SDK (appending ”_”) so that
generated examples compile without CS0542 / CS0117 errors.
2.63.2
(fix): Fix multi-value query parameter snippets when the example value is already
a list, which previously produced uncompilable list-of-list initializers
like [new List<T>() { value }] in mock server tests, reference docs, and
snippets.
2.63.1
(fix): Fix WireMock test generation to use percent-encoded query parameter keys,
matching what spec-compliant HTTP clients send. Also split comma-delimited
query parameter examples into multiple values in a single WithParam() call,
since WireMock.Net parses comma-separated values into arrays.
2.63.0
(feat): 支持 x-fern-default 作为生成的 C# SDK 中参数的回退值。当请求头、查询参数或路径参数在 IR 中具有 clientDefault 值时,生成的 C# SDK 将该参数设为可选,并自动应用默认值。
2.62.0
(feat): 当通过身份验证方案上的 placeholder 字段配置时,在代码片段中使用身份验证方案占位符值。
2.61.2
(chore): 将 @fern-api/generator-cli 升级到 0.9.11。GitHub 流水线步骤现在通过 GitHub REST API 创建签名提交(匹配 fiddle 的遗留 InMemoryGitRepo 推送路径),在启用重放的组织上恢复已验证的 fern-api[bot] 提交。
2.61.1
(fix): 为请求体为 bytes 的端点在包装请求记录上生成 System.IO.Stream 类型的 Body 属性。之前端点客户端方法会生成 Body = request.Body,但生成的请求记录没有声明 Body 属性,在任何结合二进制请求体与其他包装参数(例如查询参数、请求头或路径参数)的端点上都会产生 CS1061 编译错误。
2.61.0
(feat): 添加 offset-semantics 配置选项。当设置为 "page-index" 时,偏移量分页每页递增 1,而不是按返回的项目数量递增("item-index" 是默认值)。
2.60.2
(chore): 向生成器运行时添加通过 Sentry 进行的崩溃报告,并使用新的共享 GeneratorError 分类法对抛出的错误进行分类,以便将面向用户的失败(配置、验证、身份验证、网络、环境)与内部 Fern 错误区分开来——只有后者会转发给 Sentry。生成的输出没有变化。
2.60.1
(chore): 将 @fern-api/generator-cli 升级到 0.9.8。生成的 PR 中的变更日志 URL 现在使用提交 SHA 而不是 PR 分支名称,在分支被删除或压缩合并后保持链接有效。
2.59.6
(fix): 将特定域的事件属性(例如 AssistantMessage、ChatMetadata、AudioOutput)和 UnknownMessage 添加到生成的 WebSocket 客户端接口中。之前,这些事件仅在具体类中可用,迫使使用者从接口类型向下转换以访问它们。
2.59.5
(fix): 跳过具有空字符串路径参数的模拟服务器测试示例。空路径参数导致模拟服务器注册折叠的 URL(例如 /v0/tools/version/1),而 SDK 客户端发送双斜杠 URL(例如 /v0/tools//version/1),导致 WireMock 返回 404。
(fix): 修复当启用 generate-literals(或 experimental-readonly-constants)时,字面量类型的动态代码片段生成。内联字面量属性现在正确地省略值(依赖 = new() 默认初始化器),命名的字面量别名类型发出 new TypeName() 而不是原始字符串,防止 CS0029 编译错误。
(fix): 修复声明为 list<file> 的文件上传请求属性生成单个 FileParameter 字段而不是 List<FileParameter>。
2.59.4
(fix): 在 JsonElementComparer 数字比较中添加 GetSingle() 回退。当两个 JSON 数字作为十进制数不同但作为单精度数匹配时,它们表示相同的 float32 值,现在被视为相等。这修复了对于声明为 format: float 的字段的模拟服务器测试失败,其中 C# 的 System.Text.Json 序列化 System.Single 时使用比原始 JSON 字符串更短的十进制表示(例如 0.10722749680280685 vs 0.1072275)。
2.59.3
(fix): 修复当启用 generate-literals 时,模拟服务器测试和代码片段生成在对象初始化器中跳过字面量属性。之前,生成器会为 TypeLiteral 属性发出普通的字符串/布尔值赋值,导致 CS0029 编译错误。字面量属性现在依赖其 = new() 默认初始化器。
2.59.2
(fix): 修复当端点有示例但请求是不带 id 的普通 EndpointSnippetRequest 时,动态代码片段生成失败,提示”端点没有匹配代码片段的示例”。现在只有当代码片段包含 id 时,守护条件才会验证示例匹配。
2.59.1
(fix): 修复在转换期间添加错误时,动态代码片段中的无区分联合变体匹配选择不正确的变体。匹配器现在检查是否添加了错误(通过 errors.size() > errorsBefore)以及现有的 isNop 检查,并添加了缺失的 nop 检查,该检查导致无条件返回第一个变体。这防止了在生成的代码片段中为像 options 这样的联合字段返回空对象。
2.59.0
(feat): 在分页端点上公开 HTTP 响应元数据。Page<TItem> 现在包含 StatusCode、Headers 和 Response 属性,为用户提供对每个页面的 HTTP 状态码、响应头和完整 API 响应对象的访问。
2.58.1
(fix): 修复动态代码片段生成,在对象初始化器中包含所有必需属性。之前,示例数据中缺失的必需属性会被省略,在 C# 中导致 CS9035 编译错误。现在,当代码片段请求中不存在必需属性时,会接收确定性的占位符值。