Skip to content

Add array notation to GitHub Import representation objects

What does this MR do and why?

This is the second of a series of merge requests to convert Octokit returned objects into a hash before using it in the codebase in order to rely less on Sawyer::Resource objects

Representation objects allow their properties to be accessed using dot notation like Sawyer Resources that are used by Octokit, which allows methods in GitHub Import to receive as a parameter a representation object or a Sawyer resource object.

Because Sawyer Resource objects will be converted to a hash in future changes, this change makes representation objects also to support the array notation. So now, methods in GitHub Import will be able to receive representation objects, Sawyer Resource, or hashes as parameters.

👣 Note: This change is just adding the array method, following MRs will start using it. The main idea to deploy this change without any other change is to make it easy to review and allow ongoing MRs changing GitHub Import to use the array notation.

Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/372472

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Create a new project, and choose to import from Github
  2. Provide your personal access token
  3. Then you should see a list of repositories
  4. Select one and import it
  5. Check if everything is imported

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rodrigo Tomonari

Merge request reports