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

Bug: `TeamOrganization` company and email may be null #31

Closed brock-greman-driscolls closed 1 year ago

brock-greman-driscolls commented 1 year ago

Any time I try to access the parsed_data field on various responses, I receive a pydantic validation error, I believe because the org data is missing a value for company and email. These values are null in the REST API response for orgs/<org_name>.

For example:

test_team_resp = ghkapi.rest.teams.get_by_name(org=ORG_NAME, team_slug="DevSecOps")
test_team = resp.parsed_data

Gives:

pydantic.error_wrappers.ValidationError: 2 validation errors for ParsingModel[TeamFull]
__root__ -> organization -> company
  none is not an allowed value (type=type_error.none.not_allowed)
__root__ -> organization -> email
  none is not an allowed value (type=type_error.none.not_allowed)
yanyongyu commented 1 year ago

This may be an error in github's schema. You may report the issue to https://github.com/github/rest-api-description with detailed info, and i will make a schema patch after that.

team-organization:
  title: Team Organization
  description: Team Organization
  type: object
  properties:
    company:
      type: string
      examples:
      - GitHub
    email:
      type: string
      format: email
      examples:
      - octocat@github.com
brock-greman-driscolls commented 1 year ago

https://github.com/github/rest-api-description/issues/2507