You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if there is anything to do on the library side, but other users are likely to search for the problem here. API docs do not list "duplicate" as a valid value for Issue.state_reason, but it does not prevent their API from returning such.
In the meantime, the following patch allows arbitrary close_reason values:
def_patch_issue_model():
"""Patch API bug. https://github.com/orgs/community/discussions/150535"""fromgithubkit.typingimportMissingIssue.model_fields['state_reason'].annotation=Missing[str|None]
Issue.model_rebuild(force=True)
_patch_issue_model()
My traceback for better indexing:
Traceback (most recent call last):
File "/home/runner/work/mypy-issues/mypy-issues/.venv/bin/fetch", line 10, in <module>
sys.exit(fetch_issues())
~~~~~~~~~~~~^^
File "/home/runner/work/mypy-issues/mypy-issues/src/mypy_issues/__init__.py", line 28, in fetch_issues
download_snippets(token, limit=args.limit)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/mypy-issues/mypy-issues/src/mypy_issues/issues.py", line 47, in download_snippets
removed = {iss.number for iss in _get_closed_issues(gh, org, repo, since)}
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/mypy-issues/mypy-issues/src/mypy_issues/issues.py", line 147, in _get_closed_issues
).parsed_data
^^^^^^^^^^^
File "/home/runner/work/mypy-issues/mypy-issues/.venv/lib/python3.13/site-packages/githubkit/response.py", line 94, in parsed_data
return type_validate_json(self._data_model, self.content)
File "/home/runner/work/mypy-issues/mypy-issues/.venv/lib/python3.13/site-packages/githubkit/compat.py", line 43, in type_validate_json
return TypeAdapter(type_).validate_json(data)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/runner/work/mypy-issues/mypy-issues/.venv/lib/python3.13/site-packages/pydantic/type_adapter.py", line 446, in validate_json
return self.validator.validate_json(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
data, strict=strict, context=context, allow_partial=experimental_allow_partial
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for list[Issue]
0.state_reason.literal[<UNSET>]
Input should be <UNSET> [type=literal_error, input_value='duplicate', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/literal_error
0.state_reason.literal['completed','reopened','not_planned']
Input should be 'completed', 'reopened' or 'not_planned' [type=literal_error, input_value='duplicate', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/literal_error
Please keep this open until the upstream issue is resolved.
The text was updated successfully, but these errors were encountered:
Cross-ref to https://github.com/orgs/community/discussions/150535.
I'm not sure if there is anything to do on the library side, but other users are likely to search for the problem here. API docs do not list "duplicate" as a valid value for
Issue.state_reason
, but it does not prevent their API from returning such.In the meantime, the following patch allows arbitrary close_reason values:
My traceback for better indexing:
Please keep this open until the upstream issue is resolved.
The text was updated successfully, but these errors were encountered: