[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: allOf:
- "$ref": './collection_model.yml' - $ref: './collection_model.yml'
- type: object - type: object
required: required:
- _links - _links
@ -14,12 +14,11 @@ allOf:
properties: properties:
self: self:
allOf: allOf:
- "$ref": "./link.yml" - $ref: "./link.yml"
- description: |- - description: |-
This file links list This file links list
**Resource**: File_LinksModel **Resource**: File_LinksModel
readOnly: true
_embedded: _embedded:
type: object type: object
required: required:
@ -28,7 +27,7 @@ allOf:
elements: elements:
type: array type: array
items: items:
$ref: './file_link_model.yml' $ref: './file_link_read_model.yml'
example: example:
_type: Collection _type: Collection
@ -47,6 +46,7 @@ example:
id: 5503 id: 5503
name: logo.png name: logo.png
mimeType: image/png mimeType: image/png
size: 16042
createdAt: '2021-12-19T09:42:10.170Z' createdAt: '2021-12-19T09:42:10.170Z'
lastModifiedAt: '2021-12-20T14:00:13.987Z' lastModifiedAt: '2021-12-20T14:00:13.987Z'
createdByName: Luke Skywalker 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 type: object
required: required:
- id - id
- name - name
- mimeType - mimeType
- size
- createdAt - createdAt
- lastModifiedAt - lastModifiedAt
- createdByName - createdByName
@ -20,12 +21,16 @@ properties:
type: string type: string
minLength: 0 minLength: 0
description: MIME type of the linked file description: MIME type of the linked file
size:
type: integer
minimum: 0
description: file size on origin in bytes
createdAt: createdAt:
type: string type: string
format: date-time format: date-time
description: Timestamp of the creation datetime of the file on the origin description: Timestamp of the creation datetime of the file on the origin
lastModifiedAt: lastModifiedAt:
type: string type: stringa
format: date-time format: date-time
description: Timestamp of the datetime of the last modification of the file on the origin description: Timestamp of the datetime of the last modification of the file on the origin
createdByName: createdByName:

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

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

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

Loading…
Cancel
Save