swagger-docs/model.yaml

274 lines
7.9 KiB
YAML

openapi: 3.0.3
info:
title: Model Service
description: This is the model-service interface of the Birbnetes system.
contact:
email: punkosdmarcell@rocketmail.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.5
servers:
- url: https://birb.k8s.kmlabz.com
tags:
- name: model
description: Model Service definition
paths:
/model:
get:
tags:
- model
summary: Return a brief list of all available models
description: Returns a brief list of available models
operationId: getModelList
responses:
200:
description: A brief list of available models
content:
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 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:
schema:
required:
- file
- info
properties:
info:
type: object
description: Json metadata of model
properties:
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: "The model files itself, depends on the type"
format: binary
required: true
responses:
201:
description: Model successfully stored. This means that a get request for
this object should be successful.
content:
application/json:
schema:
$ref: '#/components/schemas/ModelDetails'
409:
description: A model with this Id already exists
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/model/{modelType}/{modelId}:
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: Get details of a model
description: Return informations of a single model
operationId: getModelById
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'
delete:
tags:
- model
summary: Deletes a model identified by Id
operationId: deleteModel
responses:
204:
description: Successful deletion
content: {}
404:
description: An model with this Id does not exist.
content:
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:
- model
summary: Updates the id of the default model
description: It really does
operationId: updateDefault
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: string
example: "1e2686bb-a754-4cba-80b8-077c428339cc"
required: false
responses:
204:
description: Successful update
content: {}
404:
description: The id does not identifies any model
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
x-codegen-request-body-name: modelId
components:
schemas:
ApiResponse:
type: object
properties:
status:
type: string
msg:
type: string
BriefModelDetails:
type: array
items:
type: object
properties:
id:
type: string
example: "1e2686bb-a754-4cba-80b8-077c428339cc"
type:
type: string
example: "cnn"
default:
type: boolean
ModelDetails:
type: object
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
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"