Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

OpenAI strict mode rejects optional properties in nested objects

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

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
swift
領域
api

調査の方向性

Start from toJSONValueForOpenAIStrictMode() and toJSONValueForOpenResponsesStrictMode(), which currently apply strict-mode rules only to the root object. Walk the schema recursively so every nested object gets the same treatment: all properties listed in required, and optional property types made nullable. The issue's Contact/Address example and the enum-case note in #322 are the cases to check. Done when nested optional properties pass strict mode in both OpenAI and Open Responses schemas, with tests covering nested and enum cases.

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

説明

OpenAILanguageModel and OpenResponsesLanguageModel send structured output schemas with strict: true. OpenAI's strict mode requires every property of every object to be in required, with a null type for an optional one. toJSONValueForOpenAIStrictMode() and toJSONValueForOpenResponsesStrictMode() only do this for the root object, so an optional property in a nested object is left out of required.

For example, unit isn't in Address's required here:

@Generable
struct Contact {
    var name: String
    var address: Address
}

@Generable
struct Address {
    var street: String
    var unit: String?
}

The same goes for enum cases with optional values, like case note(String?) (#322).

The fix is probably to apply the root's rules to every object in the schema, and make each optional property's type nullable.

主要言語
Swift
スター
948
フォーク
99
平均マージ
19時間 57分
マージ済み PR(30日)
50

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

huggingface/AnyLanguageModel のほかの issue

huggingface/AnyLanguageModel の issue をすべて見る

似ている issue

Swift の issue をもっと見る

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

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