yanyongyu / githubkit

The modern, all-batteries-included GitHub SDK for Python, including rest api, graphql, webhooks, like octokit!
https://yanyongyu.github.io/githubkit/
MIT License
177 stars 25 forks source link

Fix: diff-entry's blob_url and raw_url may be null #134

Closed fau-st closed 2 weeks ago

fau-st commented 2 weeks ago

When using compare_commits, a diff-entry listed in the files property might have blob_url and raw_url set to null

I encountered this issue when comparing commits that made a change to a submodule. It might be the only case where those two properties may be null.

Repro

gh.rest.repos.compare_commits(
    'jqlang',
    'jq',
    '481167c8f186d534b2cef0e8a7d6a4d6dbc45d6b...092fef740a0d1a0ddf61cf9e7af88915071c0705',
).parsed_data

:arrow_down:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for CommitComparison
files.literal[<UNSET>]
  Input should be <UNSET> [type=literal_error, input_value=[{'sha': 'cca857c64d3d678... --leak-check=full \\'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.8/v/literal_error
files.list[DiffEntry].2.blob_url
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/string_type
files.list[DiffEntry].2.raw_url
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/string_type
codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 17.82%. Comparing base (1ab40e3) to head (991dccc). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...kit/versions/ghec_v2022_11_28/models/group_0213.py 0.00% 3 Missing :warning:
...bkit/versions/ghec_v2022_11_28/types/group_0213.py 0.00% 3 Missing :warning:
...ithubkit/versions/v2022_11_28/models/group_0190.py 0.00% 3 Missing :warning:
githubkit/versions/v2022_11_28/types/group_0190.py 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #134 +/- ## ======================================= Coverage 17.82% 17.82% ======================================= Files 4834 4834 Lines 223387 223387 ======================================= Hits 39815 39815 Misses 183572 183572 ``` | [Flag](https://app.codecov.io/gh/yanyongyu/githubkit/pull/134/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ju4tCode) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/yanyongyu/githubkit/pull/134/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ju4tCode) | `17.82% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ju4tCode#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.