Added self link to StorageFile API representation

pull/11315/head
Andreas Pfohl 2 years ago
parent df0e3607ea
commit 2554e265c4
No known key found for this signature in database
GPG Key ID: FF58F3B771328EB4
  1. 6
      docs/api/apiv3/components/schemas/file_collection_model.yml
  2. 13
      docs/api/apiv3/components/schemas/storage_file_location_model.yml
  3. 6
      modules/storages/lib/api/v3/storage_files/storage_file_representer.rb

@ -47,6 +47,9 @@ example:
lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker
lastModifiedByName: Anakin Skywalker
_links:
self:
href: 'urn:openproject-org:api:v3:storages:storage_file:no_link_provided'
- id: 1338
location: '1338'
name: README.md
@ -56,3 +59,6 @@ example:
lastModifiedAt: '2021-12-21T14:00:13.987Z'
createdByName: Leia Organa
lastModifiedByName: Leia Organa
_links:
self:
href: 'urn:openproject-org:api:v3:storages:storage_file:no_link_provided'

@ -7,3 +7,16 @@ properties:
location:
type: string
description: Location identification for file in storage
_links:
type: object
required:
- self
properties:
self:
allOf:
- "$ref": "./link.yml"
- description: |-
Not provided
**Resource**: urn:openproject-org:api:v3:storages:storage_file:no_link_provided
readOnly: true

@ -30,6 +30,10 @@ module API::V3::StorageFiles
class StorageFileRepresenter < ::API::Decorators::Single
include API::Decorators::DateProperty
link :self do
{ href: "#{::API::V3::URN_PREFIX}storages:storage_file:no_link_provided" }
end
property :id
property :name
property :size
@ -41,7 +45,7 @@ module API::V3::StorageFiles
property :location
def _type
'StorageFile'
Storages::StorageFile.class.to_s
end
end
end

Loading…
Cancel
Save