Updated api definition

This commit is contained in:
Pünkösd Marcell 2020-10-17 03:16:11 +02:00
parent 5a541497b6
commit 06df9ec4eb

View File

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