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

[#40228] introduced collection model for file links

Eric Schubert396c190be94e
diff --git a/docs/api/apiv3/components/schemas/file_links_model.yml b/docs/api/apiv3/components/schemas/file_links_model.yml
new file mode 100644
index 00000000000..0fd1f44f8f2
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/file_links_model.yml
@@ -0,0 +1,113 @@
+# Schema: File_LinksModel
+---
+allOf:
+ - "$ref": './collection_model.yml'
+ - type: object
+ required:
+ - _links
+ - _embedded
+ properties:
+ _links:
+ type: object
+ required:
+ - self
+ properties:
+ self:
+ allOf:
+ - "$ref": "./link.yml"
+ - description: |-
+ This file links list
+
+ **Resource**: File_LinksModel
+ readOnly: true
+ _embedded:
+ type: object
+ required:
+ - elements
+ properties:
+ elements:
+ type: array
+ items:
+ $ref: './file_link_model.yml'
+
+example:
+ _type: Collection
+ total: 2
+ count: 2
+ _links:
+ self:
+ href: '/api/v3/work_packages/42/file_links'
+ _embedded:
+ elements:
+ - id: 1337
+ _type: FileLink
+ createdAt: '2021-12-20T13:37:00.211Z'
+ updatedAt: '2021-12-20T13:37:00.211Z'
+ originData:
+ id: 5503
+ name: logo.png
+ mimeType: image/png
+ createdAt: '2021-12-19T09:42:10.170Z'
+ lastModifiedAt: '2021-12-20T14:00:13.987Z'
+ createdByName: Luke Skywalker
+ lastModifiedByName: Anakin Skywalker
+ _embedded:
+ storage:
+ id: 1337
+ _type: Storage
+ name: It's no moon
+ createdAt: '2021-12-20T13:37:00.211Z'
+ updatedAt: '2021-12-20T13:37:00.211Z'
+ _links:
+ self:
+ href: /api/v3/storages/1337
+ title: It's no moon
+ type:
+ href: urn:openproject-org:api:v3:storages:nextcloud
+ title: Nextcloud
+ origin:
+ href: https://nextcloud.deathstar.rocks/
+ container:
+ _hint: Work package resource shortened for brevity
+ _type: WorkPackage
+ _links:
+ self:
+ href: "/api/v3/work_packages/1528"
+ title: Develop API
+ schema:
+ href: "/api/v3/work_packages/schemas/11-2"
+ id: 1528
+ subject: Develop API
+ description:
+ format: markdown
+ raw: Develop super cool OpenProject API.
+ html: "<p>Develop super cool OpenProject API.</p>"
+ scheduleManually: false
+ startDate:
+ dueDate:
+ createdAt: '2014-08-29T12:40:53Z'
+ updatedAt: '2014-08-29T12:44:41Z'
+ _links:
+ self:
+ href: /api/v3/work_package/17/file_links/1337
+ title: file link
+ storage:
+ href: /api/v3/storage/42
+ title: storage
+ container:
+ href: /api/v3/work_package/17
+ title: work package
+ creator:
+ href: /api/v3/users/33
+ title: Obi-Wan Kenobi
+ delete:
+ href: /api/v3/work_package/17/file_links/1337
+ title: file link delete API
+ originOpen:
+ href: https://nextcloud.deathstar.rocks/index.php/f?fileid=5503
+ title: file open
+ staticOriginOpen:
+ href: /api/v3/work_package/17/file_links/1337/open
+ title: file open
+ - _hint: File Link resource shortened for brevity
+ id: 1338
diff --git a/docs/api/apiv3/components/schemas/work_package_create_form.yml b/docs/api/apiv3/components/schemas/work_package_create_form.yml
deleted file mode 100644
index 07ecaaa3ff2..00000000000
--- a/docs/api/apiv3/components/schemas/work_package_create_form.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-# Schema: Work_Package_Create_Form
---- {}
diff --git a/docs/api/apiv3/components/schemas/work_package_create_form_for_project.yml b/docs/api/apiv3/components/schemas/work_package_create_form_for_project.yml
deleted file mode 100644
index 0d0b082ff94..00000000000
--- a/docs/api/apiv3/components/schemas/work_package_create_form_for_project.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-# Schema: Work_Package_Create_Form_For_Project
---- {}
diff --git a/docs/api/apiv3/components/schemas/work_package_edit_form.yml b/docs/api/apiv3/components/schemas/work_package_edit_form.yml
deleted file mode 100644
index 2cf117d0d5c..00000000000
--- a/docs/api/apiv3/components/schemas/work_package_edit_form.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-# Schema: Work_Package_Edit_Form
---- {}
diff --git a/docs/api/apiv3/components/schemas/work_package_schema.yml b/docs/api/apiv3/components/schemas/work_package_schema.yml
deleted file mode 100644
index 8aba1c876b2..00000000000
--- a/docs/api/apiv3/components/schemas/work_package_schema.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-# Schema: Work_Package_Schema
---- {}
diff --git a/docs/api/apiv3/components/schemas/work_packages_model.yml b/docs/api/apiv3/components/schemas/work_packages_model.yml
index 10a740f5859..99c05009807 100644
--- a/docs/api/apiv3/components/schemas/work_packages_model.yml
+++ b/docs/api/apiv3/components/schemas/work_packages_model.yml
@@ -30,7 +30,6 @@ allOf:
items:
$ref: './work_package_model.yml'
-type: object
example:
_links:
self:
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 6eed2a1cdf1..4c79b933724 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -525,6 +525,8 @@ components:
"$ref": "./components/schemas/file_link_model.yml"
File_Link_Origin_DataModel:
"$ref": "./components/schemas/file_link_origin_data_model.yml"
+ File_LinksModel:
+ "$ref": "./components/schemas/file_links_model.yml"
FormModel:
"$ref": "./components/schemas/form_model.yml"
Formattable:
diff --git a/docs/api/apiv3/paths/work_package_file_links.yml b/docs/api/apiv3/paths/work_package_file_links.yml
index 644645afab3..3665252d102 100644
--- a/docs/api/apiv3/paths/work_package_file_links.yml
+++ b/docs/api/apiv3/paths/work_package_file_links.yml
@@ -28,32 +28,7 @@ post:
content:
application/json:
schema:
- type: object
- required:
- - _type
- - _embedded
- properties:
- _type:
- type: string
- enum:
- - Collection
- _embedded:
- type: object
- required:
- - elements
- properties:
- elements:
- type: array
- items:
- allOf:
- - $ref: '../components/schemas/file_link_model.yml'
- - type: object
- required:
- - storageUrl
- properties:
- storageUrl:
- type: string
- format: uri
+ $ref: '../components/schemas/file_links_model.yml'
example:
_type: Collection
_embedded:
@@ -76,32 +51,7 @@ post:
content:
application/hal+json:
schema:
- type: object
- required:
- - _type
- - count
- - total
- - _embedded
- properties:
- _type:
- type: string
- enum:
- - Collection
- count:
- type: integer
- minimum: 0
- total:
- type: integer
- minimum: 0
- _embedded:
- type: object
- required:
- - elements
- properties:
- elements:
- type: array
- items:
- $ref: '../components/schemas/file_link_model.yml'
+ $ref: '../components/schemas/file_links_model.yml'
'400':
content:
application/hal+json:
@@ -152,6 +102,7 @@ post:
description: |-
Occurs if the request body was correctly formatted, but some properties lead to errors in the validation
process. This happens e.g. if the provided storage url is not available on the server.
+
get:
summary: Gets all file links of a work package
operationId: Work_Package_Get_File_Links
@@ -160,8 +111,6 @@ get:
- File links
description: |-
Gets all file links of a work package.
-
- The request can be filtered for the storage types and ids.
parameters:
- name: id
description: Work package id
@@ -176,32 +125,7 @@ get:
content:
application/hal+json:
schema:
- type: object
- required:
- - _type
- - count
- - total
- - _embedded
- properties:
- _type:
- type: string
- enum:
- - Collection
- count:
- type: integer
- minimum: 0
- total:
- type: integer
- minimum: 0
- _embedded:
- type: object
- required:
- - elements
- properties:
- elements:
- type: array
- items:
- $ref: '../components/schemas/file_link_model.yml'
+ $ref: '../components/schemas/file_links_model.yml'
'403':
content:
application/hal+json: