From 0bb8adc3aa66f7c65ed5702bedc902f674203670 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Tue, 12 Jan 2021 16:11:03 +0100 Subject: [PATCH 1/8] Add OpenAPI documentation for request index endpoint --- src/api/public/apidocs-new/OBS-v2.10.50.yaml | 6 + .../components/parameters/request.yaml | 74 +++++++ .../schemas/request/collection.yaml | 13 ++ .../components/schemas/request/request.yaml | 196 ++++++++++++++++++ src/api/public/apidocs-new/paths/request.yaml | 23 ++ .../paths/request_request_collection.yaml | 52 +++++ 6 files changed, 364 insertions(+) create mode 100644 src/api/public/apidocs-new/components/parameters/request.yaml create mode 100644 src/api/public/apidocs-new/components/schemas/request/collection.yaml create mode 100644 src/api/public/apidocs-new/components/schemas/request/request.yaml create mode 100644 src/api/public/apidocs-new/paths/request.yaml create mode 100644 src/api/public/apidocs-new/paths/request_request_collection.yaml diff --git a/src/api/public/apidocs-new/OBS-v2.10.50.yaml b/src/api/public/apidocs-new/OBS-v2.10.50.yaml index 5ec0e4e2e26..7f51b6e2bb3 100644 --- a/src/api/public/apidocs-new/OBS-v2.10.50.yaml +++ b/src/api/public/apidocs-new/OBS-v2.10.50.yaml @@ -10,6 +10,7 @@ tags: - name: Person - name: Attribute Namespaces - name: Attributes + - name: Request info: description: Open Build Service API @@ -61,6 +62,11 @@ paths: /person/{login}/token: $ref: 'paths/person_login_token.yaml' + /request: + $ref: 'paths/request.yaml' + /request?view=collection: + $ref: 'paths/request_request_collection.yaml' + components: securitySchemes: basic_authentication: diff --git a/src/api/public/apidocs-new/components/parameters/request.yaml b/src/api/public/apidocs-new/components/parameters/request.yaml new file mode 100644 index 00000000000..f4b3190eef7 --- /dev/null +++ b/src/api/public/apidocs-new/components/parameters/request.yaml @@ -0,0 +1,74 @@ +User: + in: query + name: user + schema: + type: string + description: | + Filter the results of requests and open reviews for a certain user. If no other parameters are + applied, it will include requests where the user is maintainer of the target or the creator of + the request. + example: hans +Project: + in: query + name: project + schema: + type: string + description: Limit the results of requests and open review requests to the specified target project. + example: home:hans +Package: + in: query + name: package + schema: + type: string + description: Limit the results of requests and open review requests to the specified target package. + example: ruby +States: + in: query + name: states + schema: + type: string + description: Limit results to a given request state. Multiple states can be provided as a comma separated list. + example: new,review +Types: + in: query + name: types + schema: + type: string + description: Limit the results to certain action types. Multiple types can be provided as a comma separated list. + example: add_role,submit +Roles: + in: query + name: roles + schema: + type: string + description: Limit the results to a given role. Multiple roles can be provided as a comma separated list. + example: + creator,maintainer,reviewer,source,target +WithHistory: + in: query + name: withhistory + schema: + type: string + description: Include the request history in the results. + example: 1 +WithFullHistory: + in: query + name: withfullhistory + schema: + type: string + description: Includes both, request and review history in the results. + example: 1 +Limit: + in: query + name: limit + schema: + type: integer + description: Limit the results to the specified amount of requests. + example: 7 +Ids: + in: query + name: ids + schema: + type: string + description: Limit the result to specified request id's. Multiple id's can be provided as a comma separated list. + example: 15,19,23 diff --git a/src/api/public/apidocs-new/components/schemas/request/collection.yaml b/src/api/public/apidocs-new/components/schemas/request/collection.yaml new file mode 100644 index 00000000000..73e0582a4f3 --- /dev/null +++ b/src/api/public/apidocs-new/components/schemas/request/collection.yaml @@ -0,0 +1,13 @@ +type: object +properties: + matches: + type: string + example: 7 + xml: + attribute: true + request: + type: array + items: + $ref: './request.yaml' +xml: + name: 'collection' diff --git a/src/api/public/apidocs-new/components/schemas/request/request.yaml b/src/api/public/apidocs-new/components/schemas/request/request.yaml new file mode 100644 index 00000000000..0cad69865bb --- /dev/null +++ b/src/api/public/apidocs-new/components/schemas/request/request.yaml @@ -0,0 +1,196 @@ +type: object +properties: + id: + type: integer + example: 42 + xml: + attribute: true + creator: + type: string + example: foo-user + xml: + attribute: true + action: + type: object + properties: + type: + type: string + example: submit + xml: + attribute: true + source: + type: object + properties: + project: + type: string + example: home:foo-user + xml: + attribute: true + package: + type: string + example: obs-server + xml: + attribute: true + rev: + type: integer + example: 521 + xml: + attribute: true + target: + type: object + properties: + project: + type: string + example: OBS:Unstable + xml: + attribute: true + package: + type: string + example: obs-server + xml: + attribute: true + options: + type: object + properties: + sourceupdate: + type: string + example: cleanup + state: + type: object + properties: + name: + type: string + example: accepted + xml: + attribute: true + who: + type: string + example: bar-user + xml: + attribute: true + when: + type: string + example: '2021-01-15T13:39:43' + xml: + attribute: true + comment: + type: string + example: allright + review: + type: array + items: + anyOf: + - type: object + properties: + state: + type: string + example: accepted + xml: + attribute: true + when: + type: string + example: '2021-01-15T15:49:32' + xml: + attribute: true + who: + type: string + example: obs-maintainer + xml: + attribute: true + by_user: + type: string + example: obs-maintainer + xml: + attribute: true + - type: object + properties: + state: + type: string + example: accepted + xml: + attribute: true + when: + type: string + example: '2021-01-15T15:49:32' + xml: + attribute: true + who: + type: string + example: obs-maintainer + xml: + attribute: true + by_group: + type: string + example: obs-group + xml: + attribute: true + - type: object + properties: + state: + type: string + example: accepted + xml: + attribute: true + when: + type: string + example: '2021-01-15T15:49:32' + xml: + attribute: true + who: + type: string + example: obs-maintainer + xml: + attribute: true + by_project: + type: string + example: OBS:Unstable + xml: + attribute: true + - type: object + properties: + state: + type: string + example: accepted + xml: + attribute: true + when: + type: string + example: '2021-01-15T15:49:32' + xml: + attribute: true + who: + type: string + example: obs-maintainer + xml: + attribute: true + by_package: + type: string + example: obs-server + xml: + attribute: true + history: + type: array + items: + type: object + properties: + who: + type: string + example: foo + xml: + attribute: true + when: + type: string + example: '2021-01-15T13:39:43' + xml: + attribute: true + description: + type: string + example: Request created + comment: + type: string + example: Please review sources + description: + type: string + example: A little version update +xml: + name: request diff --git a/src/api/public/apidocs-new/paths/request.yaml b/src/api/public/apidocs-new/paths/request.yaml new file mode 100644 index 00000000000..b0fba1871eb --- /dev/null +++ b/src/api/public/apidocs-new/paths/request.yaml @@ -0,0 +1,23 @@ +get: + summary: Get a simple directory listing of all requests + description: Get a simple directory listing of all requests + security: + - basic_authentication: [] + responses: + '200': + description: | + OK + + XML Schema used for body validation: [directory.xsd](../schema/directory.xsd) + content: + application/xml: + schema: + $ref: '../components/schemas/directory.yaml' + example: + entry: + - name: 122 + - name: 123 + '401': + $ref: '../components/responses/unauthorized.yaml' + tags: + - Request diff --git a/src/api/public/apidocs-new/paths/request_request_collection.yaml b/src/api/public/apidocs-new/paths/request_request_collection.yaml new file mode 100644 index 00000000000..35b2fd5d4b5 --- /dev/null +++ b/src/api/public/apidocs-new/paths/request_request_collection.yaml @@ -0,0 +1,52 @@ +get: + summary: Get a collection of requests for a specified target + description: | + Get a collection of requests for a specified target. **NOTE:** + You need to set at least one of the following parameters in order + to use this endpoint: + + * `user` + * `project` + * `package` + * `states` + * `types` + * `ids` + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/User' + - $ref: '../components/parameters/request.yaml#/Project' + - $ref: '../components/parameters/request.yaml#/Package' + - $ref: '../components/parameters/request.yaml#/States' + - $ref: '../components/parameters/request.yaml#/Types' + - $ref: '../components/parameters/request.yaml#/Roles' + - $ref: '../components/parameters/request.yaml#/WithHistory' + - $ref: '../components/parameters/request.yaml#/WithFullHistory' + - $ref: '../components/parameters/request.yaml#/Limit' + - $ref: '../components/parameters/request.yaml#/Ids' + responses: + '200': + description: OK + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/request/collection.yaml' + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + examples: + Require Filter: + value: + code: require_filter + summary: This call requires at least one filter, either by user, project or package or states or types or reviewstates + Not Found: + value: + code: not_found + summary: Couldn't find User with login = foo + tags: + - Request From 12311b12d72eeb6b2346a5d0970ada8c31222344 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Thu, 14 Jan 2021 15:59:56 +0100 Subject: [PATCH 2/8] Add OpenAPI documentation for request show endpoint --- src/api/public/apidocs-new/OBS-v2.10.50.yaml | 2 ++ .../components/parameters/request.yaml | 8 ++++++ .../components/responses/request.yaml | 8 ++++++ .../apidocs-new/paths/request_request_id.yaml | 25 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 src/api/public/apidocs-new/components/responses/request.yaml create mode 100644 src/api/public/apidocs-new/paths/request_request_id.yaml diff --git a/src/api/public/apidocs-new/OBS-v2.10.50.yaml b/src/api/public/apidocs-new/OBS-v2.10.50.yaml index 7f51b6e2bb3..2bd2263cea7 100644 --- a/src/api/public/apidocs-new/OBS-v2.10.50.yaml +++ b/src/api/public/apidocs-new/OBS-v2.10.50.yaml @@ -66,6 +66,8 @@ paths: $ref: 'paths/request.yaml' /request?view=collection: $ref: 'paths/request_request_collection.yaml' + /request/{id}: + $ref: 'paths/request_request_id.yaml' components: securitySchemes: diff --git a/src/api/public/apidocs-new/components/parameters/request.yaml b/src/api/public/apidocs-new/components/parameters/request.yaml index f4b3190eef7..96e8401b97a 100644 --- a/src/api/public/apidocs-new/components/parameters/request.yaml +++ b/src/api/public/apidocs-new/components/parameters/request.yaml @@ -72,3 +72,11 @@ Ids: type: string description: Limit the result to specified request id's. Multiple id's can be provided as a comma separated list. example: 15,19,23 +RequestId: + in: path + name: id + schema: + type: integer + required: true + description: Id of the choosen request. + example: 743 diff --git a/src/api/public/apidocs-new/components/responses/request.yaml b/src/api/public/apidocs-new/components/responses/request.yaml new file mode 100644 index 00000000000..75f54745cf8 --- /dev/null +++ b/src/api/public/apidocs-new/components/responses/request.yaml @@ -0,0 +1,8 @@ +description: | + OK. + + XML Schema used for body validation: [request.rng](../schema/request.rng) +content: + application/xml; charset=utf-8: + schema: + $ref: '../schemas/request/request.yaml' diff --git a/src/api/public/apidocs-new/paths/request_request_id.yaml b/src/api/public/apidocs-new/paths/request_request_id.yaml new file mode 100644 index 00000000000..aa696dd7eac --- /dev/null +++ b/src/api/public/apidocs-new/paths/request_request_id.yaml @@ -0,0 +1,25 @@ +get: + summary: Show details about a specified request. + description: Show details about a specified request. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + - $ref: '../components/parameters/request.yaml#/WithHistory' + - $ref: '../components/parameters/request.yaml#/WithFullHistory' + responses: + '200': + $ref: '../components/responses/request.yaml' + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: not_found + summary: Couldn't find request with id '5' + tags: + - Request From efc4a8cfafcd25f510f1c494aeb4f079f5f94e4d Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Thu, 14 Jan 2021 19:08:21 +0100 Subject: [PATCH 3/8] Add OpenAPI documentation for request global_command endpoint --- src/api/public/apidocs-new/paths/request.yaml | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/src/api/public/apidocs-new/paths/request.yaml b/src/api/public/apidocs-new/paths/request.yaml index b0fba1871eb..48833954345 100644 --- a/src/api/public/apidocs-new/paths/request.yaml +++ b/src/api/public/apidocs-new/paths/request.yaml @@ -10,7 +10,7 @@ get: XML Schema used for body validation: [directory.xsd](../schema/directory.xsd) content: - application/xml: + application/xml; charset=utf-8: schema: $ref: '../components/schemas/directory.yaml' example: @@ -21,3 +21,75 @@ get: $ref: '../components/responses/unauthorized.yaml' tags: - Request + +post: + summary: Create a request + description: Create a request + security: + - basic_authentication: [] + parameters: + - in: query + name: cmd + required: true + schema: + type: string + enum: + - create + description: This endpoint will refuse the creation of a new request if this parameter is not set. + - in: query + name: addrevision + schema: + type: string + enum: + - 1 + description: Ask the server to add revisions of the current sources to the request. + - in: query + name: ignore_delegate + schema: + type: string + enum: + - 1 + description: Enforce a new package instance in a project which has OBS:DelegateRequestTarget set + - in: query + name: ignore_build_state + schema: + type: string + enum: + - 1 + description: Skip the build state check + requestBody: + description: | + Request XML + + **NOTE:** You cannot pass the request id in the xml. You can pass the history in the xml, but it will be simply ignored. + required: true + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/request/request.yaml' + responses: + '200': + $ref: '../components/responses/request.yaml' + '400': + description: Bad Request + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: expand_error + summary: The source of package test-project/test-package for revision 2 is broken + '401': + $ref: '../components/responses/unauthorized.yaml' + '403': + description: 'Forbidden' + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: create_bs_request_not_authorized + summary: You are not authorized to create this Bs request. + tags: + - Request + From dc3acc3e7ee3231066edbfb5bb7fdb59b3fe5504 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Fri, 15 Jan 2021 18:52:46 +0100 Subject: [PATCH 4/8] Add OpenAPI documentation for request diff endpoint --- src/api/public/apidocs-new/OBS-v2.10.50.yaml | 2 + .../components/schemas/request/diff.yaml | 178 ++++++++++++++++++ .../paths/request_id_cmd_diff.yaml | 61 ++++++ .../paths/request_request_diff.yaml | 63 +++++++ 4 files changed, 304 insertions(+) create mode 100644 src/api/public/apidocs-new/components/schemas/request/diff.yaml create mode 100644 src/api/public/apidocs-new/paths/request_id_cmd_diff.yaml create mode 100644 src/api/public/apidocs-new/paths/request_request_diff.yaml diff --git a/src/api/public/apidocs-new/OBS-v2.10.50.yaml b/src/api/public/apidocs-new/OBS-v2.10.50.yaml index 2bd2263cea7..7dc2d37faa4 100644 --- a/src/api/public/apidocs-new/OBS-v2.10.50.yaml +++ b/src/api/public/apidocs-new/OBS-v2.10.50.yaml @@ -68,6 +68,8 @@ paths: $ref: 'paths/request_request_collection.yaml' /request/{id}: $ref: 'paths/request_request_id.yaml' + /request/{id}?cmd=diff: + $ref: 'paths/request_request_diff.yaml' components: securitySchemes: diff --git a/src/api/public/apidocs-new/components/schemas/request/diff.yaml b/src/api/public/apidocs-new/components/schemas/request/diff.yaml new file mode 100644 index 00000000000..132c964c4fe --- /dev/null +++ b/src/api/public/apidocs-new/components/schemas/request/diff.yaml @@ -0,0 +1,178 @@ +type: object +properties: + id: + type: string + example: 12 + xml: + attribute: true + actions: + type: string + example: 0 + xml: + attribute: true + action: + type: object + properties: + type: + type: string + example: submit + xml: + attribute: true + source: + type: object + properties: + project: + type: string + example: 'home:Iggy:branches:home:Admin' + xml: + attribute: true + package: + type: string + example: ruby + xml: + attribute: true + rev: + type: string + example: 3 + xml: + attribute: true + target: + type: object + properties: + project: + type: string + example: 'home:Admin' + xml: + attribute: true + package: + type: string + example: ruby + xml: + attribute: true + options: + type: object + properties: + sourceupdate: + example: cleanup + type: string + sourcediff: + type: object + properties: + key: + type: string + example: '9dbe9eb1767c5e12c69839af893dc239' + xml: + attribute: true + old: + $ref: '#/components/schemas/NewOldDestination' + new: + $ref: '#/components/schemas/NewOldDestination' + files: + type: array + items: + type: object + properties: + file: + type: object + properties: + state: + type: string + example: changed + xml: + attribute: true + old: + $ref: '#/components/schemas/OldNewFile' + new: + $ref: '#/components/schemas/OldNewFile' + diff: + # FIXME: 'lines' attribute missing due to https://github.com/OAI/OpenAPI-Specification/issues/630 + type: string + example: | + spec files: + ----------- + --- test.spec + +++ test.spec + @@ -0,0 +1 @@ + +# NEW COMMENT + \ No newline at end of file + issues: + type: array + items: + type: object + properties: + issue: + type: object + properties: + state: + type: string + example: 'added' + xml: + attribute: true + tracker: + type: string + example: bnc + xml: + attribute: true + name: + type: string + example: 922894 + xml: + attribute: true + label: + type: string + example: 'boo#944302' + xml: + attribute: true + url: + type: string + example: 'https://bugzilla.opensuse.org/show_bug.cgi?id=944302' + xml: + attribute: true + +components: + schemas: + NewOldDestination: + type: object + properties: + project: + type: string + example: 'home:Iggy:branches:home:Admin' + xml: + attribute: true + package: + type: string + example: ruby + xml: + attribute: true + rev: + type: string + example: 3 + xml: + attribute: true + srcmd5: + type: string + example: '59300f4ba65f53334b2e2a39f87ba3a0' + xml: + attribute: true + + OldNewFile: + type: object + properties: + name: + type: string + example: 'ruby.spec' + xml: + attribute: true + md5: + type: string + example: 'd4f573d2bf9a0e306f87dad7eee0cf56' + xml: + attribute: true + size: + type: string + example: 70 + xml: + attribute: true +xml: + name: diff + diff --git a/src/api/public/apidocs-new/paths/request_id_cmd_diff.yaml b/src/api/public/apidocs-new/paths/request_id_cmd_diff.yaml new file mode 100644 index 00000000000..d3ec9f43141 --- /dev/null +++ b/src/api/public/apidocs-new/paths/request_id_cmd_diff.yaml @@ -0,0 +1,61 @@ +post: + summary: Get the diff for all packages affected by the request. + description: | + Get the diff for all packages affected by the request. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + - in: query + name: diff_to_superseded + type: integer + description: | + Diff relative to a given superseded request. State the id of the corresponding superseded request. + example: 10401 + - in: query + name: view + schema: + type: string + enum: + - xml + description: Set this parameter to xml in order to receive a structured diff instead of plain text. + - in: query + name: withissues + schema: + type: string + enum: + - true + - 1 + description: Include parsed issues + responses: + '200': + description: OK + content: + text/plain; charset=utf-8: + schema: + type: string + example: | + spec files: + ----------- + --- test.spec + +++ test.spec + @@ -0,0 +1 @@ + +# NEW COMMENT + \ No newline at end of file + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/request/diff.yaml' + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: not_found + summary: Couldn't find request with id '355' + tags: + - Request + diff --git a/src/api/public/apidocs-new/paths/request_request_diff.yaml b/src/api/public/apidocs-new/paths/request_request_diff.yaml new file mode 100644 index 00000000000..3af3c1a4571 --- /dev/null +++ b/src/api/public/apidocs-new/paths/request_request_diff.yaml @@ -0,0 +1,63 @@ +post: + summary: Get the diff for all packages affected by the request. + description: | + Get the diff for all packages affected by the request. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + - in: query + name: diff_to_superseded + type: integer + description: | + Diff relative to a given superseded request. State the id of the corresponding superseded request. + example: 10401 + - in: query + name: view + schema: + type: string + enum: + - xml + description: Set this parameter to xml in order to receive a structured diff instead of plain text. + - in: query + name: withissues + schema: + type: boolean + enum: + - true + - 1 + description: Include parsed issues + responses: + '200': + description: OK + content: + text/plain; charset=utf-8: + schema: + type: string + example: | + spec files: + ----------- + --- test.spec + +++ test.spec + @@ -0,0 +1 @@ + +# NEW COMMENT + \ No newline at end of file + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/request/diff.yaml' + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + examples: + not_found: + value: + code: not_found + summary: Couldn't find request with id '355' + tags: + - Request + From 76587ae659bf6a9fcd6e78a6bd0fcbb0f9bc6bcf Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Tue, 19 Jan 2021 14:23:34 +0100 Subject: [PATCH 5/8] Add OpenAPI documentation for request command endpoint --- .../apidocs-new/paths/request_request_id.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/src/api/public/apidocs-new/paths/request_request_id.yaml b/src/api/public/apidocs-new/paths/request_request_id.yaml index aa696dd7eac..5ac4da30dfd 100644 --- a/src/api/public/apidocs-new/paths/request_request_id.yaml +++ b/src/api/public/apidocs-new/paths/request_request_id.yaml @@ -23,3 +23,154 @@ get: summary: Couldn't find request with id '5' tags: - Request + +post: + summary: Apply certain actions on a specified request. + description: Apply certain actions on a specified request. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + - in: query + name: cmd + description: | + - `addreview`: + Add a review to a request. **NOTE:** You need to specify who has to address + the review by providing an additional paramter. Possible options are: + * by_user + * by_group + * by_project + + - `assignreview`: + Accept a review for a given group and assign a new review to a specific user. + **NOTE:** You need to pass the group name in the `by_group` parameter + and the new reviewer in the `reviewer` parameter. + + - `changestate`: Modify the state of a given request. + **NOTE:** You need to pass the new state throug the `newstate` parameter. Changing + from one state to another is in certain cases not allowed. You can still force + the operation by using the `force=1` parameter. + + - `changereviewstate`: + Change the state of a review inside a given request. + + - `setpriority`: + Change the priority of a given request. You have to pass the choosen priority through + the `priority` parameter. Possible values are: + * low + * moderate + * important + * critical + + - `setincident`: Change the target incident for maintenance_incident actions + **NOTE:** You need to provide the incident number through the `incident` + parameter. + + - `setacceptat`: Set or modify the accept_at time. Either specified by the `time` + parameter or by default set to now. + + - `approve`: Pre-approve a request in the review state. It will turn into state `accepted` + after the last review. + + - `cancelapproval`: Reset the approval of a request + schema: + type: string + style: form + explode: false + examples: + addreview: + value: cmd=addreview&by_group=heroes + assignreview: + value: cmd=assignreview&by_group=heroes&reviewer=foo + changestate: + value: cmd=changestate&newstate=accepted + changereviewstate: + value: cmd=changereviewstate&by_group=heroes&newstate=new&comment=reopened + setpriority: + value: cmd=setpriority&priority=low&comment=notsoimportant + setincident: + value: cmd=setincident&incident=12 + setacceptat: + value: cmd=setacceptat&time='2020-12-01%2000:00:00%20UTC' + approve: + value: cmd=approve + cancelapproval: + value: cmd=cancelapproval + - in: query + name: newstate + schema: + type: string + description: Define the new state + - in: query + name: priority + schema: + type: string + description: Define the new priority + - in: query + name: by_user + schema: + type: string + description: Specify the user of a new review + - in: query + name: by_group + schema: + type: string + description: Specify the group of the new review + - in: query + name: by_project + schema: + type: string + description: Specify the project of the new review + - in: query + name: by_package + schema: + type: string + description: Specify the package of the new review + - in: query + name: incident + schema: + type: string + description: Specify the incident number for `setincident` + - in: query + name: time + schema: + type: string + description: Specify the time for `setacceptat` + - in: query + name: comment + schema: + type: string + description: Add a comment to one of the actions + responses: + '200': + $ref: '../components/responses/succeeded.yaml' + '400': + description: Bad Request + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: no_maintenance_release_target + summary: | + Maintenance incident request contains release target project test_maintenance_project with + invalid project kind "standard" (should be "maintenance_release") for package package01 + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + examples: + Request Not Modifiable: + value: + code: request_not_modifiable + summary: request is not in review state + Not Found: + value: + code: not_found + summary: Couldn't find request with id '120' + tags: + - Request From 00ffb245b2ccd40af0d0d0f62544107eea936ff5 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Tue, 19 Jan 2021 15:13:00 +0100 Subject: [PATCH 6/8] Add OpenAPI documentation for request update endpoint --- .../apidocs-new/paths/request_request_id.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/api/public/apidocs-new/paths/request_request_id.yaml b/src/api/public/apidocs-new/paths/request_request_id.yaml index 5ac4da30dfd..08d6c2d0c8c 100644 --- a/src/api/public/apidocs-new/paths/request_request_id.yaml +++ b/src/api/public/apidocs-new/paths/request_request_id.yaml @@ -174,3 +174,51 @@ post: summary: Couldn't find request with id '120' tags: - Request + +put: + summary: Modify a given request. + description: | + Modify a given request. + + **NOTE:** Certain parts of a request can only be changed by admins. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + requestBody: + description: | + Request XML + + **NOTE:** You cannot pass the request id in the xml. You can pass the history in the xml, but it will be simply ignored. + + XML Schema used for body validation: [request.rng](../schema/request.rng) + required: true + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/request/request.yaml' + responses: + '200': + $ref: '../components/responses/request.yaml' + '400': + description: Bad Request + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: request_save_error + summary: Auto accept time is in the past + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: not_found + summary: Couldn't find request with id '10' + tags: + - Request From d10bc42caf01dc7bb4d150e2d8e79e13b4692267 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Tue, 19 Jan 2021 15:35:38 +0100 Subject: [PATCH 7/8] Add OpenAPI documentation for request delete endpoint --- .../apidocs-new/paths/request_request_id.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/api/public/apidocs-new/paths/request_request_id.yaml b/src/api/public/apidocs-new/paths/request_request_id.yaml index 08d6c2d0c8c..8247df99876 100644 --- a/src/api/public/apidocs-new/paths/request_request_id.yaml +++ b/src/api/public/apidocs-new/paths/request_request_id.yaml @@ -222,3 +222,27 @@ put: summary: Couldn't find request with id '10' tags: - Request + +delete: + summary: Delete a given request. + description: Delete a given request. + security: + - basic_authentication: [] + parameters: + - $ref: '../components/parameters/request.yaml#/RequestId' + responses: + '200': + $ref: '../components/responses/succeeded.yaml' + '401': + $ref: '../components/responses/unauthorized.yaml' + '404': + description: Not Found + content: + application/xml; charset=utf-8: + schema: + $ref: '../components/schemas/api_response.yaml' + example: + code: not_found + summary: Couldn't find request with id '10' + tags: + - Request From 2ce8d8bc9174d00172e62fb8eca0a28bb7880886 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Thu, 21 Jan 2021 13:53:25 +0100 Subject: [PATCH 8/8] Improve naming of files for request endpoints OpenAPI documentation --- src/api/public/apidocs-new/OBS-v2.10.50.yaml | 6 +- ...equest_request_id.yaml => request_id.yaml} | 0 .../paths/request_request_diff.yaml | 63 ------------------- ...tion.yaml => request_view_collection.yaml} | 0 4 files changed, 3 insertions(+), 66 deletions(-) rename src/api/public/apidocs-new/paths/{request_request_id.yaml => request_id.yaml} (100%) delete mode 100644 src/api/public/apidocs-new/paths/request_request_diff.yaml rename src/api/public/apidocs-new/paths/{request_request_collection.yaml => request_view_collection.yaml} (100%) diff --git a/src/api/public/apidocs-new/OBS-v2.10.50.yaml b/src/api/public/apidocs-new/OBS-v2.10.50.yaml index 7dc2d37faa4..f036cb761df 100644 --- a/src/api/public/apidocs-new/OBS-v2.10.50.yaml +++ b/src/api/public/apidocs-new/OBS-v2.10.50.yaml @@ -65,11 +65,11 @@ paths: /request: $ref: 'paths/request.yaml' /request?view=collection: - $ref: 'paths/request_request_collection.yaml' + $ref: 'paths/request_view_collection.yaml' /request/{id}: - $ref: 'paths/request_request_id.yaml' + $ref: 'paths/request_id.yaml' /request/{id}?cmd=diff: - $ref: 'paths/request_request_diff.yaml' + $ref: 'paths/request_id_cmd_diff.yaml' components: securitySchemes: diff --git a/src/api/public/apidocs-new/paths/request_request_id.yaml b/src/api/public/apidocs-new/paths/request_id.yaml similarity index 100% rename from src/api/public/apidocs-new/paths/request_request_id.yaml rename to src/api/public/apidocs-new/paths/request_id.yaml diff --git a/src/api/public/apidocs-new/paths/request_request_diff.yaml b/src/api/public/apidocs-new/paths/request_request_diff.yaml deleted file mode 100644 index 3af3c1a4571..00000000000 --- a/src/api/public/apidocs-new/paths/request_request_diff.yaml +++ /dev/null @@ -1,63 +0,0 @@ -post: - summary: Get the diff for all packages affected by the request. - description: | - Get the diff for all packages affected by the request. - security: - - basic_authentication: [] - parameters: - - $ref: '../components/parameters/request.yaml#/RequestId' - - in: query - name: diff_to_superseded - type: integer - description: | - Diff relative to a given superseded request. State the id of the corresponding superseded request. - example: 10401 - - in: query - name: view - schema: - type: string - enum: - - xml - description: Set this parameter to xml in order to receive a structured diff instead of plain text. - - in: query - name: withissues - schema: - type: boolean - enum: - - true - - 1 - description: Include parsed issues - responses: - '200': - description: OK - content: - text/plain; charset=utf-8: - schema: - type: string - example: | - spec files: - ----------- - --- test.spec - +++ test.spec - @@ -0,0 +1 @@ - +# NEW COMMENT - \ No newline at end of file - application/xml; charset=utf-8: - schema: - $ref: '../components/schemas/request/diff.yaml' - '401': - $ref: '../components/responses/unauthorized.yaml' - '404': - description: Not Found - content: - application/xml; charset=utf-8: - schema: - $ref: '../components/schemas/api_response.yaml' - examples: - not_found: - value: - code: not_found - summary: Couldn't find request with id '355' - tags: - - Request - diff --git a/src/api/public/apidocs-new/paths/request_request_collection.yaml b/src/api/public/apidocs-new/paths/request_view_collection.yaml similarity index 100% rename from src/api/public/apidocs-new/paths/request_request_collection.yaml rename to src/api/public/apidocs-new/paths/request_view_collection.yaml