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
204 stars 25 forks source link

Schema error when creating check run #148

Closed fau-st closed 1 month ago

fau-st commented 1 month ago

Hello,

With version 0.11.12 it seems that creating a check run is no longer possible:

gh.rest.checks.create(
    owner='owner',
    repo='repo',
    name='name',
    head_sha='0000000000000000000000000000000000000000',
    status='in_progress',
)

:arrow_down:

pydantic.errors.PydanticUserError: Model 'ReposOwnerRepoCheckRunsPostBodyOneof1' needs field 'status' to be of type `Literal`

It looks like it's related to the changes made to githubkit/versions/v2022_11_28/rest/checks.py but I'm not sure why it was modified.

yanyongyu commented 1 month ago

This error is also caused by upstream schema changes. GitHub added a discriminator to this api's body description. The discriminator points to the status field, but one of the schema's status field is not required. This causes pydantic raises an error. A schema patch is needed to fix this.

yanyongyu commented 1 month ago

It seems this upstream schema change also caused another error. The status field's allowed value list is also overrided by the oneOf.