|
| 1 | +openapi: 3.0.0 |
| 2 | +info: |
| 3 | + title: Link Example |
| 4 | + version: 1.0.0 |
| 5 | +paths: |
| 6 | + /2.0/users/{username}: |
| 7 | + get: |
| 8 | + operationId: getUserByName |
| 9 | + parameters: |
| 10 | + - name: username |
| 11 | + in: path |
| 12 | + required: true |
| 13 | + schema: |
| 14 | + type: string |
| 15 | + responses: |
| 16 | + '200': |
| 17 | + description: The User |
| 18 | + content: |
| 19 | + application/json: |
| 20 | + schema: |
| 21 | + $ref: '#/components/schemas/user' |
| 22 | + links: |
| 23 | + userRepositories: |
| 24 | + $ref: '#/components/links/UserRepositories' |
| 25 | + /2.0/repositories/{username}: |
| 26 | + get: |
| 27 | + operationId: getRepositoriesByOwner |
| 28 | + parameters: |
| 29 | + - name: username |
| 30 | + in: path |
| 31 | + required: true |
| 32 | + schema: |
| 33 | + type: string |
| 34 | + responses: |
| 35 | + '200': |
| 36 | + description: repositories owned by the supplied user |
| 37 | + content: |
| 38 | + application/json: |
| 39 | + schema: |
| 40 | + type: array |
| 41 | + items: |
| 42 | + $ref: '#/components/schemas/repository' |
| 43 | + links: |
| 44 | + userRepository: |
| 45 | + $ref: '#/components/links/UserRepository' |
| 46 | + /2.0/repositories/{username}/{slug}: |
| 47 | + get: |
| 48 | + operationId: getRepository |
| 49 | + parameters: |
| 50 | + - name: username |
| 51 | + in: path |
| 52 | + required: true |
| 53 | + schema: |
| 54 | + type: string |
| 55 | + - name: slug |
| 56 | + in: path |
| 57 | + required: true |
| 58 | + schema: |
| 59 | + type: string |
| 60 | + responses: |
| 61 | + '200': |
| 62 | + description: The repository |
| 63 | + content: |
| 64 | + application/json: |
| 65 | + schema: |
| 66 | + $ref: '#/components/schemas/repository' |
| 67 | + links: |
| 68 | + repositoryPullRequests: |
| 69 | + $ref: '#/components/links/RepositoryPullRequests' |
| 70 | + /2.0/repositories/{username}/{slug}/pullrequests: |
| 71 | + get: |
| 72 | + operationId: getPullRequestsByRepository |
| 73 | + parameters: |
| 74 | + - name: username |
| 75 | + in: path |
| 76 | + required: true |
| 77 | + schema: |
| 78 | + type: string |
| 79 | + - name: slug |
| 80 | + in: path |
| 81 | + required: true |
| 82 | + schema: |
| 83 | + type: string |
| 84 | + - name: state |
| 85 | + in: query |
| 86 | + schema: |
| 87 | + type: string |
| 88 | + enum: |
| 89 | + - open |
| 90 | + - merged |
| 91 | + - declined |
| 92 | + responses: |
| 93 | + '200': |
| 94 | + description: an array of pull request objects |
| 95 | + content: |
| 96 | + application/json: |
| 97 | + schema: |
| 98 | + type: array |
| 99 | + items: |
| 100 | + $ref: '#/components/schemas/pullrequest' |
| 101 | + /2.0/repositories/{username}/{slug}/pullrequests/{pid}: |
| 102 | + get: |
| 103 | + operationId: getPullRequestsById |
| 104 | + parameters: |
| 105 | + - name: username |
| 106 | + in: path |
| 107 | + required: true |
| 108 | + schema: |
| 109 | + type: string |
| 110 | + - name: slug |
| 111 | + in: path |
| 112 | + required: true |
| 113 | + schema: |
| 114 | + type: string |
| 115 | + - name: pid |
| 116 | + in: path |
| 117 | + required: true |
| 118 | + schema: |
| 119 | + type: string |
| 120 | + responses: |
| 121 | + '200': |
| 122 | + description: a pull request object |
| 123 | + content: |
| 124 | + application/json: |
| 125 | + schema: |
| 126 | + $ref: '#/components/schemas/pullrequest' |
| 127 | + links: |
| 128 | + pullRequestMerge: |
| 129 | + $ref: '#/components/links/PullRequestMerge' |
| 130 | + /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: |
| 131 | + post: |
| 132 | + operationId: mergePullRequest |
| 133 | + parameters: |
| 134 | + - name: username |
| 135 | + in: path |
| 136 | + required: true |
| 137 | + schema: |
| 138 | + type: string |
| 139 | + - name: slug |
| 140 | + in: path |
| 141 | + required: true |
| 142 | + schema: |
| 143 | + type: string |
| 144 | + - name: pid |
| 145 | + in: path |
| 146 | + required: true |
| 147 | + schema: |
| 148 | + type: string |
| 149 | + responses: |
| 150 | + '204': |
| 151 | + description: the PR was successfully merged |
| 152 | +components: |
| 153 | + links: |
| 154 | + UserRepositories: |
| 155 | + # returns array of '#/components/schemas/repository' |
| 156 | + operationId: getRepositoriesByOwner |
| 157 | + parameters: |
| 158 | + username: $response.body#/username |
| 159 | + UserRepository: |
| 160 | + # returns '#/components/schemas/repository' |
| 161 | + operationId: getRepository |
| 162 | + parameters: |
| 163 | + username: $response.body#/owner/username |
| 164 | + slug: $response.body#/slug |
| 165 | + RepositoryPullRequests: |
| 166 | + # returns '#/components/schemas/pullrequest' |
| 167 | + operationId: getPullRequestsByRepository |
| 168 | + parameters: |
| 169 | + username: $response.body#/owner/username |
| 170 | + slug: $response.body#/slug |
| 171 | + PullRequestMerge: |
| 172 | + # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge |
| 173 | + operationId: mergePullRequest |
| 174 | + parameters: |
| 175 | + username: $response.body#/author/username |
| 176 | + slug: $response.body#/repository/slug |
| 177 | + pid: $response.body#/id |
| 178 | + schemas: |
| 179 | + user: |
| 180 | + type: object |
| 181 | + properties: |
| 182 | + username: |
| 183 | + type: string |
| 184 | + uuid: |
| 185 | + type: string |
| 186 | + repository: |
| 187 | + type: object |
| 188 | + properties: |
| 189 | + slug: |
| 190 | + type: string |
| 191 | + owner: |
| 192 | + $ref: '#/components/schemas/user' |
| 193 | + pullrequest: |
| 194 | + type: object |
| 195 | + properties: |
| 196 | + id: |
| 197 | + type: integer |
| 198 | + title: |
| 199 | + type: string |
| 200 | + repository: |
| 201 | + $ref: '#/components/schemas/repository' |
| 202 | + author: |
| 203 | + $ref: '#/components/schemas/user' |
0 commit comments