generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Labels
Description
Reproduce steps:
- Create a commit which has permission changed. No changes in the file content.
- Try to get the commit using compare_commits
github.rest.repos.compare_commits(
owner="test",
repo=""test,
basehead="abcabcabcabc~1...abcabcabcabc"
).parsed_data
Fails with
---> ).parsed_data
File [/usr/local/lib/python3.10/site-packages/githubkit/response.py:94](githubkit/response.py:94), in Response.parsed_data(self)
[92](githubkit/response.py:92) @property
[93](githubkit/response.py:93) def parsed_data(self) -> MT:
---> [94](githubkit/response.py:94) return type_validate_json(self._data_model, self.content)
File [/usr/local/lib/python3.10/site-packages/githubkit/compat.py:43](githubkit/compat.py:43), in type_validate_json(type_, data)
[42](githubkit/compat.py:42) def type_validate_json(type_: type[T], data: Any) -> T:
---> [43](githubkit/compat.py:43) return TypeAdapter(type_).validate_json(data)
File [/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py:135](pydantic/type_adapter.py:135), in _frame_depth.<locals>.wrapper.<locals>.wrapped(self, *args, **kwargs)
[132](pydantic/type_adapter.py:132) @wraps(func)
[133](pydantic/type_adapter.py:133) def wrapped(self: TypeAdapterT, *args: P.args, **kwargs: P.kwargs) -> R:
[134](pydantic/type_adapter.py:134) with self._with_frame_depth(depth + 1): # depth + 1 for the wrapper function
--> [135](pydantic/type_adapter.py:135) return func(self, *args, **kwargs)
File [/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py:384](pydantic/type_adapter.py:384), in TypeAdapter.validate_json(self, data, strict, context)
[368](pydantic/type_adapter.py:368) @_frame_depth(1)
[369](pydantic/type_adapter.py:369) def validate_json(
[370](pydantic/type_adapter.py:370) self, data: str | bytes, [/](None = None, context: dict[str, Any] | None = None
[371](pydantic/type_adapter.py:371) ) -> T:
[372](pydantic/type_adapter.py:372) """Usage docs: https://docs.pydantic.dev/2.9/concepts/json/#json-parsing
[373](pydantic/type_adapter.py:373)
[374](pydantic/type_adapter.py:374) Validate a JSON string or bytes against the model.
(...)
[382](pydantic/type_adapter.py:382) The validated object.
[383](pydantic/type_adapter.py:383) """
--> [384](pydantic/type_adapter.py:384) return self.validator.validate_json(data, strict=strict, context=context)
ValidationError: 2 validation errors for CommitComparison
files.literal[<UNSET>]
Input should be <UNSET> [type=literal_error, input_value=[{'sha': 'abcabcabc...'}], input_type=list]
For further information visit https://errors.pydantic.dev/2.9/v/literal_error
files.list[DiffEntry].2.sha
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.9/v/string_type
Tha main changes in the endpoint is that there's no SHA for the file change:
{'sha': None, <--- This is the issue
'filename': 'test.py',
'status': 'modified',
'additions': 0,
'deletions': 0,
'changes': 0,
'blob_url': '. . .',
'raw_url': '. . .',
'contents_url': '. . .'
}