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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#45850] Update OpenApi documentation related to attachments.
Pavel Balashov0f2f46059ca0
diff --git a/docs/api/apiv3/components/schemas/attachment_model.yml b/docs/api/apiv3/components/schemas/attachment_model.ymlindex cba22afb75c..1b961bc477b 100644--- a/docs/api/apiv3/components/schemas/attachment_model.yml+++ b/docs/api/apiv3/components/schemas/attachment_model.yml@@ -2,45 +2,37 @@---type: objectrequired:-- title-- fileName-- description-- contentType-- digest-- createdAt+ - title+ - fileName+ - description+ - contentType+ - digest+ - createdAtproperties:id:type: integerdescription: Attachment's id- readOnly: true- minimum: 0- exclusiveMinimum: true+ minimum: 1title:type: stringdescription: The name of the file- readOnly: truefileName:type: stringdescription: The name of the uploaded file- readOnly: truefileSize:type: integerdescription: The size of the uploaded file in Bytes- readOnly: trueminimum: 0description:allOf:- - "$ref": "./formattable.yml"+ - $ref: "./formattable.yml"- description: A user provided description of the file- readOnly: truecontentType:type: stringdescription: The files MIME-Type as determined by the server- readOnly: truedigest:type: stringdescription: A checksum for the files content- readOnly: truecreatedAt:type: stringformat: date-time@@ -48,53 +40,48 @@ properties:_links:type: objectrequired:- - self- - container- - author- - downloadLocation+ - self+ - container+ - author+ - downloadLocationproperties:delete:allOf:- - "$ref": "./link.yml"+ - $ref: "./link.yml"- description: |-Deletes this attachment# Conditions**Permission**: edit on attachment container or being the author for attachments without container- readOnly: trueself:allOf:- - "$ref": "./link.yml"+ - $ref: "./link.yml"- description: |-This attachment**Resource**: Attachment- readOnly: truecontainer:allOf:- - "$ref": "./link.yml"+ - $ref: "./link.yml"- description: |-The object (e.g. WorkPackage) housing the attachment**Resource**: Anything- readOnly: trueauthor:allOf:- - "$ref": "./link.yml"+ - $ref: "./link.yml"- description: |-The user who uploaded the attachment**Resource**: User- readOnly: truedownloadLocation:allOf:- - "$ref": "./link.yml"+ - $ref: "./link.yml"- description: |-Direct download link to the attachment**Resource**: -- readOnly: trueexample:_type: Attachment_links:@@ -105,7 +92,7 @@ example:author:href: "/api/v3/users/1"staticDownloadLocation:- href: "/api/v3/attachments/1/download"+ href: "/api/v3/attachments/1/content"downloadLocation:href: "/some/remote/aws/url/image.png"id: 1diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex 49a2d521d7e..006dacec1f3 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -439,8 +439,6 @@ paths:"$ref": "./paths/work_package_available_watchers.yml""/api/v3/work_packages/{id}/file_links":"$ref": "./paths/work_package_file_links.yml"- "/api/v3/work_packages/{id}/update_file_links":- "$ref": "./paths/work_package_update_file_links.yml""/api/v3/work_packages/{id}/form":"$ref": "./paths/work_package_form.yml""/api/v3/work_packages/{id}/revisions":diff --git a/docs/api/apiv3/paths/attachment.yml b/docs/api/apiv3/paths/attachment.ymlindex a976e8b592c..48db46439b8 100644--- a/docs/api/apiv3/paths/attachment.yml+++ b/docs/api/apiv3/paths/attachment.yml@@ -16,36 +16,30 @@ delete:Note that the response body is empty as of now. In future versions of the API a body*might* be returned along with an appropriate HTTP status.- 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 delete this attachment.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission+ message: You are not allowed to delete this attachment.description: |-Returned if the client does not have sufficient permissions.**Required permission:** edit permission for the container of the attachment or being the author for attachments without container*Note that you will only receive this error, if you are at least allowed to see the attachment.*- 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 attachment does not exist.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound+ message: The specified attachment does not exist.description: |-Returned if the attachment does not exist or the client does not have sufficient permissionsto see it.@@ -54,15 +48,14 @@ delete:*Note: A client without sufficient permissions shall not be able to test for the existence of an attachment.That's why a 404 is returned here, even if a 403 might be more appropriate.*- headers: {}'406':$ref: "../components/responses/missing_content_type.yml"'415':$ref: "../components/responses/unsupported_media_type.yml"tags:- - Attachments+ - Attachmentsdescription: Permanently deletes the specified attachment.- operationId: Delete_attachment+ operationId: delete_attachmentsummary: Delete attachmentget:parameters:@@ -77,48 +70,18 @@ get:'200':content:application/hal+json:- examples:- response:- value:- _links:- author:- href: "/api/v3/users/1"- container:- href: "/api/v3/work_packages/1"- downloadLocation:- href: "/some/remote/aws/url/image.png"- self:- href: "/api/v3/attachments/1"- staticDownloadLocation:- href: "/api/v3/attachments/1/download"- _type: Attachment- contentType: image/png- createdAt: '2014-05-21T08:51:20Z'- description:- format: plain- html: "<p>A picture of a cute cat</p>"- raw: A picture of a cute cat- digest:- algorithm: md5- hash: 64c26a8403cd796ea4cf913cda2ee4a9- fileName: cat.png- filesize: 24- id: 1schema:- "$ref": "../components/schemas/attachment_model.yml"+ $ref: "../components/schemas/attachment_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 attachment does not exist.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound+ message: The specified attachment does not exist.description: |-Returned if the attachment does not exist or the client does not have sufficient permissionsto see it.@@ -127,9 +90,8 @@ get:*Note: A client without sufficient permissions shall not be able to test for the existence of an attachment.That's why a 404 is returned here, even if a 403 might be more appropriate.*- headers: {}tags:- - Attachments+ - Attachmentsdescription: ''- operationId: View_attachment+ operationId: view_attachmentsummary: View attachmentdiff --git a/docs/api/apiv3/paths/attachments.yml b/docs/api/apiv3/paths/attachments.ymlindex 495cfa3a9f6..b9e03cd96b8 100644--- a/docs/api/apiv3/paths/attachments.yml+++ b/docs/api/apiv3/paths/attachments.yml@@ -5,71 +5,37 @@ post:'200':content:application/hal+json:- examples:- response:- value:- _links:- author:- href: "/api/v3/users/1"- container:- href: "/api/v3/work_packages/1"- downloadLocation:- href: "/some/remote/aws/url/image.png"- self:- href: "/api/v3/attachments/1"- staticDownloadLocation:- href: "/api/v3/attachments/1/download"- _type: Attachment- contentType: image/png- createdAt: '2014-05-21T08:51:20Z'- description:- format: plain- html: "<p>A picture of a cute cat</p>"- raw: A picture of a cute cat- digest:- algorithm: md5- hash: 64c26a8403cd796ea4cf913cda2ee4a9- fileName: cat.png- filesize: 24- id: 1schema:- "$ref": "../components/schemas/attachment_model.yml"+ $ref: "../components/schemas/attachment_model.yml"description: OK- headers: {}'400':content:application/hal+json:schema:$ref: "../components/schemas/error_response.yml"- examples:- response:- value:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody- message: The request could not be parsed as JSON.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody+ message: The request could not be parsed as JSON.description: |-Returned if the client sends a not understandable request. Reasons include:* Omitting one of the required parts (metadata and file)* sending unparsable JSON in the metadata part- 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 delete this attachment.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission+ message: You are not allowed to delete this attachment.description: |-Returned if the client does not have sufficient permissions.**Required permission:** At least one permission in any project: edit work package, add work package, edit messages, edit wiki pages (plugins might extend this list)- headers: {}'406':$ref: "../components/responses/missing_content_type.yml"'415':@@ -79,12 +45,10 @@ post:application/hal+json:schema:$ref: "../components/schemas/error_response.yml"- examples:- response:- value:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation- message: File is too large (maximum size is 5242880 Bytes).+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation+ message: File is too large (maximum size is 5242880 Bytes).description: |-Returned if the client tries to send an invalid attachment.Reasons are:@@ -92,9 +56,8 @@ post:* Omitting the file name (`fileName` property of metadata part)* Sending a file that is too large- headers: {}tags:- - Attachments+ - Attachmentsdescription: |-Clients can create attachments without a container first and attach them later on.This is useful if the container does not exist at the time the attachment is uploaded.@@ -111,5 +74,5 @@ post:The body *must* be the raw content of the file.Note that a `filename` *must* be indicated in the `Content-Disposition` of this part, although it will be ignored.Instead the `fileName` inside the JSON of the metadata part will be used.- operationId: Create_Attachment+ operationId: create_attachmentsummary: Create Attachmentdiff --git a/docs/api/apiv3/paths/work_package_attachments.yml b/docs/api/apiv3/paths/work_package_attachments.ymlindex dbb1c206481..2ba45f149fc 100644--- a/docs/api/apiv3/paths/work_package_attachments.yml+++ b/docs/api/apiv3/paths/work_package_attachments.yml@@ -14,20 +14,17 @@ get:content:application/hal+json:schema:- "$ref": "../components/schemas/attachments_model.yml"+ $ref: "../components/schemas/attachments_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 work package does not exist.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound+ message: The specified work package does not exist.description: |-Returned if the work package does not exist or the client does not have sufficient permissionsto see it.@@ -36,11 +33,10 @@ get:*Note: A client without sufficient permissions shall not be able to test for the existence of a work package.That's why a 404 is returned here, even if a 403 might be more appropriate.*- headers: {}tags:- - Attachments+ - Attachmentsdescription: ''- operationId: List_attachments_by_work_package+ operationId: list_work_package_attachmentssummary: List attachments by work packagepost:parameters:@@ -55,84 +51,48 @@ post:'200':content:application/hal+json:- examples:- response:- value:- _links:- author:- href: "/api/v3/users/1"- container:- href: "/api/v3/work_packages/1"- downloadLocation:- href: "/some/remote/aws/url/image.png"- self:- href: "/api/v3/attachments/1"- staticDownloadLocation:- href: "/api/v3/attachments/1/download"- _type: Attachment- contentType: image/png- createdAt: '2014-05-21T08:51:20Z'- description:- format: plain- html: "<p>A picture of a cute cat</p>"- raw: A picture of a cute cat- digest:- algorithm: md5- hash: 64c26a8403cd796ea4cf913cda2ee4a9- fileName: cat.png- filesize: 24- id: 1schema:- "$ref": "../components/schemas/attachment_model.yml"+ $ref: "../components/schemas/attachment_model.yml"description: OK- headers: {}'400':content:application/hal+json:schema:$ref: "../components/schemas/error_response.yml"- examples:- response:- value:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody- message: The request could not be parsed as JSON.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody+ message: The request could not be parsed as JSON.description: |-Returned if the client sends a not understandable request. Reasons include:* Omitting one of the required parts (metadata and file)* sending unparsable JSON in the metadata part- 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 delete this attachment.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission+ message: You are not allowed to delete this attachment.description: |-Returned if the client does not have sufficient permissions.**Required permission:** edit work package or add work package*Note that you will only receive this error, if you are at least allowed to see the work package.*- 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 work package does not exist.+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound+ message: The specified work package does not exist.description: |-Returned if the work package does not exist or the client does not have sufficient permissionsto see it.@@ -141,7 +101,6 @@ post:*Note: A client without sufficient permissions shall not be able to test for the existence of a work package.That's why a 404 is returned here, even if a 403 might be more appropriate.*- headers: {}'406':$ref: "../components/responses/missing_content_type.yml"'415':@@ -151,12 +110,10 @@ post:application/hal+json:schema:$ref: "../components/schemas/error_response.yml"- examples:- response:- value:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation- message: File is too large (maximum size is 5242880 Bytes).+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation+ message: File is too large (maximum size is 5242880 Bytes).description: |-Returned if the client tries to send an invalid attachment.Reasons are:@@ -164,9 +121,8 @@ post:* Omitting the file name (`fileName` property of metadata part)* Sending a file that is too large- headers: {}tags:- - Attachments+ - Attachmentsdescription: |-To add an attachment to a work package, a client needs to issue a request of type `multipart/form-data`with exactly two parts.@@ -178,5 +134,5 @@ post:The body *must* be the raw content of the file.Note that a `filename` must be indicated in the `Content-Disposition` of this part, however it will be ignored.Instead the `fileName` inside the JSON of the metadata part will be used.- operationId: Add_attachment_to_work_package- summary: Add attachment to work package+ operationId: create_work_package_attachment+ summary: Create work package attachmentdiff --git a/docs/api/apiv3/paths/work_package_update_file_links.yml b/docs/api/apiv3/paths/work_package_update_file_links.ymldeleted file mode 100644index 26bf20645a0..00000000000--- a/docs/api/apiv3/paths/work_package_update_file_links.yml+++ /dev/null@@ -1,54 +0,0 @@-# /api/v3/work_packages/{id}/update_file_links-----post:- summary: Updated the origin data of the file links of a work package.- operationId: update_work_package_file_links- tags:- - Work Packages- - File links- description: |-- Updates the origin file data of a all file links within a work package.-- The cached data is updated (overwritten) with the new data. If any data point is not available in the new data, but- in the old cache, it is not overwritten.-- After a successful update the client SHOULD retrieve the links of file links again to obtain the new data.- parameters:- - name: id- description: Work package id- in: path- required: true- schema:- type: integer- example: 1337- responses:- '204':- description: No content- '403':- content:- application/hal+json:- schema:- $ref: "../components/schemas/error_response.yml"- example:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission- message: You are not authorized to access this resource.- description: |-- Returned if the client does not have sufficient permissions.-- **Required permission:** view file links-- *Note that you will only receive this error, if you are at least allowed to see the corresponding work package.*- '404':- content:- application/hal+json:- schema:- $ref: "../components/schemas/error_response.yml"- example:- _type: Error- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound- message: The requested resource could not be found.- description: |-- Returned if the work package does not exist or the client does not have sufficient permissions to see it.-- **Required permission:** view work package, view file links