[chore] split read and write models

- file links are splitted into read and write
- checked with openapitools for generated code
  - only 'oneOf' is still not supported, but rest of the generated code
    looks fine
pull/10270/head
Eric Schubert 3 years ago
parent 5cb07c0f02
commit 9b46ac563e
No known key found for this signature in database
GPG Key ID: 1D346C019BD4BAA2
  1. 10
      docs/api/apiv3/components/schemas/file_link_collection_read_model.yml
  2. 35
      docs/api/apiv3/components/schemas/file_link_collection_write_model.yml
  3. 9
      docs/api/apiv3/components/schemas/file_link_origin_data_model.yml
  4. 22
      docs/api/apiv3/components/schemas/file_link_read_model.yml
  5. 47
      docs/api/apiv3/components/schemas/file_link_write_model.yml
  6. 14
      docs/api/apiv3/openapi-spec.yml
  7. 2
      docs/api/apiv3/paths/file_link.yml
  8. 6
      docs/api/apiv3/paths/work_package_file_links.yml

@ -1,7 +1,7 @@
# Schema: File_LinksModel
# Schema: FileLinkCollectionReadModel
---
allOf:
- "$ref": './collection_model.yml'
- $ref: './collection_model.yml'
- type: object
required:
- _links
@ -14,12 +14,11 @@ allOf:
properties:
self:
allOf:
- "$ref": "./link.yml"
- $ref: "./link.yml"
- description: |-
This file links list
**Resource**: File_LinksModel
readOnly: true
_embedded:
type: object
required:
@ -28,7 +27,7 @@ allOf:
elements:
type: array
items:
$ref: './file_link_model.yml'
$ref: './file_link_read_model.yml'
example:
_type: Collection
@ -47,6 +46,7 @@ example:
id: 5503
name: logo.png
mimeType: image/png
size: 16042
createdAt: '2021-12-19T09:42:10.170Z'
lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker

@ -0,0 +1,35 @@
# Schema: FileLinkCollectionWriteModel
---
allOf:
- $ref: './collection_model.yml'
- type: object
required:
- _embedded
properties:
_embedded:
type: object
required:
- elements
properties:
elements:
type: array
items:
$ref: './file_link_write_model.yml'
example:
_embedded:
elements:
- originData:
id: 5503
name: logo.png
mimeType: image/png
size: 16042
createdAt: '2021-12-19T09:42:10.170Z'
lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker
lastModifiedByName: Anakin Skywalker
_links:
storage:
href: /api/v3/storage/42
- _hint: File Link resource shortened for brevity
id: 1338

@ -1,10 +1,11 @@
# Schema: File_Link_Origin_DataModel
# Schema: FileLinkOriginDataModel
---
type: object
required:
- id
- name
- mimeType
- size
- createdAt
- lastModifiedAt
- createdByName
@ -20,12 +21,16 @@ properties:
type: string
minLength: 0
description: MIME type of the linked file
size:
type: integer
minimum: 0
description: file size on origin in bytes
createdAt:
type: string
format: date-time
description: Timestamp of the creation datetime of the file on the origin
lastModifiedAt:
type: string
type: stringa
format: date-time
description: Timestamp of the datetime of the last modification of the file on the origin
createdByName:

@ -1,4 +1,4 @@
# Schema: File_LinkModel
# Schema: FileLinkReadModel
---
type: object
required:
@ -10,27 +10,22 @@ properties:
id:
type: integer
description: File link id
readOnly: true
_type:
type: string
enum:
- FileLink
readOnly: true
createdAt:
type: string
format: date-time
description: Time of creation
readOnly: true
updatedAt:
type: string
format: date-time
description: Time of the most recent change to the file link
readOnly: true
originData:
$ref: './file_link_origin_data_model.yml'
_embedded:
type: object
readOnly: true
required:
- storage
- container
@ -56,7 +51,6 @@ properties:
This file link.
**Resource**: FileLink
readOnly: true
storage:
allOf:
- $ref: './link.yml'
@ -64,14 +58,6 @@ properties:
The storage resource of the linked file.
**Resource**: Storage
storageUrl:
allOf:
- $ref: './link.yml'
- description: |-
The storage url the file link references to.
**Resource**: N/A
writeOnly: true
container:
allOf:
- $ref: './link.yml'
@ -81,7 +67,6 @@ properties:
Can be one of the following **Resources**:
- WorkPackage
readOnly: true
creator:
allOf:
- $ref: './link.yml'
@ -89,7 +74,6 @@ properties:
The creator of the file link.
**Resource**: User
readOnly: true
delete:
allOf:
- $ref: './link.yml'
@ -97,7 +81,6 @@ properties:
The uri to delete the file link.
**Resource**: N/A
readOnly: true
originOpen:
allOf:
- $ref: './link.yml'
@ -105,7 +88,6 @@ properties:
The uri to open the origin file on the origin itself.
**Resource**: N/A
readOnly: true
staticOriginOpen:
allOf:
- $ref: './link.yml'
@ -113,7 +95,6 @@ properties:
A static uri to open the origin file on the storage. Responds with a redirect.
**Resource**: N/A
readOnly: true
example:
id: 1337
@ -124,6 +105,7 @@ example:
id: 5503
name: logo.png
mimeType: image/png
size: 16042
createdAt: '2021-12-19T09:42:10.170Z'
lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker

@ -0,0 +1,47 @@
# Schema: FileLinkWriteModel
---
type: object
required:
- originData
- _links
properties:
originData:
$ref: './file_link_origin_data_model.yml'
_links:
oneOf:
- type: object
required:
- storage
properties:
storage:
allOf:
- $ref: './link.yml'
- description: |-
The storage resource of the linked file.
**Resource**: Storage
- type: object
required:
- storageUrl
properties:
storageUrl:
allOf:
- $ref: './link.yml'
- description: |-
The storage url the file link references to.
**Resource**: N/A
example:
originData:
id: 5503
name: logo.png
mimeType: image/png
size: 16042
createdAt: '2021-12-19T09:42:10.170Z'
lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker
lastModifiedByName: Anakin Skywalker
_links:
storageUrl:
href: 'https://nextcloud.my-deathstar.org'

@ -521,12 +521,16 @@ components:
"$ref": "./components/schemas/example_schema_model.yml"
Execute_custom_action:
"$ref": "./components/schemas/execute_custom_action.yml"
File_LinkModel:
"$ref": "./components/schemas/file_link_model.yml"
File_Link_Origin_DataModel:
FileLinkCollectionReadModel:
$ref: './components/schemas/file_link_collection_read_model.yml'
FileLinkCollectionWriteModel:
$ref: './components/schemas/file_link_collection_write_model.yml'
FileLinkOriginDataModel:
"$ref": "./components/schemas/file_link_origin_data_model.yml"
File_LinksModel:
"$ref": "./components/schemas/file_links_model.yml"
FileLinkReadModel:
$ref: './components/schemas/file_link_read_model.yml'
FileLinkWriteModel:
$ref: './components/schemas/file_link_write_model.yml'
FormModel:
"$ref": "./components/schemas/form_model.yml"
Formattable:

@ -22,7 +22,7 @@ get:
content:
application/hal+json:
schema:
$ref: '../components/schemas/file_link_model.yml'
$ref: '../components/schemas/file_link_read_model.yml'
'404':
content:
application/hal+json:

@ -28,7 +28,7 @@ post:
content:
application/json:
schema:
$ref: '../components/schemas/file_links_model.yml'
$ref: '../components/schemas/file_link_collection_write_model.yml'
example:
_type: Collection
_embedded:
@ -51,7 +51,7 @@ post:
content:
application/hal+json:
schema:
$ref: '../components/schemas/file_links_model.yml'
$ref: '../components/schemas/file_link_collection_read_model.yml'
'400':
content:
application/hal+json:
@ -125,7 +125,7 @@ get:
content:
application/hal+json:
schema:
$ref: '../components/schemas/file_links_model.yml'
$ref: '../components/schemas/file_link_collection_read_model.yml'
'403':
content:
application/hal+json:

Loading…
Cancel
Save