Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[chore] fixing warnings and examples in relations api docs

Eric Schubert6ee6a32db53b
diff --git a/docs/api/apiv3/components/examples/relation_collection_response.yml b/docs/api/apiv3/components/examples/relation_collection_response.yml
new file mode 100644
index 00000000000..389b0947f67
--- /dev/null
+++ b/docs/api/apiv3/components/examples/relation_collection_response.yml
@@ -0,0 +1,50 @@
+# Example: Relation Collection
+---
+value:
+ _type: Collection
+ total: 40
+ count: 20
+ pageSize: 20
+ offset: 1
+ _embedded:
+ - _type: Relation
+ id: 650
+ name: duplicated by
+ type: duplicated
+ reverseType: duplicates
+ lag: null
+ description: Those are the same... stupid Stormtroopers!
+ _links:
+ self:
+ href: /api/v3/relations/650
+ updateImmediately:
+ href: /api/v3/relations/650
+ method: patch
+ delete:
+ href: /api/v3/relations/650
+ method: delete,
+ title: Remove relation
+ from:
+ href: /api/v3/work_packages/108
+ title: Destroy Rebel Base
+ to:
+ href: /api/v3/work_packages/78
+ title: Annihilate Yavin 4
+ - _type: Relation
+ id: 652
+ name: relates to
+ type: relates
+ reverseType: relates
+ _hint: Relation resource shortened for brevity.
+ - _hint: Further relation resources shortened for brevity.
+ _links:
+ self:
+ href: /api/v3/relations?filters=%5B%5D&offset=1&pageSize=20
+ jumpTo:
+ href: /api/v3/relations?filters=%5B%5D&offset=%7Boffset%7D&pageSize=20
+ templated: true
+ changeSize:
+ href: /api/v3/relations?filters=%5B%5D&offset=1&pageSize=%7Bsize%7D
+ templated: true
+ nextByOffset:
+ href: /api/v3/relations?filters=%5B%5D&offset=2&pageSize=20
diff --git a/docs/api/apiv3/components/examples/relation_response.yml b/docs/api/apiv3/components/examples/relation_response.yml
new file mode 100644
index 00000000000..80b5035789a
--- /dev/null
+++ b/docs/api/apiv3/components/examples/relation_response.yml
@@ -0,0 +1,35 @@
+# Example: Relation
+---
+value:
+ _type: Relation
+ id: 650
+ name: duplicated by
+ type: duplicated
+ reverseType: duplicates
+ lag: null
+ description: Those are the same... stupid Stormtroopers!
+ _embedded:
+ from:
+ id: 108
+ _type: WorkPackage
+ _hint: Work package resource shortened for brevity.
+ to:
+ id: 78
+ _type: WorkPackage
+ _hint: Work package resource shortened for brevity.
+ _links:
+ self:
+ href: /api/v3/relations/650
+ updateImmediately:
+ href: /api/v3/relations/650
+ method: patch
+ delete:
+ href: /api/v3/relations/650
+ method: delete,
+ title: Remove relation
+ from:
+ href: /api/v3/work_packages/108
+ title: Destroy Rebel Base
+ to:
+ href: /api/v3/work_packages/78
+ title: Annihilate Yavin 4
diff --git a/docs/api/apiv3/components/schemas/relation_collection_model.yml b/docs/api/apiv3/components/schemas/relation_collection_model.yml
new file mode 100644
index 00000000000..9207cce484d
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/relation_collection_model.yml
@@ -0,0 +1,30 @@
+# Schema: RelationCollectionModel
+---
+allOf:
+ - $ref: './collection_model.yml'
+ - type: object
+ required:
+ - _links
+ - _embedded
+ properties:
+ _links:
+ type: object
+ required:
+ - self
+ properties:
+ self:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ This relation collection
+
+ **Resource**: RelationCollectionReadModel
+ _embedded:
+ type: object
+ required:
+ - elements
+ properties:
+ elements:
+ type: array
+ items:
+ $ref: './relation_model.yml'
diff --git a/docs/api/apiv3/components/schemas/relation_edit_form_model.yml b/docs/api/apiv3/components/schemas/relation_edit_form_model.yml
deleted file mode 100644
index 64563cbb734..00000000000
--- a/docs/api/apiv3/components/schemas/relation_edit_form_model.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-# Schema: Relation_edit_formModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/relations/form"
- validate:
- href: "/api/v3/relations/form"
- method: POST
- commit:
- href: "/api/v3/relations"
- method: PATCH
- _type: Form
- _embedded:
- payload:
- _links:
- from:
- href: "/api/v3/work_packages/4534"
- to:
- href: "/api/v3/work_packages/3857"
- _type: WorkPackage
- type: follows
- lag: 3
- description: let it rest for 3 days
- schema:
- _type: Schema
- _links:
- self:
- href: "/api/v3/relations/schema"
- id:
- name: ID
- type: Integer
- writable: false
- type:
- name: Type
- type: String
- writable: true
- allowedValues:
- - relates
- - duplicates
- - duplicated
- - blocks
- - blocked
- - precedes
- - follows
- - includes
- - partof
- - requires
- - required
- reverseType:
- name: Reverse Type
- type: String
- writable: false
- description:
- name: Description
- type: String
- writable: true
- from:
- name: From work package
- type: WorkPackage
- writable: false
- to:
- name: To work package
- type: WorkPackage
- writable: false
- lag:
- name: lag
- type: Integer
- writable: true
- validationErrors:
- from:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:BadExampleError
- message: For the purpose of this example we need a validation error. The remainder
- of the response pretends there were no errors.
diff --git a/docs/api/apiv3/components/schemas/relation_model.yml b/docs/api/apiv3/components/schemas/relation_model.yml
index 594937031aa..2913a5aef6d 100644
--- a/docs/api/apiv3/components/schemas/relation_model.yml
+++ b/docs/api/apiv3/components/schemas/relation_model.yml
@@ -1,111 +1,128 @@
# Schema: RelationModel
---
type: object
+required:
+ - _type
+ - id
properties:
+ _type:
+ type: string
+ enum:
+ - Relation
id:
type: integer
description: Relation ID
- readOnly: true
- exclusiveMinimum: 0
name:
type: string
- description: The internationalized name of this kind of relation
+ description: The internationalized name of this type of relation
type:
type: string
- description: Which kind of relation (blocks, precedes, etc.)
+ description: The relation type.
+ enum:
+ - relates
+ - duplicates
+ - duplicated
+ - blocks
+ - blocked
+ - precedes
+ - follows
+ - includes
+ - partof
+ - requires
+ - required
reverseType:
type: string
- description: The kind of relation from the other WP's perspective
- readOnly: true
+ description: The type of relation from the perspective of the related work package.
+ enum:
+ - relates
+ - duplicates
+ - duplicated
+ - blocks
+ - blocked
+ - precedes
+ - follows
+ - includes
+ - partof
+ - requires
+ - required
description:
- type: string
- description: Short text further describing the relation
- lag*:
- type: integer
+ type:
+ - string
+ - null
+ description: A descriptive text for the relation.
+ lag:
+ type:
+ - integer
+ - null
description: The lag in days between closing of `from` and start of `to`
minimum: 0
+ _embedded:
+ type: object
+ properties:
+ from:
+ $ref: './work_package_model.yml'
+ to:
+ $ref: './work_package_model.yml'
_links:
type: object
required:
- - self
- - schema
- - from
- - to
+ - self
+ - schema
+ - from
+ - to
properties:
- update:
+ self:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Updates the relation between two work packages via a form
-
- # Conditions
-
- **Permission**: manage work package relations
- readOnly: true
+ - $ref: './link.yml'
+ - description: |-
+ This relation
+
+ **Resource**: Relation
+
+ # Conditions
+
+ **Permission**: view work packages
updateImmediately:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Updates the relation between two work packages
-
- # Conditions
-
- **Permission**: manage work package relations
- readOnly: true
+ - $ref: './link.yml'
+ - description: |-
+ Updates the relation between two work packages
+
+ # Conditions
+
+ **Permission**: manage work package relations
delete:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Destroys the relation between the two work packages
-
- # Conditions
-
- **Permission**: manage work package relations
- readOnly: true
- self:
- allOf:
- - "$ref": "./link.yml"
- - description: |-
- This relation
-
- **Resource**: Relation
-
- # Conditions
-
- **Permission**: view work packages
- readOnly: true
- schema:
- allOf:
- - "$ref": "./link.yml"
- - description: |-
- The schema of this relation
-
- **Resource**: Schema
- readOnly: true
+ - $ref: './link.yml'
+ - description: |-
+ Destroys the relation between the two work packages
+
+ # Conditions
+
+ **Permission**: manage work package relations
from:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- The emanating work package
-
- **Resource**: WorkPackage
-
- # Conditions
-
- **Permission**: view work packages
- readOnly: true
+ - $ref: './link.yml'
+ - description: |-
+ The emanating work package
+
+ **Resource**: WorkPackage
+
+ # Conditions
+
+ **Permission**: view work packages
to:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- The work package the relation ends in
-
- **Resource**: WorkPackage
-
- # Conditions
+ - $ref: './link.yml'
+ - description: |-
+ The work package the relation ends in
+
+ **Resource**: WorkPackage
+
+ # Conditions
+
+ **Permission**: view work packages
- **Permission**: view work packages
- readOnly: true
example:
_links:
self:
diff --git a/docs/api/apiv3/components/schemas/relation_schema_model.yml b/docs/api/apiv3/components/schemas/relation_schema_model.yml
deleted file mode 100644
index 42353fe1729..00000000000
--- a/docs/api/apiv3/components/schemas/relation_schema_model.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-# Schema: Relation_schemaModel
----
-type: object
-example:
- _type: Schema
- _links:
- self:
- href: "/api/v3/relations/schema"
- id:
- name: ID
- type: Integer
- writable: false
- type:
- name: Type
- type: String
- writable: true
- reverseType:
- name: Reverse Type
- type: String
- writable: false
- description:
- name: Description
- type: String
- writable: true
- from:
- name: From work package
- type: WorkPackage
- writable: false
- to:
- name: To work package
- type: WorkPackage
- writable: false
- lag:
- name: Lag
- type: Integer
- writable: true
diff --git a/docs/api/apiv3/components/schemas/relations_model.yml b/docs/api/apiv3/components/schemas/relations_model.yml
deleted file mode 100644
index 5e5e129fedf..00000000000
--- a/docs/api/apiv3/components/schemas/relations_model.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-# Schema: RelationsModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/relations"
- total: 3
- count: 1
- _type: Collection
- _embedded:
- elements:
- - _links:
- self:
- href: "/api/v3/relations/1"
- update:
- href: "/api/v3/relations/1/form"
- method: POST
- updateImmediately:
- href: "/api/v3/relations/1"
- method: PATCH
- delete:
- href: "/api/v3/relations/1"
- method: DELETE
- from:
- href: "/api/v3/work_packages/42"
- title: Steel Delivery
- to:
- href: "/api/v3/work_packages/84"
- title: Bending the steel
- _type: Relation
- id: 1
- name: precedes
- type: precedes
- reverseType: follows
- description: We can't bend the steel before it's been delivered!
- lag: 0
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 38b8112aea8..a1112d228cd 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -350,14 +350,8 @@ paths:
"$ref": "./paths/query_unstar.yml"
"/api/v3/relations":
"$ref": "./paths/relations.yml"
- "/api/v3/relations/schema":
- "$ref": "./paths/relations_schema.yml"
- "/api/v3/relations/schema/{type}":
- "$ref": "./paths/relations_schema_{type}.yml"
"/api/v3/relations/{id}":
"$ref": "./paths/relation.yml"
- "/api/v3/relations/{id}/form":
- "$ref": "./paths/relation_form.yml"
"/api/v3/render/markdown":
"$ref": "./paths/render_markdown.yml"
"/api/v3/render/plain":
@@ -513,6 +507,10 @@ components:
$ref: "./components/examples/project_body.yml"
ProjectCollection:
$ref: "./components/examples/project_collection.yml"
+ RelationCollectionResponse:
+ $ref: "./components/examples/relation_collection_response.yml"
+ RelationResponse:
+ $ref: "./components/examples/relation_response.yml"
StorageNextcloudResponse:
$ref: "./components/examples/storage-nextcloud-response.yml"
StorageNextcloudResponseForCreation:
@@ -743,14 +741,10 @@ components:
"$ref": "./components/schemas/query_sort_by_model.yml"
Query_Update_Form:
"$ref": "./components/schemas/query_update_form.yml"
+ RelationCollectionModel:
+ "$ref": "./components/schemas/relation_collection_model.yml"
RelationModel:
"$ref": "./components/schemas/relation_model.yml"
- Relation_edit_formModel:
- "$ref": "./components/schemas/relation_edit_form_model.yml"
- Relation_schemaModel:
- "$ref": "./components/schemas/relation_schema_model.yml"
- RelationsModel:
- "$ref": "./components/schemas/relations_model.yml"
RevisionModel:
"$ref": "./components/schemas/revision_model.yml"
RevisionsModel:
diff --git a/docs/api/apiv3/paths/days_week_day.yml b/docs/api/apiv3/paths/days_week_day.yml
index d68560b77a1..bbf37abec52 100644
--- a/docs/api/apiv3/paths/days_week_day.yml
+++ b/docs/api/apiv3/paths/days_week_day.yml
@@ -36,7 +36,7 @@ get:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
patch:
diff --git a/docs/api/apiv3/paths/relation.yml b/docs/api/apiv3/paths/relation.yml
index 8cd725fae4e..dc4227ccc4d 100644
--- a/docs/api/apiv3/paths/relation.yml
+++ b/docs/api/apiv3/paths/relation.yml
@@ -1,199 +1,161 @@
# /api/v3/relations/{id}
---
-delete:
+get:
+ summary: Get Relation
+ operationId: get_relation
+ tags:
+ - Relations
+ description: Get a single relation specified by its unique identifier.
parameters:
- - description: Relation ID
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: Relation id
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
- '204':
- description: |-
- Returned if the relation was deleted successfully.
- The response body is empty.
- headers: {}
- '403':
+ '200':
+ description: OK
content:
application/hal+json:
- schema:
- $ref: "../components/schemas/error_response.yml"
examples:
response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not allowed to delete this relation.
+ $ref: '../components/examples/relation_response.yml'
+ schema:
+ $ref: '../components/schemas/relation_model.yml'
+ '404':
description: |-
- Returned if the client does not have sufficient permissions.
+ Returned if the relation does not exist or the client does not have sufficient permissions to see it.
- **Required permission:** manage work package relations
- headers: {}
- '404':
+ **Required permission:** view work packages for the involved work packages
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The specified relation does not exist.
- description: |-
- Returned if the relation does not exist or the client does not have sufficient permissions to see it.
- **Required permission:** manage work package relations
- headers: {}
- '406':
- $ref: "../components/responses/missing_content_type.yml"
- '415':
- $ref: "../components/responses/unsupported_media_type.yml"
+delete:
+ summary: Delete Relation
+ operationId: delete_relation
tags:
- - Relations
+ - Relations
description: Deletes the relation.
- operationId: Delete_Relation
- summary: Delete Relation
-get:
parameters:
- - description: Relation id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: The unique identifier of the relation resource
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
- '200':
+ '204':
+ description: Returned if the relation was deleted successfully. The response body is empty.
+ '403':
+ description: |-
+ Returned if the client does not have sufficient permissions.
+
+ **Required permission:** manage work package relations
content:
application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
- _links:
- delete:
- href: "/api/v3/relations/1"
- method: DELETE
- from:
- href: "/api/v3/work_packages/42"
- title: Steel Delivery
- self:
- href: "/api/v3/relations/1"
- to:
- href: "/api/v3/work_packages/84"
- title: Bending the steel
- update:
- href: "/api/v3/relations/1/form"
- method: POST
- updateImmediately:
- href: "/api/v3/relations/1"
- method: PATCH
- _type: Relation
- lag: 0
- description: We can't bend the steel before it's been delivered!
- id: 1
- name: precedes
- reverseType: follows
- type: precedes
- schema:
- "$ref": "../components/schemas/relation_model.yml"
- description: OK
- headers: {}
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to delete this relation.
'404':
+ description: |-
+ Returned if the relation does not exist or the client does not have sufficient permissions to see it.
+
+ **Required permission:** view work packages
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The specified relation does not exist.
- description: |-
- Returned if the relation does not exist or the client does not have sufficient permissions to see it.
+ '406':
+ $ref: '../components/responses/missing_content_type.yml'
+ '415':
+ $ref: '../components/responses/unsupported_media_type.yml'
- **Required permission:** view work packages for the involved work packages
- headers: {}
- tags:
- - Relations
- description: ''
- operationId: View_Relation
- summary: View Relation
patch:
+ summary: Update Relation
+ operationId: update_relation
+ tags:
+ - Relations
+ description: |-
+ When calling this endpoint the client provides a single object, containing the properties and links that it wants
+ to change, in the body. It is only allowed to provide properties or links supporting the **write** operation.
+
+ Note that changing the `type` of a relation invariably also changes the respective `reverseType` as well as the
+ "name" of it. The returned Relation object will reflect that change. For instance if you change a Relation's
+ `type` to "follows" then the `reverseType` will be changed to `precedes`.
parameters:
- - description: Relation ID
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: Relation ID
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
'200':
+ description: OK
content:
application/hal+json:
+ schema:
+ $ref: '../components/schemas/relation_model.yml'
examples:
response:
- value:
- _links:
- delete:
- href: "/api/v3/relations/1"
- method: DELETE
- from:
- href: "/api/v3/work_packages/42"
- title: Steel Delivery
- self:
- href: "/api/v3/relations/1"
- to:
- href: "/api/v3/work_packages/84"
- title: Bending the steel
- update:
- href: "/api/v3/relations/1/form"
- method: POST
- updateImmediately:
- href: "/api/v3/relations/1"
- method: PATCH
- _type: Relation
- lag: 0
- description: We can't bend the steel before it's been delivered!
- id: 1
- name: precedes
- reverseType: follows
- type: precedes
- schema:
- "$ref": "../components/schemas/relation_model.yml"
- description: OK
- headers: {}
+ $ref: '../components/examples/relation_response.yml'
'400':
- $ref: "../components/responses/invalid_request_body.yml"
+ $ref: '../components/responses/invalid_request_body.yml'
'404':
+ description: |-
+ Returned if the relation does not exist or the client does not have sufficient permissions to see it.
+
+ **Required permission:** view work packages
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The specified relation does not exist.
- description: |-
- Returned if the relation does not exist or the client does not have sufficient permissions to see it.
-
- **Required permission:** manage work package relations
- headers: {}
'406':
- $ref: "../components/responses/missing_content_type.yml"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
+ $ref: '../components/responses/unsupported_media_type.yml'
'422':
+ description: |-
+ Returned if:
+
+ - the client tries to modify a read-only property (`PropertyIsReadOnly`)
+ - a constraint for a property was violated (`PropertyConstraintViolation`)
+ - the client provides a link to an invalid resource (`ResourceTypeMismatch`) or a
+ work package that does not exist or for which the client does not have sufficient permissions
+ to see it (**required permissions**: `view work packages` for the involved work packages).
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
@@ -203,25 +165,3 @@ patch:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
message: Lag must be a number greater than or equal to 0
- description: |-
- Returned if:
-
- * the client tries to modify a read-only property (`PropertyIsReadOnly`)
-
- * a constraint for a property was violated (`PropertyConstraintViolation`)
-
- * the client provides a link to an invalid resource (`ResourceTypeMismatch`) or a
- work package that does not exist or for which the client does not have sufficient permissions
- to see it (**required permissions**: `view work packages` for the involved work packages).
- headers: {}
- tags:
- - Relations
- description: |-
- When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body.
- It is only allowed to provide properties or links supporting the **write** operation.
-
- Note that changing the `type` of a relation invariably also changes the respective `reverseType` as well as the "name" of it.
- The returned Relation object will reflect that change. For instance if you change a Relation's
- `type` to "follows" then the `reverseType` will be changed to `precedes`.
- operationId: Edit_Relation
- summary: Edit Relation
diff --git a/docs/api/apiv3/paths/relation_form.yml b/docs/api/apiv3/paths/relation_form.yml
deleted file mode 100644
index 7b3481fa2ad..00000000000
--- a/docs/api/apiv3/paths/relation_form.yml
+++ /dev/null
@@ -1,134 +0,0 @@
-# /api/v3/relations/{id}/form
----
-post:
- parameters:
- - description: ID of the relation being modified
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
- responses:
- '200':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _embedded:
- payload:
- _links:
- from:
- href: "/api/v3/work_packages/4534"
- to:
- href: "/api/v3/work_packages/3857"
- _type: WorkPackage
- lag: 3
- description: let it rest for 3 days
- type: follows
- schema:
- _links:
- self:
- href: "/api/v3/relations/schema"
- _type: Schema
- lag:
- name: Lag
- type: Integer
- writable: true
- description:
- name: Description
- type: String
- writable: true
- from:
- name: From work package
- type: WorkPackage
- writable: false
- id:
- name: ID
- type: Integer
- writable: false
- reverseType:
- name: Reverse Type
- type: String
- writable: false
- to:
- name: To work package
- type: WorkPackage
- writable: false
- type:
- allowedValues:
- - relates
- - duplicates
- - duplicated
- - blocks
- - blocked
- - precedes
- - follows
- - includes
- - partof
- - requires
- - required
- name: Type
- type: String
- writable: true
- validationErrors:
- from:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:BadExampleError
- message: For the purpose of this example we need a validation
- error. The remainder of the response pretends there were no
- errors.
- _links:
- commit:
- href: "/api/v3/relations"
- method: PATCH
- self:
- href: "/api/v3/relations/form"
- validate:
- href: "/api/v3/relations/form"
- method: POST
- _type: Form
- schema:
- "$ref": "../components/schemas/relation_edit_form_model.yml"
- description: OK
- headers: {}
- '403':
- content:
- application/hal+json:
- schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not allowed to edit the specified relation.
- description: |-
- Returned if the client does not have sufficient permissions.
-
- **Required permission:** manage work package relations
-
- *Note that you will only receive this error, if you are at least allowed to see the involved work packages.*
- headers: {}
- '404':
- content:
- application/hal+json:
- schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The specified relation does not exist.
- description: |-
- Returned if the relation does not exist or the client does not have sufficient permissions to see it.
-
- **Required permission:** view (involved) work package(s), manage work package relations
- headers: {}
- tags:
- - Relations
- description: ''
- operationId: Relation_edit_form
- summary: Relation edit form
diff --git a/docs/api/apiv3/paths/relations.yml b/docs/api/apiv3/paths/relations.yml
index 2b60597b3f0..8fb72d0a5e7 100644
--- a/docs/api/apiv3/paths/relations.yml
+++ b/docs/api/apiv3/paths/relations.yml
@@ -1,83 +1,58 @@
# /api/v3/relations
---
get:
+ summary: List Relations
+ operationId: list_relations
+ tags:
+ - Relations
+ description: |-
+ Lists all relations according to the given (optional, logically conjunctive) filters and ordered by ID.
+ The response only includes relations between work packages which the user is allowed to see.
parameters:
- - description: |-
- JSON specifying filter conditions.
- Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Valid fields to filter by are:
-
- + id - ID of relation
-
- + from - ID of work package from which the filtered relations emanates.
-
- + to - ID of work package to which this related points.
-
- + involved - ID of either the `from` or the `to` work package.
-
- + type - The type of relation to filter by, e.g. "follows".
- example: '[{ "from": { "operator": "=", "values": 42 }" }]'
- in: query
- name: filters
- required: false
- schema:
- type: string
- - description: |-
- JSON specifying sort criteria.
- Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
- example: '[["type", "asc"]]'
- in: query
- name: sortBy
- required: false
- schema:
- type: string
+ - name: filters
+ description: |-
+ JSON specifying filter conditions. Accepts the same format as returned by
+ the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Valid fields to filter by are:
+
+ - id - ID of relation
+ - from - ID of work package from which the filtered relations emanates.
+ - to - ID of work package to which this related points.
+ - involved - ID of either the `from` or the `to` work package.
+ - type - The type of relation to filter by, e.g. "follows".
+ example: '[{ "from": { "operator": "=", "values": 42 }" }]'
+ in: query
+ required: false
+ schema:
+ type: string
+ - name: sortBy
+ description: |-
+ JSON specifying sort criteria.
+ Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
+ example: '[["type", "asc"]]'
+ in: query
+ required: false
+ schema:
+ type: string
responses:
'200':
+ description: OK
content:
application/hal+json:
+ schema:
+ $ref: '../components/schemas/relation_collection_model.yml'
examples:
response:
- value:
- _embedded:
- elements:
- - _links:
- delete:
- href: "/api/v3/relations/1"
- method: DELETE
- from:
- href: "/api/v3/work_packages/42"
- title: Steel Delivery
- self:
- href: "/api/v3/relations/1"
- to:
- href: "/api/v3/work_packages/84"
- title: Bending the steel
- update:
- href: "/api/v3/relations/1/form"
- method: POST
- updateImmediately:
- href: "/api/v3/relations/1"
- method: PATCH
- _type: Relation
- lag: 0
- description: We can't bend the steel before it's been delivered!
- id: 1
- name: precedes
- reverseType: follows
- type: precedes
- _links:
- self:
- href: "/api/v3/relations"
- _type: Collection
- count: 1
- total: 3
+ $ref: '../components/examples/relation_collection_response.yml'
+ '400':
+ description: Returned if the client provides invalid filter parameters.
+ content:
+ application/hal+json:
schema:
- "$ref": "../components/schemas/relations_model.yml"
- description: OK
- headers: {}
- tags:
- - Relations
- description: |-
- Lists all relations according to the given (optional, logically conjunctive) filters and ordered by ID.
- The response only includes relations between work packages which the user is allowed to see.
- operationId: List_Relations
- summary: List Relations
+ $ref: '../components/schemas/error_response.yml'
+ examples:
+ response:
+ value:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
+ message:
+ - Filters Type filter has invalid values.
diff --git a/docs/api/apiv3/paths/relations_schema.yml b/docs/api/apiv3/paths/relations_schema.yml
deleted file mode 100644
index 2a8ea400221..00000000000
--- a/docs/api/apiv3/paths/relations_schema.yml
+++ /dev/null
@@ -1,51 +0,0 @@
-# /api/v3/relations/schema
----
-get:
- responses:
- '200':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _links:
- self:
- href: "/api/v3/relations/schema"
- _type: Schema
- lag:
- name: Lag
- type: Integer
- writable: true
- description:
- name: Description
- type: String
- writable: true
- from:
- name: From work package
- type: WorkPackage
- writable: false
- id:
- name: ID
- type: Integer
- writable: false
- reverseType:
- name: Reverse Type
- type: String
- writable: false
- to:
- name: To work package
- type: WorkPackage
- writable: false
- type:
- name: Type
- type: String
- writable: true
- schema:
- "$ref": "../components/schemas/relation_schema_model.yml"
- description: OK
- headers: {}
- tags:
- - Relations
- description: ''
- operationId: View_relation_schema
- summary: View relation schema
diff --git a/docs/api/apiv3/paths/relations_schema_{type}.yml b/docs/api/apiv3/paths/relations_schema_{type}.yml
deleted file mode 100644
index 417e1e01889..00000000000
--- a/docs/api/apiv3/paths/relations_schema_{type}.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# /api/v3/relations/schema/{type}
----
-get:
- parameters:
- - description: Type of the schema
- example: follows
- in: path
- name: type
- required: true
- schema:
- type: string
- responses:
- '200':
- content:
- application/hal+json:
- examples:
- response:
- value:
- _links:
- self:
- href: "/api/v3/relations/schema"
- _type: Schema
- lag:
- name: Lag
- type: Integer
- writable: true
- description:
- name: Description
- type: String
- writable: true
- from:
- name: From work package
- type: WorkPackage
- writable: false
- id:
- name: ID
- type: Integer
- writable: false
- reverseType:
- name: Reverse Type
- type: String
- writable: false
- to:
- name: To work package
- type: WorkPackage
- writable: false
- type:
- name: Type
- type: String
- writable: true
- schema:
- "$ref": "../components/schemas/relation_schema_model.yml"
- description: OK
- headers: {}
- '404':
- content:
- application/hal+json:
- schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The specified relation type does not exist.
- description: |-
- Returned if the relation type does not exist or the client does not have sufficient permissions to see it.
-
- **Required permission:** manage work package relations
- headers: {}
- tags:
- - Relations
- description: ''
- operationId: View_relation_schema_for_type
- summary: View relation schema for type