Updated api definition

This commit is contained in:
Pünkösd Marcell 2020-10-17 03:16:11 +02:00
parent 5a541497b6
commit 06df9ec4eb
1 changed files with 127 additions and 64 deletions

View File

@ -7,7 +7,7 @@ info:
license: license:
name: Apache 2.0 name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.4 version: 1.0.5
servers: servers:
- url: https://birb.k8s.kmlabz.com - url: https://birb.k8s.kmlabz.com
tags: tags:
@ -18,7 +18,7 @@ paths:
get: get:
tags: tags:
- model - model
summary: Return a brief list of available models summary: Return a brief list of all available models
description: Returns a brief list of available models description: Returns a brief list of available models
operationId: getModelList operationId: getModelList
responses: responses:
@ -28,11 +28,34 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/BriefModelDetails' $ref: '#/components/schemas/BriefModelDetails'
/model/{modelType}:
parameters:
- name: modelType
in: path
description: Type of the models (cnn or svm)
required: true
schema:
type: string
get:
tags:
- model
summary: Return a brief list of available models of a specific type
description: Returns a brief list of available models of a specific type
operationId: getModelListType
responses:
200:
description: A brief list of available models
content:
application/json:
schema:
$ref: '#/components/schemas/BriefModelDetails'
post: post:
tags: tags:
- model - model
summary: Uploads a new model into the service summary: Uploads a new model of a specific type into the service
operationId: uploadFile description: Uploads a new model of a specific type into the service. Uses multipart form.
operationId: uploadModelType
requestBody: requestBody:
content: content:
multipart/form-data: multipart/form-data:
@ -45,13 +68,17 @@ paths:
type: object type: object
description: Json metadata of model description: Json metadata of model
properties: properties:
type: target_class_name:
type: string type: string
description: "The name of class that supposed to be detected"
example: "sturnus"
id: id:
type: string type: string
description: "The desired id of the model"
example: "09414c00-0ad6-4ce9-97c4-40b08b0c9325"
file: file:
type: string type: string
description: model itself description: "The model files itself, depends on the type"
format: binary format: binary
required: true required: true
responses: responses:
@ -61,32 +88,40 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ApiResponse' $ref: '#/components/schemas/ModelDetails'
409: 409:
description: A model with this Id already exists description: A model with this Id already exists
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/model/{modelId}: /model/{modelType}/{modelId}:
get: parameters:
tags: - name: modelType
- model
summary: Download a model identified by Id
description: Returns a single model
operationId: getModelById
parameters:
- name: modelId
in: path in: path
description: Id of the model to return or `$default` for the default description: Type of the models (cnn or svm)
required: true required: true
schema: schema:
type: string type: string
- name: modelId
in: path
description: Id of the model or `$default` for the default model
required: true
schema:
type: string
get:
tags:
- model
summary: Get details of a model
description: Return informations of a single model
operationId: getModelById
responses: responses:
200: 200:
description: The requested model description: The details of the requested model
content: content:
application/octet-stream: {} application/json:
schema:
$ref: '#/components/schemas/ModelDetails'
404: 404:
description: A model with this Id does not exist. description: A model with this Id does not exist.
content: content:
@ -98,13 +133,6 @@ paths:
- model - model
summary: Deletes a model identified by Id summary: Deletes a model identified by Id
operationId: deleteModel operationId: deleteModel
parameters:
- name: modelId
in: path
description: Id of the model to delete
required: true
schema:
type: string
responses: responses:
204: 204:
description: Successful deletion description: Successful deletion
@ -115,6 +143,40 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/model/{modelType}/{modelId}/file:
parameters:
- name: modelType
in: path
description: Type of the models (cnn or svm)
required: true
schema:
type: string
- name: modelId
in: path
description: Id of the model or `$default` for the default model
required: true
schema:
type: string
get:
tags:
- model
summary: Download a model file
description: By default it returns the model file itself, additional query parameters may change what file to download
operationId: downloadModelById
responses:
200:
description: The details of the requested model
content:
application/octet-stream:
schema:
type: string
format: binary
404:
description: A model with this Id does not exist.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/model/$default: /model/$default:
put: put:
tags: tags:
@ -130,6 +192,7 @@ paths:
properties: properties:
id: id:
type: string type: string
example: "1e2686bb-a754-4cba-80b8-077c428339cc"
required: false required: false
responses: responses:
204: 204:
@ -142,34 +205,6 @@ paths:
schema: schema:
$ref: '#/components/schemas/ApiResponse' $ref: '#/components/schemas/ApiResponse'
x-codegen-request-body-name: modelId x-codegen-request-body-name: modelId
/model/{modelId}/details:
get:
tags:
- model
summary: Get the details of the model required for extraction
description: Returns a single object representing model details
operationId: getModelDetailsById
parameters:
- name: modelId
in: path
description: Id of the model to return the details of or `$default` for the
default model
required: true
schema:
type: string
responses:
200:
description: The details of the requested model.
content:
application/json:
schema:
$ref: '#/components/schemas/ModelDetails'
404:
description: A model with this id does not exist.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
components: components:
schemas: schemas:
ApiResponse: ApiResponse:
@ -186,6 +221,10 @@ components:
properties: properties:
id: id:
type: string type: string
example: "1e2686bb-a754-4cba-80b8-077c428339cc"
type:
type: string
example: "cnn"
default: default:
type: boolean type: boolean
ModelDetails: ModelDetails:
@ -193,19 +232,43 @@ components:
properties: properties:
id: id:
type: string type: string
example: "1e2686bb-a754-4cba-80b8-077c428339cc"
target_class_name:
type: string
example: "sturnus"
timestamp: timestamp:
type: string type: string
example: "2020-10-15T03:20:28.204605"
default: default:
type: boolean type: boolean
mid_window: details:
type: number type: object
mid_step: properties:
type: number mid_window:
short_window: type: number
type: number mid_step:
short_step: type: number
type: number short_window:
compute_beat: type: number
type: boolean short_step:
type: number
compute_beat:
type: boolean
files:
type: object
properties:
model:
type: string
example: "/model/cnn/1e2686bb-a754-4cba-80b8-077c428339cc/file"
weights:
type: string
example: "/model/cnn/1e2686bb-a754-4cba-80b8-077c428339cc/file?weights="
description: "Only for cnn type"
means:
type: string
example: "/model/svm/1e2686bb-a754-4cba-80b8-077c428339cc/file?means="
description: "Only for svm type"
type: type:
type: string type: string
example: "svm"
description: "svm or cnn"