Value model in AdditionalFieldDefinition is an empty class, thus silently drops all data
まだ誰も着手していません。
評価
調査の方向性
glean/api_client/models/additionalfielddefinition.py で、空の Value モデルと AdditionalFieldDefinition が value リストを構築する方法を調べることから始めます。anchor、hyperlink、dictionary の入力を使ってドキュメント化された例を再現し、その後、model_dump() が空のオブジェクトを生成するのではなく、指定されたデータを保持することを確認します。
索引モデルが issue の本文から書いたものです。
説明
The Value class in additionalfielddefinition.py is defined as an empty Pydantic BaseModel with no fields:
class Value(BaseModel):
r"""Either a string or HypertextField. When OpenAPI Generator supports oneOf, we can semantically enforce this in the docs."""
Because the SDK's BaseModel uses the default Pydantic extra = 'ignore' behavior, any data passed to Value(...) is silently discarded. This means the value field on AdditionalFieldDefinition, which is typed as Optional[List[Value]], cannot actually carry any data.
Impact
This affects any consumer using AdditionalFieldDefinition through either:
EmployeeInfoDefinition.additional_fieldsTeamInfoDefinition.additional_fields
When constructing an AdditionalFieldDefinition with values, the data in the value list is lost:
from glean.api_client.models.additionalfielddefinition import AdditionalFieldDefinition, Value
field = AdditionalFieldDefinition(
key="languages",
value=[Value(anchor="English"), Value(anchor="Spanish")]
)
print(field.model_dump())
# {'key': 'languages', 'value': [{}, {}]}
# ^^ ^^ all data silently dropped
The same applies to HypertextField-style values:
Value(anchor="Glean", hyperlink="https://glean.com")
# Value() — both anchor and hyperlink are silently ignored
This is the associated public docs page: https://developers.glean.com/api/indexing-api/bulk-index-employees. Note that even when passing in data to Value() as a dict, the whole dict object is ignored:
from glean.api_client.models.additionalfielddefinition import AdditionalFieldDefinition
raw = {"key": "username", "value": [{"username": "testuser"}]}
field = AdditionalFieldDefinition(**raw)
dumped = field.model_dump()
print(dumped)
# {'key': 'username', 'value': [{}]}
- 主要言語
- Python
- スター
- 20
- フォーク
- 10
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 17
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gleanwork/api-client-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gleanwork/api-client-python#136 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
gleanwork/api-client-python#137 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
gleanwork/api-client-python#115 · コメント 4 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
gleanwork/api-client-python#105 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
gleanwork/api-client-python#57 · コメント 2 件 ·
gleanwork/api-client-python の issue をすべて見る
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100