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

PushEvent payload data does not exist on types.d.ts #232

Open
patrickelectric opened this issue Aug 28, 2022 · 2 comments
Open

PushEvent payload data does not exist on types.d.ts #232

patrickelectric opened this issue Aug 28, 2022 · 2 comments
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Bug Something isn't working as documented
Projects

Comments

@patrickelectric
Copy link

Code:
image

export type GitHubEvent = GetResponseDataTypeFromEndpointMethod<typeof octokit.activity.listPublicEventsForUser>[0];

const iterator = octokit.paginate.iterator(octokit.rest.activity.listPublicEventsForUser, {
  username: user,
  per_page: 100,
})
events = []
for await (const item of iterator) {
  events = this.events.concat(item.data)
}

JsonContent of event object:

"payload": {
  "push_id": 10843997312,
  "size": 1,
  "distinct_size": 1,
  "ref": "refs/heads/master",
  "head": "c73a84db441fdd656d90be5172e41b3eaa69a356",
  "before": "cc3d1a380867a6b30a1520526c4be8f20fc52a69",
  "commits": ...

types.d.ts
image

@ghost ghost added this to Inbox in JS Aug 28, 2022
@oscard0m
Copy link
Member

Hi @patrickelectric,

Thanks for reporting the issue and taking the time to provide a detailed explanation with payload examples.

Checking GitHub API Documentation for 'List public events for a User' I can see the payload response example with the "payload" you are mentioning in your Issue Description:

image

But the JSON schema for the response seems to not be aligned with it. I only see:

 "action": ...,
 "issue": ...,
 "comment": ...,
  "pages": ...

Checking GitHub's REST API OpenAPI Description, where Octokit extracts all the typing from, I see the JSON Schema like that:

"payload": {
    "type": "object",
    "properties": {
      "action": {
        "type": "string"
      },
      "issue": {
        "$ref": "#/components/schemas/issue"
      },
      "comment": {
        "$ref": "#/components/schemas/issue-comment"
      },
      "pages": {
        "type": "array",
        ...
      }

Link to the file and line. Because the size is quite large, GitHub is not capable of rendering it in their web viewer so you will have to download it or clone their repo.


Seems to be something to report to GitHub Open API Descritpion. what do you think? @timrogers @nickfloyd @wolfy1339

@wolfy1339
Copy link
Member

This is actually a known issue.
There's an issue opened for it already 😉 octokit/rest.js#128
github/rest-api-description#1318

@wolfy1339 wolfy1339 added Type: Bug Something isn't working as documented Status: Blocked Some technical or requirement is blocking the issue labels Aug 28, 2022
@ghost ghost moved this from Inbox to Blocked in JS Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Bug Something isn't working as documented
Projects
No open projects
JS
  
Blocked
Development

No branches or pull requests

3 participants