Skip to content

Record responses for all endpoints #204

@gr2m

Description

@gr2m

We want to explore how to record responses for all endpoints of GitHub’s REST API.

Here is how I would approach this. My work-in-progress lives at gr2m/github-rest-api-responses

  • Use @octokit/routes to generate a list of requests that would need to be sent. Use preview headers where they are required
    (There are 508 requests for api.github.com as of March 18)
  • Figure out required setups for each request. E.g. for "Add labels to issues" the setup would be
    1. Create repository
    2. Create issue
    3. Create label
      Then after the "Add labels to issues" request was recorded, delete the temporary repository again.
      We might be able to use the route path as an indication of the "hierarchy of requests", meaning what setup is needed to record a certain request.
  • Once we have the list requests together with necessary setups, we have to create user accounts and other resources need to send the requests, e.g. an organization and apps.
  • Run the requests, record the responses, referencing the routes recorded in @ocotkit/routes so the two can be combined easily.

The endpoint responses would differ from the current scenarios as they would all be a single request/response.

Improvements

  • Record response with all preview headers enabled for the endpoint.
  • Normalize responses like we do in @octokit/fixtures
  • Bonus: Once responses are normalized, we could add the responses to @octokit/fixtures for testing
  • Reuse setups to record requests. E.g. when recording "create an issue", that setup can be used for "get an issue" and many others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: MaintenanceAny dependency, housekeeping, and clean up Issue or PRproject

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions