Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Create a Pull Request Review: "comments" parameter type should be "object[]" #58

Closed
gr2m opened this issue Mar 27, 2018 · 2 comments · Fixed by #86
Closed

Create a Pull Request Review: "comments" parameter type should be "object[]" #58

gr2m opened this issue Mar 27, 2018 · 2 comments · Fixed by #86
Labels
bug Something isn't working as documented, or is being fixed

Comments

@gr2m
Copy link
Contributor

gr2m commented Mar 27, 2018

Current specification

{
"name": "Create a pull request review",
"enabledForApps": true,
"method": "POST",
"path": "/repos/:owner/:repo/pulls/:number/reviews",
"params": [
{
"name": "owner",
"type": "string",
"required": true,
"description": ""
},
{
"name": "repo",
"type": "string",
"required": true,
"description": ""
},
{
"name": "number",
"type": "number",
"required": true,
"description": ""
},
{
"name": "commit_id",
"type": "string",
"description": "The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the `position`. Defaults to the most recent commit in the pull request when you do not specify a value.",
"required": false
},
{
"name": "body",
"type": "string",
"description": "**Required** when using `REQUEST_CHANGES` or `COMMENT` for the `event` parameter. The body text of the pull request review.",
"required": false
},
{
"name": "event",
"type": "string",
"description": "The review action you want to perform. The review actions include: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`. By leaving this blank, you set the review action state to `PENDING`, which means you will need to [submit the pull request review](/v3/pulls/reviews/#submit-a-pull-request-review) when you are ready.",
"required": false
},
{
"name": "comments",
"type": "array of draft review comment objects",
"description": "Use the following table to specify the location, destination, and contents of the draft review comment.",
"required": false
},
{
"name": "comments.path",
"type": "string",
"description": "**Required.** The relative path to the file that necessitates a review comment.",
"required": false
},
{
"name": "comments.position",
"type": "integer",
"description": "**Required.** The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below.",
"required": false
},
{
"name": "comments.body",
"type": "string",
"description": "**Required.** Text of the review comment.",
"required": false
}
],
"description": "**Note:** To comment on a specific line in a file, you need to first determine the _position_ of that line in the diff. The GitHub REST API v3 offers the `application/vnd.github.v3.diff` [media type](/v3/media/#commits-commit-comparison-and-pull-requests). To see a pull request diff, add this media type to the `Accept` header of a call to the [single pull request](/v3/pulls/#get-a-single-pull-request) endpoint.\n\nThe `position` value equals the number of lines down from the first \"@@\" hunk header in the file you want to add a comment. The line just below the \"@@\" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.",
"documentationUrl": "https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review"
}

I expected

object[]
{
  "name": "Create a pull request review",
  "enabledForApps": true,
  "method": "POST",
  "path": "/repos/:owner/:repo/pulls/:number/reviews",
  "params": [
    {
      "name": "owner",
      "type": "string",
      "required": true,
      "description": ""
    },
    {
      "name": "repo",
      "type": "string",
      "required": true,
      "description": ""
    },
    {
      "name": "number",
      "type": "number",
      "required": true,
      "description": ""
    },
    {
      "name": "commit_id",
      "type": "string",
      "description": "The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the `position`. Defaults to the most recent commit in the pull request when you do not specify a value.",
      "required": false
    },
    {
      "name": "body",
      "type": "string",
      "description": "**Required** when using `REQUEST_CHANGES` or `COMMENT` for the `event` parameter. The body text of the pull request review.",
      "required": false
    },
    {
      "name": "event",
      "type": "string",
      "description": "The review action you want to perform. The review actions include: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`. By leaving this blank, you set the review action state to `PENDING`, which means you will need to [submit the pull request review](/v3/pulls/reviews/#submit-a-pull-request-review) when you are ready.",
      "required": false
    },
    {
      "name": "comments",
      "type": "object[]",
      "description": "Use the following table to specify the location, destination, and contents of the draft review comment.",
      "required": false
    },
    {
      "name": "comments.path",
      "type": "string",
      "description": "**Required.** The relative path to the file that necessitates a review comment.",
      "required": false
    },
    {
      "name": "comments.position",
      "type": "integer",
      "description": "**Required.** The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below.",
      "required": false
    },
    {
      "name": "comments.body",
      "type": "string",
      "description": "**Required.** Text of the review comment.",
      "required": false
    }
  ],
  "description": "**Note:** To comment on a specific line in a file, you need to first determine the _position_ of that line in the diff. The GitHub REST API v3 offers the `application/vnd.github.v3.diff` [media type](/v3/media/#commits-commit-comparison-and-pull-requests). To see a pull request diff, add this media type to the `Accept` header of a call to the [single pull request](/v3/pulls/#get-a-single-pull-request) endpoint.\n\nThe `position` value equals the number of lines down from the first \"@@\" hunk header in the file you want to add a comment. The line just below the \"@@\" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.",
  "documentationUrl": "https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review"
}

Has failing test at #69, help wanted

@gr2m gr2m added the bug Something isn't working as documented, or is being fixed label Mar 27, 2018
@gr2m gr2m mentioned this issue Mar 27, 2018
@gr2m gr2m self-assigned this Mar 27, 2018
@gr2m gr2m added has-failing-test help wanted Contributions appreciated good first issue Good for contributors new to Octokit and removed good first issue Good for contributors new to Octokit labels Mar 27, 2018
@gr2m gr2m removed their assignment Mar 27, 2018
@polinabythebay
Copy link
Contributor

I'm interested in this! I opened a pr to fix: #86

@gr2m gr2m removed the help wanted Contributions appreciated label Mar 29, 2018
@gr2m
Copy link
Contributor Author

gr2m commented Mar 29, 2018

all yours :)

@gr2m gr2m changed the title Create a Pull Request Review: "comments" parameter type should be "objects[]" Create a Pull Request Review: "comments" parameter type should be "object[]" Mar 30, 2018
@gr2m gr2m closed this as completed in #86 Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working as documented, or is being fixed
Projects
None yet
2 participants