From ad3a7db0d905f3ba23d4afd3dd20f06ce8728736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 26 Jul 2020 18:40:47 +0200 Subject: [PATCH] update all definitions to openapi3 --- input.yml | 261 ++++++++++++++++++++++++++++------------------------ model.yaml | 20 ++-- storage.yml | 168 +++++++++++++++++---------------- 3 files changed, 237 insertions(+), 212 deletions(-) diff --git a/input.yml b/input.yml index 5e53c7f..2164d31 100644 --- a/input.yml +++ b/input.yml @@ -1,151 +1,168 @@ -swagger: "2.0" +openapi: 3.0.3 info: - description: "This is the input interface of the Birbnetes system." - version: "1.1.0" - title: "Input Service" + title: Input Service + description: This is the input interface of the Birbnetes system. contact: - email: "tormakristof@tormakristof.eu" + email: tormakristof@tormakristof.eu license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "dev.k8s.tcloud.enginner" -basePath: "/api/input/v1" + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: 1.1.3 +servers: +- url: https://dev.k8s.tcloud.enginner/api/input/v1 +- url: http://dev.k8s.tcloud.enginner/api/input/v1 tags: -- name: "input" - description: "Input Service interaction" -schemes: -- "https" -- "http" +- name: input + description: Input Service interaction paths: /sample: get: + tags: + - input summary: Get all stored input queries operationId: getall - tags: - - input - responses: - "200": - description: Array of input objects - schema: - $ref: '#/definitions/InputResponse' - "404": - description: No object matching filter - schema: - $ref: '#/definitions/ApiResponse' - - post: - tags: - - "input" - summary: "uploads a sample into the system" - description: "" - operationId: "uploadFile" - consumes: - - "multipart/form-data" - produces: - - "application/json" - parameters: - - name: "description" - in: "formData" - description: "JSON" - required: true - type: "string" - format: "date" - - name: "file" - in: "formData" - description: "Wave file to upload" - required: true - type: "file" responses: 200: - description: "successful operation" - schema: - $ref: "#/definitions/ApiResponse" - 415: - description: "Media type error" - schema: - $ref: "#/definitions/ApiResponse" + description: Array of input objects + content: + application/json: + schema: + $ref: '#/components/schemas/InputResponse' + 404: + description: No object matching filter + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + post: + tags: + - input + summary: uploads a sample into the system + operationId: uploadFile + requestBody: + content: + multipart/form-data: + schema: + required: + - description + - file + properties: + description: + type: object + description: Metadata json + properties: + deviceid: + type: string + date: + type: string + format: date + file: + type: string + description: Wave file to upload + format: binary + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' 400: - description: "JSON parse error" - schema: - $ref: "#/definitions/ApiResponse" + description: JSON parse error + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + 415: + description: Media type error + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' 417: - description: "JSON invalid schema" - schema: - $ref: "#/definitions/ApiResponse" + description: JSON invalid schema + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' 469: - description: "No file found" - schema: - $ref: "#/definitions/ApiResponse" + description: No file found + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' 470: - description: "Description missing" - schema: - $ref: "#/definitions/ApiResponse" - + description: Description missing + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' /sample/{tagID}: get: + tags: + - input summary: Get input object by ID operationId: getInput - tags: - - input parameters: - - name: tagID - in: path - description: ID of input object file - required: true + - name: tagID + in: path + description: ID of input object file + required: true + schema: type: string format: uuid responses: - "200": + 200: description: input object - schema: - $ref: '#/definitions/InputSingeResponse' - "404": + content: + application/json: + schema: + $ref: '#/components/schemas/InputSingeResponse' + 404: description: Tag not found - schema: - $ref: '#/definitions/ApiResponse' - - -definitions: - InputSingeResponse: - type: "object" - properties: - status: - type: "string" - message: - $ref: '#/definitions/InputObject' - required: - - status + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' +components: + schemas: + InputSingeResponse: + required: - message - - InputResponse: - type: "array" - items: - $ref: "#/definitions/InputObject" - - - InputObject: - type: "object" - properties: - tag: - type: "string" - format: "uuid" - date: - type: "string" - format: "date" - device_id: - type: "integer" - required: - - tag + - status + type: object + properties: + status: + type: string + message: + $ref: '#/components/schemas/InputObject' + InputResponse: + type: array + items: + $ref: '#/components/schemas/InputObject' + InputObject: + required: - date - device_id - - ApiResponse: - type: "object" - properties: - status: - type: "string" - message: - type: "string" - required: + - tag + type: object + properties: + tag: + type: string + format: uuid + date: + type: string + format: date + device_id: + type: integer + ApiResponse: + required: + - message - status - - message \ No newline at end of file + type: object + properties: + status: + type: string + message: + type: string diff --git a/model.yaml b/model.yaml index 405b0c6..2bbe266 100644 --- a/model.yaml +++ b/model.yaml @@ -7,7 +7,7 @@ info: license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html - version: 1.0.3 + version: 1.0.4 servers: - url: https://dev.k8s.tcloud.enginner/api/model/v1 - url: http://dev.k8s.tcloud.enginner/api/model/v1 @@ -43,12 +43,16 @@ paths: - info properties: info: - type: string - description: This is actually a UploadInfo but swagger 2.0 does - not support that + type: object + description: Json metadata of model + properties: + type: + type: string + id: + type: string file: type: string - description: model + description: model itself format: binary required: true responses: @@ -82,16 +86,14 @@ paths: responses: 200: description: The requested model - content: {} + content: + application/octet-stream: {} 404: description: A model with this Id does not exist. content: application/json: schema: $ref: '#/components/schemas/ApiResponse' - application/octet-stream: - schema: - $ref: '#/components/schemas/ApiResponse' delete: tags: - model diff --git a/storage.yml b/storage.yml index e1b6ac2..22e7e79 100644 --- a/storage.yml +++ b/storage.yml @@ -1,108 +1,114 @@ -swagger: "2.0" +openapi: 3.0.3 info: - description: "This is the internal storage interface of the Birbnetes system." - version: "1.1.3" - title: "Storage Service" + title: Storage Service + description: This is the internal storage interface of the Birbnetes system. contact: - email: "tormakristof@tormakristof.eu" + email: tormakristof@tormakristof.eu license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "dev.k8s.tcloud.enginner" -basePath: "/api/storage/v1" + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: 1.1.4 +servers: +- url: https://dev.k8s.tcloud.enginner/api/storage/v1 +- url: http://dev.k8s.tcloud.enginner/api/storage/v1 tags: -- name: "storage" - description: "Storage Service definition" -schemes: -- "https" -- "http" +- name: storage + description: Storage Service definition paths: /object: post: tags: - - "storage" - summary: "Uploads an object into the service" - description: "" - operationId: "uploadFile" - consumes: - - "multipart/form-data" - produces: - - "application/json" - parameters: - - name: "description" - in: "formData" - description: "This is actually a SoundDescription but swagger 2.0 does not support that" + - storage + summary: Uploads an object into the service + operationId: uploadFile + requestBody: + content: + multipart/form-data: + schema: + required: + - description + - soundFile + properties: + description: + type: object + description: Metadata JSON + properties: + tag: + type: string + soundFile: + type: string + description: Wave file to upload + format: binary required: true - type: "string" - - name: "soundFile" - in: "formData" - description: "Wave file to upload" - required: true - type: "file" responses: 200: - description: "Object successfully stored. This means that a get request for this object should be successful." - schema: - $ref: "#/definitions/ApiResponse" + description: Object successfully stored. This means that a get request for + this object should be successful. + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' 409: - description: "An object with this Tag already exists" - schema: - $ref: "#/definitions/ApiResponse" + description: An object with this Tag already exists + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' /object/{objectTag}: get: tags: - - "storage" - summary: "Download a wave file identified by Tag" - description: "Returns a single pet" - operationId: "getPetById" - produces: - - "application/json" - - "audio/wave" + - storage + summary: Download a wave file identified by Tag + description: Returns a single pet + operationId: getPetById parameters: - - name: "objectTag" - in: "path" - description: "Tag of wave file to return" + - name: objectTag + in: path + description: Tag of wave file to return required: true - type: "string" + schema: + type: string responses: 200: - description: "The requested audio file." + description: The requested audio file. + content: {} 404: - description: "An object with this Tag does not exist." - schema: - $ref: "#/definitions/ApiResponse" + description: An object with this Tag does not exist. + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + audio/wave: + schema: + $ref: '#/components/schemas/ApiResponse' delete: tags: - - "storage" - summary: "Deletes a wave file identified by Tag" - description: "" - operationId: "deleteWave" - produces: - - "application/json" + - storage + summary: Deletes a wave file identified by Tag + operationId: deleteWave parameters: - - name: "objectTag" - in: "path" - description: "Tag of wave file to delete" + - name: objectTag + in: path + description: Tag of wave file to delete required: true - type: "string" + schema: + type: string responses: 200: - description: "Successful deletion" + description: Successful deletion + content: {} 404: - description: "An object with this Tag does not exist." - schema: - $ref: "#/definitions/ApiResponse" - -definitions: - ApiResponse: - type: "object" - properties: - status: - type: "string" - msg: - type: "string" - SoundDescription: - type: "object" - properties: - tag: - type: "string" \ No newline at end of file + description: An object with this Tag does not exist. + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' +components: + schemas: + ApiResponse: + type: object + properties: + status: + type: string + msg: + type: string