Skip to content

Instantly share code, notes, and snippets.

@workze
Created April 16, 2020 11:06
Show Gist options
  • Save workze/8bdb0a7e2bca6c301c19f52a2744aaa4 to your computer and use it in GitHub Desktop.
Save workze/8bdb0a7e2bca6c301c19f52a2744aaa4 to your computer and use it in GitHub Desktop.
python flask swagger
# swagger-ui-py
swagger: "2.0"
info:
description: "PyRunner分析引擎"
version: "2.0.0"
title: "PyRunner"
basePath: "/"
tags:
- name: "任务管理"
- name: "系统管理"
- name: "应用配置"
- name: "其他"
paths:
/task/start:
post:
summary: "启动任务"
operationId: startTask
tags:
- "任务管理"
parameters:
- in: "body"
name: "body"
schema:
$ref: "#/definitions/Task"
responses:
200:
description: success
/task/stop/{taskId}:
post:
tags:
- "任务管理"
summary: "停止任务"
operationId: stopTask
parameters:
- in: path
name: taskId
description: "任务ID"
required: true
type: string
responses:
200:
description: success
/task/list:
get:
tags:
- "任务管理"
summary: "查询运行中任务列表"
operationId: queryTaskList
responses:
200:
description: success
/task/{taskId}:
get:
tags:
- "任务管理"
summary: "查询任务状态"
operationId: queryTaskState
parameters:
- name: taskId
in: path
type: string
required: true
default: task001
responses:
200:
description: success
/task/info/{taskId}:
get:
tags:
- "任务管理"
summary: "查询任务信息"
operationId: queryTaskInfo
parameters:
- name: taskId
in: path
type: string
required: true
default: task001
responses:
200:
description: success
/info:
get:
tags:
- "系统管理"
summary: "查询系统信息"
operationId: queryInfo
responses:
200:
description: success
/config:
get:
tags:
- "应用配置"
summary: "查询所有应用配置"
operationId: queryConfig
responses:
200:
description: success
put:
tags:
- "应用配置"
summary: "修改系统配置"
operationId: modifyConfig
parameters:
- name: body
in: body
schema:
type: object
example:
{
"section": "mvp",
"option": "managerEndpoint",
"value": "127.0.0.1:28001"
}
responses:
200:
description: success
/health:
get:
tags:
- "其他"
summary: "健康检查"
description: ""
operationId: queryHealth
responses:
200:
description: success
definitions:
Task:
type: object
example:
{
"taskId": "task001",
"jobId": "job001",
"userId": "user001",
"instanceId": "instance001",
"sources": [
{
"name": "step1",
"type": "MockSource",
"config": {}
}
],
"transforms": [
{
"name": "step2",
"type": "Watermark",
"config": {}
}
],
"sinks": [
{
"name": "step3",
"type": "ConsoleSink",
"config": {}
}
],
"hops": [
{
"from": "step1",
"to": "step2"
},
{
"from": "step2",
"to": "step3"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment