Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PullRequestPropHead schema inconsistency: label and user may be null #56

Closed
frankie567 opened this issue Nov 8, 2023 · 4 comments · Fixed by #65 or #72
Closed

PullRequestPropHead schema inconsistency: label and user may be null #56

frankie567 opened this issue Nov 8, 2023 · 4 comments · Fixed by #65 or #72
Labels
bug Something isn't working Rest API schema schema related

Comments

@frankie567
Copy link
Contributor

Contrary to what GitHub schema states, the label and user fields may be null on PullRequestPropHead schema.

It happens when the underlying branch/repository of the pull request has been deleted. Example: https://api.github.com/repos/avelino/bottle-auth/pulls/15

It'll probably require to add another override in pyproject.toml.

@schelv
Copy link
Contributor

schelv commented Dec 19, 2023

@yanyongyu
This one does not appear to be fixed.
Still gives an error for

from githubkit import GitHub, TokenAuthStrategy

g = GitHub(TokenAuthStrategy(<token>))

prs = g.rest.pulls.get('avelino', 'bottle-auth', 15)
prs.parsed_data

@yanyongyu
Copy link
Owner

@schelv could you please provide the detailed error traceback? the githubkit you are using is the master version?

@schelv
Copy link
Contributor

schelv commented Dec 20, 2023

yes it's the master version.

Traceback (most recent call last):
  File "C:\Users\username\PycharmProjects\githubkit\test_bug.py", line 6, in <module>
    prs.parsed_data
  File "C:\Users\username\PycharmProjects\githubkit\githubkit\response.py", line 50, in parsed_data
    return TypeAdapter(self._data_model).validate_json(self.content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\PycharmProjects\githubkit\venv\Lib\site-packages\pydantic\type_adapter.py", line 256, in validate_json
    return self.validator.validate_json(__data, strict=strict, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for PullRequest
head.label
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
head.user
  Input should be an object [type=model_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/model_type

@yanyongyu
Copy link
Owner

I see... #65 only fix the PullRequestSimple and the PullRequest still has the wrong schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Rest API schema schema related
Projects
None yet
3 participants