Value model in AdditionalFieldDefinition is an empty class, thus silently drops all data
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start in glean/api_client/models/additionalfielddefinition.py by inspecting the empty Value model and how AdditionalFieldDefinition constructs its value list. Reproduce the documented examples with anchor, hyperlink, and dictionary inputs, then confirm that model_dump() preserves the supplied data instead of producing empty objects.
Written by the indexing model from the issue text.
Description
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': [{}]}
- Dominant language
- Python
- Stars
- 20
- Forks
- 10
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gleanwork/api-client-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gleanwork/api-client-python#136 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
gleanwork/api-client-python#137 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
gleanwork/api-client-python#115 · 4 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
gleanwork/api-client-python#105 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
gleanwork/api-client-python#57 · 2 comments ·
All issues in gleanwork/api-client-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100