Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

59 attachment redefinition #60

Open
wants to merge 4 commits into
base: v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 35 additions & 46 deletions common/schemas/Attachment.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,28 @@ info:

components:
schemas:
Attachment:
AttachmentBase:
description: An attachment is a file that is attached to an entity.

externalDocs:
url: https://datamodel.tmforum.org/en/latest/Common/EntityAttachment
allOf:
- $ref: "./StatusEntity.openapi.yaml#/components/schemas/StatusEntity"
- discriminator:
propertyName: "@type"
mapping:
Attachment: "#/components/schemas/Attachment"
AttachmentMultipart: "#/components/schemas/AttachmentMultipart"
required:
- name
- "@type"
properties:
- properties:
id:
type: string
format: uuid
readOnly: true
"@type":
type: string
default: "Attachment"
example: "Attachment"
description: |
Type d'attachement.

Les valeurs possibles sont:

* `Attachment`: "#/components/schemas/Attachment"
* `AttachmentMultipart`: "#/components/schemas/AttachmentMultipart"
"@baseType":
type: string
default: "Attachment"
example: "Attachment"
mimeType:
description: The mime type of the attachment. This parameter type has to be overriden in child classes.
type: object
readOnly: true
status:
enum:
- UPLOADED
- VALIDATED
- REJECTED
type: object
description: The status of the attachment. This parameter type has to be overriden in child classes.
name:
description: Name of the attachment.
type: string
Expand All @@ -57,11 +39,6 @@ components:
description: Description of the attachment.
type: string
example: Image of the product
mimeType:
description: The mime type of the attachment.
type: string
readOnly: true
example: image/jpeg
size:
description: The size of the attachment in bytes.
type: integer
Expand All @@ -73,9 +50,7 @@ components:
readOnly: true
relatedEntity:
description: The entities related to the attachment.
type: array
items:
$ref: "./RelatedEntity.openapi.yaml#/components/schemas/RelatedEntity"
type: object
readOnly: true
relatedParty:
description: The parties related to the attachment.
Expand All @@ -97,35 +72,52 @@ components:
description: The SHA256 hash of the attachment.
type: string
example: 8cf1bc0fca7f4158b8eb807be15fd7fd21bfe52d956ce3ede1511671c97dad61
required:
- name
- size
- sha256
discriminator:
propertyName: "@type"
mapping:
Attachment: "#/components/schemas/Attachment"
AttachmentMultipart: "#/components/schemas/AttachmentMultipart"

Attachment:
allOf:
- $ref: "#/components/schemas/AttachmentBase"
- required:
- "@type"
properties:
"@type":
type: string
default: "Attachment"
example: "Attachment"
description: |
Attachment non multipart.
readOnly: true

AttachmentFormData:
required:
- file
- attachment
properties:
file:
format: binary
description: The file to upload
type: string
attachment:
$ref: "#/components/schemas/Attachment"

AttachmentChunkForm:
required:
- data
properties:
data:
format: binary
description: The file to upload
description: The chunk of file to upload
type: string
chunk:
$ref: "#/components/schemas/Chunk"

AttachmentMultipart:
allOf:
- $ref: "#/components/schemas/Attachment"
- $ref: "#/components/schemas/AttachmentBase"
- required:
- sha256
- name
- uploadExpectedChunks
properties:
Expand All @@ -142,14 +134,11 @@ components:
- REJECTED
description: The status of the attachment
"@type":
type: string
default: AttachmentMultipart
example: AttachmentMultipart
readOnly: true
description: The type of the attachment
sha256:
description: The SHA256 hash of the attachment.
type: string
example: 8cf1bc0fca7f4158b8eb807be15fd7fd21bfe52d956ce3ede1511671c97dad61
uploadChunks:
readOnly: true
uniqueItems: true
Expand Down