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

Commit

Permalink
WIP: GET /repos/{owner}/{repo}/issues/{number}
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jun 18, 2018
1 parent fd19fad commit 9b2b2f6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
5 changes: 5 additions & 0 deletions openapi/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
"get": {
"$ref": "operations/issues/list-for-repo.json"
}
},
"/repos/{owner}/{repo}/issues/{number}": {
"get": {
"$ref": "operations/issues/get.json"
}
}
}
}
44 changes: 44 additions & 0 deletions openapi/operations/issues/get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"summary": "Get a single issue",
"description": "**Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, \"Issues\" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key.\n\nBe aware that the `id` of a pull request returned from \"Issues\" endpoints will be an _issue id_. To find out the pull request id, use the \"[List pull requests](https://developer.github.com/v3/pulls/#list-pull-requests)\" endpoint.",
"operationId": "get",
"tags": [
"issues"
],
"externalDocs": {
"description": "API method documentation",
"url": "https://developer.github.com/v3/issues/#get-a-single-issue"
},
"parameters": [{
"$ref": "../../parameters.json#/owner"
},
{
"$ref": "../../parameters.json#/repo"
},
{
"$ref": "../../parameters.json#/number"
}
],
"x-code-samples": [
{
"lang": "Shell",
"source": "curl https://api.github.com/repos/octocat/hello-world/issues/1"
},
{
"lang": "JS",
"source": "client.issues.get({\n owner: 'octocat',\n repo: 'hello-world',\n number: 1\n})"
}
],
"responses": {
"200": {
"description": "Issue",
"content": {
"application/json": {
"schema": {
"$ref": "../../schemas.json#/issue"
}
}
}
}
}
}
7 changes: 1 addition & 6 deletions openapi/operations/issues/list-for-repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"schema": {
"oneOf": [{
"type": "integer",
"format": "int32",
"minimum": 1
},
{
Expand Down Expand Up @@ -128,11 +127,7 @@
},
{
"lang": "JS",
"source": "client.issues.getForRepo({\n owner: 'octokat',\n repo: 'hello-world'\n})"
},
{
"lang": "JS (request)",
"source": "client.request('/repos/{owner}/{repo}/issues', {\n owner: 'octokat',\n repo: 'hello-world'\n})"
"source": "client.issues.getForRepo({\n owner: 'octocat',\n repo: 'hello-world'\n})"
}
],
"responses": {
Expand Down
12 changes: 10 additions & 2 deletions openapi/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@
"required": true,
"description": "Repository name"
},
"number": {
"name": "number",
"in": "path",
"schema": {
"type": "integer",
"minimum": 1
},
"required": true,
"description": "Issue number"
},
"per_page": {
"name": "per_page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 100,
"default": 30
Expand All @@ -34,7 +43,6 @@
"in": "query",
"schema": {
"type": "integer",
"format": "int32",

This comment has been minimized.

Copy link
@ryangribble

ryangribble Jun 18, 2018

how come these are being removed? I think something similar would be useful because alot of integers are actually int64's, alot of strings are actually date or datetime etc etc

This comment has been minimized.

Copy link
@gr2m

gr2m Jun 18, 2018

Author Contributor

I thought they would be required initially but they aren’t so I removed the to simplify. We can add them back, no problem. Can you think of integers that would need 64 bits in API?

This comment has been minimized.

Copy link
@ryangribble

ryangribble Jun 18, 2018

yes, we actually had a problem a while ago where one of the ID fields ( i think it was for commit statuses) actually exeeded Max(Int). In octokit.net we had to change from int to long. Im not sure of the internal github API structure and whether they use int32 or int64 or both etc. On my side im tempted to make everything a long "just in case" but if there is actual spec available that indicates which ones are 32 or 64bit, then obviously it's no trouble to match to that either

This comment has been minimized.

Copy link
@ryangribble

This comment has been minimized.

Copy link
@gr2m

gr2m Jun 18, 2018

Author Contributor

okay let me add it back for now so we don’t forget about it and review wether we will be able to generate it down the road

"minimum": 1,
"default": 1
},
Expand Down
3 changes: 3 additions & 0 deletions openapi/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@
"format": "date-time",
"nullable": true
},
"closed_by": {
"$ref": "#/user"
},
"created_at": {
"type": "string",
"format": "date-time"
Expand Down

0 comments on commit 9b2b2f6

Please sign in to comment.