We are trying to develop a Web API similar to google drive file upload API (
https://developers.google.com/drive/v3/web/manage-uploads#multipart) and
currently designing swagger document for the same. The post method's
request body will have metadata and file, Multiple files will be delimited
by some boundary values. We need help in defining swagger document for this
with multipart/related content type
I have given the swagger file created below. Please help me in fixing the
document.
Thanks in advance
Siva
##############################################################
# HEADER #
##############################################################
swagger: '2.0'
info:
title: File
version: '2016.10.25'
description: 'description here.'
host: services.abc.com
basePath: /upload/File
schemes:
- https
##############################################################
# ENDPOINTS #
##############################################################
paths:
/content:
post:
summary: File
operationId: File Create
description: Creates a File resource.
consumes:
- multipart/related
produces:
- application/files-v1+json
parameters:
- name: body
in: body
required: true
description: File to be created.
schema:
$ref: '#/definitions/FileCollectionPost'
responses:
201:
description: Created
headers:
Location:
description: URL of the new File resource.
type: string
schema:
$ref: '#/definitions/File'
400:
description: Bad Request - Invalid parameters
401:
description: Unauthorized
403:
description: Forbidden
406:
description: Request Not Acceptable
409:
description: Conflict
415:
description: Unsupported Media Type
500:
description: Internal Server Error - Try again if you like.
##############################################################
# DEFINITIONS #
##############################################################
definitions:
File:
type: object
properties:
id:
type: string
description: Unique ID (GUI ID) of the file.
example: er123ieowo
serialNumber:
description: Serial number of asset.
type: string
example: pdfs1232ds
userID:
description: UserID of the file uploader.
type: string
example: sampleuser
latitude:
description: Latitude value of the location from where the file
being uploaded.
type: number
format: double
longitude:
description: Longitude value of the location from where the file
being uploaded.
type: number
format: double
FileCollectionPost:
type: object
properties:
type:
description: Type of file.
type: string
format: custom
enum:
- Value1
- Value2
- Value3
example: Value1
fileName:
description: Name of the file being uploaded with extension.
type: string
example: abc.pdf
latitude:
type: number
format: double
description: The angular distance of a place north or south of the
earth’s equator.
minimum: -90
maximum: 90
example: 42
longitude:
type: number
format: double
description: The angular distance, in degrees, minutes, and
seconds, of a point east or west of the Prime Meridian.
minimum: -180
maximum: 180
example: 12.04
fileToUpload:
type: string
description: File to be created.
format: binary
properties:
additionalProperties:
type: string
description: |-
A collection of arbitrary key-value pairs which are visible to
all apps.
Entries with null values are cleared in update and copy requests.
type: object
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.