OPENAPI: Fix regex & missing lenght for image/jpg and make it a component

This commit is contained in:
Marco Realacci 2022-12-10 02:04:41 +01:00
parent 0645bd1848
commit c05abb44fd

View file

@ -624,12 +624,9 @@ paths:
- BearerAuth: [] - BearerAuth: []
requestBody: requestBody:
content: content:
image/jpeg: image/jpg:
schema: schema:
description: The photo to upload. $ref: "#/components/schemas/image_jpg"
type: string
format: binary
pattern: "(?s).*" # todo: review. Btw this means "any string"
responses: responses:
'201': '201':
description: Upload photo action successful. description: Upload photo action successful.
@ -673,13 +670,10 @@ paths:
'200': '200':
description: The requested photo in binary format. description: The requested photo in binary format.
content: content:
image/jpeg: image/jpg:
schema: schema:
minLength: 1 $ref: "#/components/schemas/image_jpg"
maxLength: 10485760 # Image should not be bigger than 10 MiB
description: The requested photo in binary format.
type: string
format: binary
'404': '404':
description: User or photo not found (or the authorized user is banned by the author of the photo). description: User or photo not found (or the authorized user is banned by the author of the photo).
content: content:
@ -1090,6 +1084,13 @@ components:
type: string type: string
example: "What a lovely picture! 😊" example: "What a lovely picture! 😊"
description: The comment's text description: The comment's text
image_jpg:
description: The photo to upload.
type: string
format: binary
minLength: 1
maxLength: 10485760 # 10 MB
pattern: "((.|\n)*)" # todo: review. Btw this means "any string"
generic_response: generic_response:
type: object type: object
@ -1097,6 +1098,8 @@ components:
properties: properties:
status: status:
type: string type: string
minLength: 1
maxLength: 255
pattern: ".*" pattern: ".*"
description: The status of the request. description: The status of the request.
example: "Success" example: "Success"